Intel® Cryptography Primitives Library is a software library that provides a broad range of secure and efficient cryptographic algorithm implementations.
The library is delivered as a part of Intel® oneAPI Base Toolkit. Alternatively, you may install a specific library version by downloading binaries from Intel.
Prerequisites (Windows* OS)
The Unified Directory Layout was implemented in 2024.0. If you have multiple toolkit versions installed, the Unified layout adds the ability to ensure your development environment contains the component versions that were released as part of that specific toolkit version. The directory layout that was used prior to 2024.0 is still supported on new and existing installations. This prior layout is called the Component Directory Layout. Now you have the option to use the Component Directory Layout or the Unified Directory Layout.
To learn more about the two directory layouts, see Use the setvars Script with Linux* or Windows*.
After installing Intel® Cryptography Primitives Library, set the IPPCRYPTOROOT, LD_LIBRARY_PATH, and NLSPATH environment variables by running the script appropriate to your target platform architecture. The scripts are available in <install dir>\ippcp\bin for Component Directory Layout, or <install dir>\etc\ippcp for Unified Directory Layout.
By default, the <install dir> is located at:
Component Directory Layout
Unified Directory Layout
To configure your Microsoft* Visual Studio* development system for linking with the Intel® Cryptography Primitives Library, follow the steps below. Though some versions of the Visual Studio* IDE may vary slightly in the menu items mentioned below, the fundamental configuring steps are applicable to all these versions.
In Solution Explorer, right-click your project and click Properties.
Select Configuration Properties > VC++ Directories and set the following from the Select directories for drop down menu:
Include Files menu item, and then type in the directory for the Intel® Cryptography Primitives Library include files (default is <install_dir>\ippcp\include)
Library Files menu item, and then type in the directory for the Intel® Cryptography Primitives Library files (default is <install_dir>\ippcp\lib\<arch>)
Executable Files menu item, and then type in the directory for the Intel® Cryptography Primitives Library executable files (default is <install_dir>\redist\<arch>\ippcp)
Build and Run Your First Intel® Cryptography Primitives Library Application (Windows* OS)
The code example below represents a short application to help you get started with Intel® Cryptography Primitives Library:
#include "ippcp.h"
#include <stdio.h>
#define ippCPUID_MMX 0x00000001
#define ippCPUID_SSE 0x00000002
#define ippCPUID_SSE2 0x00000004
#define ippCPUID_SSE3 0x00000008
#define ippCPUID_SSSE3 0x00000010
#define ippCPUID_MOVBE 0x00000020
#define ippCPUID_SSE41 0x00000040
#define ippCPUID_SSE42 0x00000080
#define ippCPUID_AVX 0x00000100
#define ippAVX_ENABLEDBYOS 0x00000200
#define ippCPUID_AES 0x00000400
#define ippCPUID_CLMUL 0x00000800
#define ippCPUID_ABR 0x00001000
#define ippCPUID_RDRAND 0x00002000
#define ippCPUID_F16C 0x00004000
#define ippCPUID_AVX2 0x00008000
#define ippCPUID_ADCOX 0x00010000
#define ippCPUID_RDSEED 0x00020000
#define ippCPUID_PREFETCHW 0x00040000
#define ippCPUID_SHA 0x00080000
#define ippCPUID_AVX512F 0x00100000
#define ippCPUID_AVX512CD 0x00200000
#define ippCPUID_AVX512ER 0x00400000
#define ippCPUID_AVX512PF 0x00800000
#define ippCPUID_AVX512BW 0x01000000
#define ippCPUID_AVX512DQ 0x02000000
#define ippCPUID_AVX512VL 0x04000000
#define ippCPUID_AVX512VBMI 0x08000000
#define ippCPUID_MPX 0x10000000
#define ippCPUID_AVX512_4FMADDPS 0x20000000
#define ippCPUID_AVX512_4VNNIW 0x40000000
#define ippCPUID_KNC 0x80000000
int main(int argc, char* argv[])
{
const IppLibraryVersion *lib;
IppStatus status;
Ipp64u mask, emask;
lib = ippcpGetLibVersion();
printf("%s %s\n", lib->Name, lib->Version);
status = ippcpGetCpuFeatures( &mask );
if( ippStsNoErr == status ) {
emask = ippcpGetEnabledCpuFeatures();
printf("Features supported by CPU\tby Intel® Integrated Performance Primitives Cryptography\n");
printf("-----------------------------------------\n");
printf(" ippCPUID_MMX = ");
printf("%c\t%c\t",( mask & ippCPUID_MMX ) ? 'Y':'N',( emask & ippCPUID_MMX ) ? 'Y':'N');
printf("Intel® Architecture MMX technology supported\n");
printf(" ippCPUID_SSE = ");
printf("%c\t%c\t",( mask & ippCPUID_SSE ) ? 'Y':'N',( emask & ippCPUID_SSE ) ? 'Y':'N');
printf("Intel® Streaming SIMD Extensions\n");
printf(" ippCPUID_SSE2 = ");
printf("%c\t%c\t",( mask & ippCPUID_SSE2 ) ? 'Y':'N',( emask & ippCPUID_SSE2 ) ? 'Y':'N');
printf("Intel® Streaming SIMD Extensions 2\n");
printf(" ippCPUID_SSE3 = ");
printf("%c\t%c\t",( mask & ippCPUID_SSE3 ) ? 'Y':'N',( emask & ippCPUID_SSE3 ) ? 'Y':'N');
printf("Intel® Streaming SIMD Extensions 3\n");
printf(" ippCPUID_SSSE3 = ");
printf("%c\t%c\t",( mask & ippCPUID_SSSE3 ) ? 'Y':'N',( emask & ippCPUID_SSSE3 ) ? 'Y':'N');
printf("Supplemental Streaming SIMD Extensions 3\n");
printf(" ippCPUID_MOVBE = ");
printf("%c\t%c\t",( mask & ippCPUID_MOVBE ) ? 'Y':'N',( emask & ippCPUID_MOVBE ) ? 'Y':'N');
printf("The processor supports MOVBE instruction\n");
printf(" ippCPUID_SSE41 = ");
printf("%c\t%c\t",( mask & ippCPUID_SSE41 ) ? 'Y':'N',( emask & ippCPUID_SSE41 ) ? 'Y':'N');
printf("Intel® Streaming SIMD Extensions 4.1\n");
printf(" ippCPUID_SSE42 = ");
printf("%c\t%c\t",( mask & ippCPUID_SSE42 ) ? 'Y':'N',( emask & ippCPUID_SSE42 ) ? 'Y':'N');
printf("Intel® Streaming SIMD Extensions 4.2\n");
printf(" ippCPUID_AVX = ");
printf("%c\t%c\t",( mask & ippCPUID_AVX ) ? 'Y':'N',( emask & ippCPUID_AVX ) ? 'Y':'N');
printf("Intel® Advanced Vector Extensions (Intel® AVX) instruction set\n");
printf(" ippAVX_ENABLEDBYOS = ");
printf("%c\t%c\t",( mask & ippAVX_ENABLEDBYOS ) ? 'Y':'N',( emask & ippAVX_ENABLEDBYOS ) ? 'Y':'N');
printf("The operating system supports Intel® AVX\n");
printf(" ippCPUID_AES = ");
printf("%c\t%c\t",( mask & ippCPUID_AES ) ? 'Y':'N',( emask & ippCPUID_AES ) ? 'Y':'N');
printf("Intel® AES instruction\n");
printf(" ippCPUID_SHA = ");
printf("%c\t%c\t",( mask & ippCPUID_SHA ) ? 'Y':'N',( emask & ippCPUID_SHA ) ? 'Y':'N');
printf("Intel® Secure Hash Algorithm - New Instructions\n");
printf(" ippCPUID_CLMUL = ");
printf("%c\t%c\t",( mask & ippCPUID_CLMUL ) ? 'Y':'N',( emask & ippCPUID_CLMUL ) ? 'Y':'N');
printf("PCLMULQDQ instruction\n");
printf(" ippCPUID_RDRAND = ");
printf("%c\t%c\t",( mask & ippCPUID_RDRAND ) ? 'Y':'N',( emask & ippCPUID_RDRAND ) ? 'Y':'N');
printf("Read Random Number instructions\n");
printf(" ippCPUID_F16C = ");
printf("%c\t%c\t",( mask & ippCPUID_F16C ) ? 'Y':'N',( emask & ippCPUID_F16C ) ? 'Y':'N');
printf("Float16 instructions\n");
printf(" ippCPUID_AVX2 = ");
printf("%c\t%c\t",( mask & ippCPUID_AVX2 ) ? 'Y':'N',( emask & ippCPUID_AVX2 ) ? 'Y':'N');
printf("Intel® Advanced Vector Extensions 2 instruction set\n");
printf(" ippCPUID_AVX512F = ");
printf("%c\t%c\t",( mask & ippCPUID_AVX512F ) ? 'Y':'N',( emask & ippCPUID_AVX512F ) ? 'Y':'N');
printf("Intel® Advanced Vector Extensions 512 Foundation instruction set\n");
printf(" ippCPUID_AVX512CD = ");
printf("%c\t%c\t",( mask & ippCPUID_AVX512CD ) ? 'Y':'N',( emask & ippCPUID_AVX512CD ) ? 'Y':'N');
printf("Intel® Advanced Vector Extensions 512 Conflict Detection instruction set\n");
printf(" ippCPUID_AVX512ER = ");
printf("%c\t%c\t",( mask & ippCPUID_AVX512ER ) ? 'Y':'N',( emask & ippCPUID_AVX512ER ) ? 'Y':'N');
printf("Intel® Advanced Vector Extensions 512 Exponential & Reciprocal instruction set\n");
printf(" ippCPUID_ADCOX = ");
printf("%c\t%c\t",( mask & ippCPUID_ADCOX ) ? 'Y':'N',( emask & ippCPUID_ADCOX ) ? 'Y':'N');
printf("ADCX and ADOX instructions\n");
printf(" ippCPUID_RDSEED = ");
printf("%c\t%c\t",( mask & ippCPUID_RDSEED ) ? 'Y':'N',( emask & ippCPUID_RDSEED ) ? 'Y':'N');
printf("The RDSEED instruction\n");
printf(" ippCPUID_PREFETCHW = ");
printf("%c\t%c\t",( mask & ippCPUID_PREFETCHW ) ? 'Y':'N',( emask & ippCPUID_PREFETCHW ) ? 'Y':'N');
printf("The PREFETCHW instruction\n");
printf(" ippCPUID_KNC = ");
printf("%c\t%c\t",( mask & ippCPUID_KNC ) ? 'Y':'N',( emask & ippCPUID_KNC ) ? 'Y':'N');
printf("Intel® Xeon Phi™ Coprocessor instruction set\n");
}
return 0;
}
This application consists of two sections:
Get the library layer name and version.
Show the hardware optimizations used by the selected library layer and supported by CPU.
On Windows* OS, Intel® Cryptography Primitives Library applications are significantly easier to build with Microsoft* Visual Studio*. To build the code example above, follow the steps:
Start Microsoft* Visual Studio* and create an empty C++ project.
Add a new c file and paste the code into it.
Set the include directories and the linking model.
Compile and run the application.
Training and Documentation
Notices and Disclaimers
Intel, the Intel logo, Intel Atom, Intel Core, Intel Xeon Phi, VTune and Xeon are trademarks of Intel Corporation in the U.S. and/or other countries.
*Other names and brands may be claimed as the property of others.
© Intel Corporation.
This software and the related documents are Intel copyrighted materials, and your use of them is governed by the express license under which they were provided to you (License). Unless the License provides otherwise, you may not use, modify, copy, publish, distribute, disclose or transmit this software or the related documents without Intel’s prior written permission.
This software and the related documents are provided as is, with no express or implied warranties, other than those that are expressly stated in the License.
Product and Performance Information |
Performance varies by use, configuration and other factors. Learn more in the Performance Index. Notice revision #20201201 |