Skip to content

Commit 21a2023

Browse files
Documentation of Crypto Multi-buffer Library was updated. Position Independent Execution (PIE) option was added to Crypto Multi-buffer Library build scripts.
1 parent 5629767 commit 21a2023

File tree

9 files changed

+141
-40
lines changed

9 files changed

+141
-40
lines changed

BUILD.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# How to Build Intel® IPP Cryptography <!-- omit in toc -->
1+
# How to Build Intel® Integrated Performance Primitives Cryptography (Intel® IPP Cryptography) <!-- omit in toc -->
22

33
- [Software Requirements](#software-requirements)
44
- [Common](#common)
@@ -17,7 +17,7 @@
1717
- [How to build a 64-bit generic library without any CPU-specific optimizations?](#how-to-build-a-64-bit-generic-library-without-any-cpu-specific-optimizations)
1818
- [How to build two libraries with optimizations for Intel® Advanced Vector Extensions 2 and Intel® Advanced Vector Extensions 512 instruction sets?](#how-to-build-two-libraries-with-optimizations-for-intel%c2%ae-advanced-vector-extensions-2-and-intel%c2%ae-advanced-vector-extensions-512-instruction-sets)
1919
- [How to build a library to work in a kernel space?](#how-to-build-a-library-to-work-in-a-kernel-space)
20-
- [Incorporating Intel® IPP Cryptography sources into custom build system](#incorporating-intel%c2%ae-ipp-cryptography-sources-into-custom-build-system)
20+
- [Incorporating Intel IPP Cryptography sources into custom build system](#incorporating-intel%c2%ae-ipp-cryptography-sources-into-custom-build-system)
2121

2222
## Software Requirements
2323
### Common
@@ -54,7 +54,7 @@ To build the Intel IPP Cryptography library on Linux\* OS, complete the followin
5454

5555
2. Set the environment for one of the supported C/C++ compilers.
5656

57-
*Example for Intel(R) Compiler:*
57+
*Example for Intel® Compiler:*
5858

5959
```bash
6060
source /opt/intel/bin/compilervars.sh intel64
@@ -267,17 +267,17 @@ add_executable("test_proj" main.cpp)
267267
target_link_libraries("test_proj" "ippcp_s")
268268
```
269269
270-
Also you can use CMake module to find the IPP Crypto library installed on the system. The module location is `examples/FindIPPCrypto.cmake` and here is the example of its usage:
270+
Also you can use CMake module to find the Intel IPP Cryptography library installed on the system. The module location is `examples/FindIPPCrypto.cmake` and here is the example of its usage:
271271
272272
``` bash
273273
find_package(IPPCrypto REQUIRED MODULE)
274274

275275
if (NOT IPPCRYPTO_FOUND)
276-
message(FATAL_ERROR "No Intel(R) IPP Cryptography library found on the system.")
276+
message(FATAL_ERROR "No Intel IPP Cryptography library found on the system.")
277277
endif()
278278

279279
# If Intel IPP Cryptography is found, the following variables will be defined:
280280
# `IPPCRYPTO_LIBRARIES` - static library name
281-
# `IPPCRYPTO_INCLUDE_DIRS` - path to IPP Crypto headers
281+
# `IPPCRYPTO_INCLUDE_DIRS` - path to Intel IPP Cryptography headers
282282
# `IPPCRYPTO_ROOT_DIR` - library root dir (a folder with 'include' and 'lib' directories)
283-
```
283+
```

CHANGELOG.md

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
1-
# Intel(R) Integrated Performance Primitives Cryptography (Intel(R) IPP Cryptography)
1+
# Intel® Integrated Performance Primitives Cryptography (Intel® IPP Cryptography)
22

33
This is a list of notable changes to Intel(R) IPP Cryptography, in reverse chronological order.
44

5+
## 2020-04-21
6+
- Documentation of Crypto Multi-buffer Library was updated.
7+
- Position Independent Execution (PIE) option was added to Crypto Multi-buffer Library build scripts.
8+
59
## 2020-04-19
610
- AES-XTS optimization for Ice Lake with vector extensions of Intel(R) AES New Instructions (Intel(R) AES-NI) was improved.
711
- Fixed a build issue that affect build of the Intel(R) IPP Crypto library with MSVC\* compiler on Windows\* OS.
8-
- Duplicated APIs of HASH, HMAC, MGF, RSA, ECCP functionality were marked as deprecated.For more information see [Deprecation notes](./DEPRECATION_NOTES.md)
12+
- Duplicated APIs of HASH, HMAC, MGF, RSA, ECCP functionality were marked as deprecated. For more information see [Deprecation notes](./DEPRECATION_NOTES.md)
913
- Added examples demonstrating usage of SMS4-CBC encryption and decryption.
1014

1115
## 2020-02-25
@@ -29,11 +33,11 @@ This is a list of notable changes to Intel(R) IPP Cryptography, in reverse chron
2933
## 2019-08-27
3034
- Added Intel(R) IPP Cryptography library examples: AES-CTR, RSA-OAEP, RSA-PSS.
3135
- Fixed code generation for kernel code model in Linux* Intel(R) 64 non-PIC builds.
32-
- Fixes in Intel(R) IPP Custom Library Tool.
36+
- Fixes in Intel IPP Custom Library Tool.
3337

3438
## 2019-07-23
3539
- Added Microsoft\* Visual Studio\* 2019 build support.
36-
- Added Intel(R) IPP Custom Library Tool.
40+
- Added Intel IPP Custom Library Tool.
3741

3842
## 2019-06-24
3943
- AES-GCM was enabled with vector extensions of Intel(R) AES New Instructions (Intel(R) AES-NI).

OVERVIEW.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ The corresponding build target names for the libraries are shown at the picture
142142

143143
Be default, the Intel IPP Cryptography library is built with the [Position Independent Code (PIC)](https://en.wikipedia.org/wiki/Position-independent_code) option.
144144

145-
But on Linux* OS, when the library is supposed to work in kernel space, it is possible to compile the static library in a non-PIC mode. For more information about build options, refer to the [Linux* OS build options](./INSTALL.txt).
145+
But on Linux* OS, when the library is supposed to work in kernel space, it is possible to compile the static library in a non-PIC mode. For more information about build options, refer to the [Linux* OS build options](./BUILD.md).
146146

147147
### Target Instruction Set Architecture (ISA)
148148

sources/ippcp/crypto_mb/Readme.md

Lines changed: 104 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,118 @@
1-
# RSA IFMA Muti-buffer Library
1+
# Crypto Multi-buffer Library
22

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.
44

5-
## System Requirements
5+
## Multiple Buffers Processing Overview
66

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\*
1223
- OpenSSL\* 1.1.0
1324

14-
## Building from Source
25+
### Linux* OS
1526

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
1731

18-
2. Run CMake on the command line. Example CMake lines and avaliable options:
32+
### Windows* OS
1933

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
2436

25-
Use `PYTHON_EXECUTABLE` variable to override path to Python:
26-
```
27-
cmake . -B../build -DPYTHON_EXECUTABLE=/path/to/python27
28-
```
37+
### macOS*
2938

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.
3446
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+
```
3655

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
3877
```
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
41114
```
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.

sources/ippcp/crypto_mb/src/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ set_source_files_properties(${RSA_AVX512_SOURCES} ${COMMON_SOURCES} ${ECDSA_SOUR
5252
# Library
5353
add_library(${IFMA_LIB_TARGET} STATIC ${RSA_AVX512_SOURCES} ${COMMON_SOURCES} ${ED25519_SOURCES})
5454
if(NOT BN_OPENSSL_DISABLE)
55-
target_link_libraries(${IFMA_LIB_TARGET} OpenSSL::Crypto) # to get includes
55+
target_link_libraries(${IFMA_LIB_TARGET} OpenSSL::Crypto)
5656
else()
5757
set_target_properties(${IFMA_LIB_TARGET} PROPERTIES COMPILE_DEFINITIONS "BN_OPENSSL_DISABLE")
5858
endif()

sources/ippcp/crypto_mb/src/cmake/linux/Clang.cmake

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,11 @@ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -falign-functions=32")
2626
# Optimization level = 3
2727
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O3")
2828

29+
if(NOT BN_OPENSSL_DISABLE)
30+
# Position Independent Execution (PIE)
31+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fpic -fPIC")
32+
endif()
33+
2934
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${CMAKE_CXX_FLAGS}")
3035

3136
# Suppress warnings from casts from a pointer to an integer type of a different size

sources/ippcp/crypto_mb/src/cmake/linux/GNU.cmake

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,11 @@ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -falign-functions=32 -falign-loops=32")
2525
# Optimization level = 3
2626
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O3")
2727

28+
if(NOT BN_OPENSSL_DISABLE)
29+
# Position Independent Execution (PIE)
30+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fpic -fPIC")
31+
endif()
32+
2833
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${CMAKE_CXX_FLAGS}")
2934

3035
# Suppress warnings from casts from a pointer to an integer type of a different size

sources/ippcp/crypto_mb/src/cmake/linux/Intel.cmake

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,11 @@ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -falign-functions=32 -falign-loops=32")
2525
# Optimization level = 3
2626
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O3")
2727

28+
if(NOT BN_OPENSSL_DISABLE)
29+
# Position Independent Execution (PIE)
30+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fpic -fPIC")
31+
endif()
32+
2833
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${CMAKE_CXX_FLAGS}")
2934

3035
# Suppress warnings from casts from a pointer to an integer type of a different size

sources/ippcp/crypto_mb/src/cmake/macosx/Intel.cmake

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,11 @@ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -falign-functions=32 -falign-loops=32")
2525
# Optimization level = 3
2626
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O3")
2727

28+
if(NOT BN_OPENSSL_DISABLE)
29+
# Position Independent Execution (PIE)
30+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fpic -fPIC")
31+
endif()
32+
2833
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${CMAKE_CXX_FLAGS}")
2934

3035
# Suppress warnings from casts from a pointer to an integer type of a different size

0 commit comments

Comments
 (0)