|
1 |
| -# RSA IFMA Muti-buffer Library |
| 1 | +# Crypto Multi-buffer Library |
2 | 2 |
|
3 |
| -It is a library separate from Intel IPP Cryptography. The library provides optimized version of RSA multi-buffer based on Intel(R) Advanced Vector Extensions 512 (Intel(R) AVX-512) Integer Fused Multiply Add (IFMA). Currently, the library is compatible with OpenSSL\* only. |
| 3 | +Currently, the library provides optimized version of RSA multi-buffer encryption and decryption algorithms based on Intel® Advanced Vector Extensions 512 (Intel® AVX-512) integer fused multiply-add (IFMA) operations. This CPU feature is introduced with Intel® Microarchitecture Code Named Ice Lake. |
4 | 4 |
|
5 |
| -## System Requirements |
| 5 | +## Multiple Buffers Processing Overview |
6 | 6 |
|
7 |
| -The library build process was tested on the following operating systems and tools: |
8 |
| -- Linux\* OS |
9 |
| -- GCC\* 8.2 |
10 |
| -- CMake\* 3.12 |
11 |
| -- Python\* 2.7.16 |
| 7 | +Some of the cryptography algorithms cannot be parallelized due to their specificity. For example, the RSA algorithm consists of big-number (multi-digit) arithmetic: multi-precision modular multiplications and squaring operations. |
| 8 | + |
| 9 | +Digits of multi-digit numbers are dependent because of carry propagation during arithmetic operations. Therefore, single RSA computation based on general purpose mul/adc instructions is not efficient. |
| 10 | + |
| 11 | +The way to get high-performance implementations of such cryptographic algorithms is a parallel processing using *single instruction, multiple data* (SIMD) architecture. The usage model implies presence of several independent and homogeneous (encryption or decryption) requests for RSA operations, using of SIMD leads to performance improvement. |
| 12 | + |
| 13 | +Multi-buffer processing collects up to eight RSA operations. Each request is computed independently from the others, so it is possible to process several packets at the same time. |
| 14 | + |
| 15 | +This library consists of highly-optimized kernels taking advantage of Intel’s multi-buffer processing and Intel® AVX-512 instruction set. |
| 16 | + |
| 17 | +## Software Requirements |
| 18 | + |
| 19 | +### Common |
| 20 | + |
| 21 | +- CMake\* 3.10 or higher |
| 22 | +- The Netwide Assembler (NASM) 2.14\* |
12 | 23 | - OpenSSL\* 1.1.0
|
13 | 24 |
|
14 |
| -## Building from Source |
| 25 | +### Linux* OS |
15 | 26 |
|
16 |
| -1. Clone the repository and navigate to the `sources/ippcp/ifma_rsa_mb` folder. |
| 27 | +- Intel® C++ Compiler 19.0 Update 4 for Linux\* OS |
| 28 | +- GCC 8.2 |
| 29 | +- Clang 9 |
| 30 | +- GNU binutils 2.32 |
17 | 31 |
|
18 |
| -2. Run CMake on the command line. Example CMake lines and avaliable options: |
| 32 | +### Windows* OS |
19 | 33 |
|
20 |
| -Use `-B` to specify path to the resulting project. Do not specify any additional options to use Python and OpenSSL from default system paths: |
21 |
| -``` |
22 |
| -cmake . -B../build |
23 |
| -``` |
| 34 | +- Intel® C++ Compiler 19.0 Update 4 for Windows\* OS |
| 35 | +- Microsoft Visual C++ Compiler\* version 19.16 provided by Microsoft Visual Studio\* 2017 version 15.9 |
24 | 36 |
|
25 |
| -Use `PYTHON_EXECUTABLE` variable to override path to Python: |
26 |
| -``` |
27 |
| -cmake . -B../build -DPYTHON_EXECUTABLE=/path/to/python27 |
28 |
| -``` |
| 37 | +### macOS* |
29 | 38 |
|
30 |
| -Use `OPENSSL_INCLUDE_DIR`, `OPENSSL_LIBRARIES` and `OPENSSL_ROOT_DIR` variables to override path to OpenSSL: |
31 |
| -``` |
32 |
| -cmake . -B../build -DOPENSSL_INCLUDE_DIR=/path/to/openssl/include -DOPENSSL_LIBRARIES=/path/to/openssl/lib -DOPENSSL_ROOT_DIR=/path/to/openssl |
33 |
| -``` |
| 39 | +- Intel® C++ Compiler 19.0 Update 4 for macOS\* |
| 40 | + |
| 41 | +## Installation |
| 42 | + |
| 43 | +You can install the Crypto Multi-buffer library in two different ways: |
| 44 | +1. Installation to the default directories. |
| 45 | + > **Note**: To run this installation type, you need to have appropriate permissions to write to the installation directory. |
34 | 46 |
|
35 |
| -3. Go to the project folder that was specified with `-B` and run `make` to build the library (`librsa_ifma` target) and, optionally, tests (`vfy_ifma_rsa_mb`, `vfy_ifma_cp_rsa_mb` targets). The resulting binaries will be placed in the `bin` subfolder inside the build folder. |
| 47 | + Default locations (default values of `CMAKE_INSTALL_PREFIX`): |
| 48 | + - Unix: /usr/local |
| 49 | + - Windows: C:\Program Files\crypto_mb or C:\Program Files (x86)\crypto_mb |
| 50 | + |
| 51 | + To begin installation, run the command below in the project folder that was specified with `-B`: |
| 52 | + ``` bash |
| 53 | + make install |
| 54 | + ``` |
36 | 55 |
|
37 |
| -Example: |
| 56 | +2. Installation to your own directory. |
| 57 | + If you want to install the library not by default paths, specify the `CMAKE_INSTALL_PREFIX` variable at the configuration step, for example: |
| 58 | + ``` bash |
| 59 | + cmake . -B"../build" -DCMAKE_INSTALL_PREFIX=path/to/libcrypto_mb/installation |
| 60 | + ``` |
| 61 | + |
| 62 | +You can find the installed files in: |
| 63 | + |
| 64 | +``` bash |
| 65 | + |
| 66 | +├── ${CMAKE_INSTALL_PREFIX} |
| 67 | + ├── include |
| 68 | + | └── crypto_mb |
| 69 | + │ ├── ed25519_ifma.h |
| 70 | + │ ├── ifma_method.h |
| 71 | + │ ├── rsa_ifma.h |
| 72 | + │ ├── rsa_ifma_cp.h |
| 73 | + │ ├── rsa_ifma_defs.h |
| 74 | + │ └── rsa_ifma_status.h |
| 75 | + └── lib |
| 76 | + └── libcrypto_mb.a |
38 | 77 | ```
|
39 |
| -make -j8 |
40 |
| -./bin/vfy_ifma_rsa_mb |
| 78 | +## How to Build |
| 79 | + |
| 80 | +You can build the library in two ways: |
| 81 | +- Using universal building, which can be used with any target API (in particular, with Intel® Integrated Performance Primitives (Intel® IPP) Cryptography\* API) |
| 82 | +- Using the OpenSSL\* library |
| 83 | + |
| 84 | +### Universal building |
| 85 | + |
| 86 | +1. Clone the repository from GitHub\* as follows: |
| 87 | + |
| 88 | + ``` bash |
| 89 | + git clone --recursive https://github.com/intel/ipp-crypto |
| 90 | + ``` |
| 91 | + and navigate to the `sources/ippcp/crypto_mb` folder. |
| 92 | +2. Set the environment variables for one of the supported C/C++ compilers. |
| 93 | +3. Run CMake on the command line. Use `-B` to specify path to the resulting project and define the variable `-DBN_OPENSSL_DISABLE` to exclude all the OpenSSL dependencies: |
| 94 | + |
| 95 | + ``` bash |
| 96 | + cmake . -B"../build" -DBN_OPENSSL_DISABLE |
| 97 | + ``` |
| 98 | +4. Go to the project folder that was specified with `-B` and run `make` to build the library (`libcrypto_mb` target) and, optionally, tests (`vfy_ifma_rsa_mb` and `vfy_ifma_cp_rsa_mb` targets). |
| 99 | + |
| 100 | +### Building with Intel® IPP Cryptography library |
| 101 | + |
| 102 | +To get access to the optimized kernels through Intel® IPP Cryptography API, build the Intel® IPP Cryptography library as it is described in [Intel IPP Cryptography Build Instructions](../../../BUILD.md). The Crypto IFMA Multi-buffer library will be built automatically if optimization for Intel® Microarchitecture Code Named Ice Lake is available. |
| 103 | + |
| 104 | +### Building with OpenSSL\* |
| 105 | + |
| 106 | +The only difference from universal building is the availability of additional options: `OPENSSL_INCLUDE_DIR`, `OPENSSL_LIBRARIES` and `OPENSSL_ROOT_DIR`. |
| 107 | +Use them to override path to OpenSSL\*: |
| 108 | + |
| 109 | +``` bash |
| 110 | +cmake . -B"../build" |
| 111 | +-DOPENSSL_INCLUDE_DIR=/path/to/openssl/include |
| 112 | +-DOPENSSL_LIBRARIES=/path/to/openssl/lib |
| 113 | +-DOPENSSL_ROOT_DIR=/path/to/openssl |
41 | 114 | ```
|
| 115 | + |
| 116 | +## Usage Examples |
| 117 | + |
| 118 | +You can find the examples of usage of the optimized kernels with Intel IPP Cryptography\* API in the `<ipp-crypto-dir>/examples/rsa_mb` folder. |
0 commit comments