Support Functions
There are several general purpose functions that simplify using the library and report information on how it is working:
GetCpuFeatures/ SetCpuFeatures/GetEnabledCpuFeaturesGetStatusStringGetLibVersion
GetCpuFeatures/ SetCpuFeatures/GetEnabledCpuFeatures
In some cases like debugging and performance analysis, you may want to
get the data on the difference between various processor-specific codes
on the same machine. Use the ippcpSetCpuFeatures function for this. This
function sets the dispatcher to use the processor-specific code
according to the specified set of CPU features. You can obtain features
supported by CPU using ippcpGetCpuFeatures and obtain features supported
by the currently dispatched Intel® Cryptography Primitives Library code using
ippcpGetEnabledCpuFeatures. If you need to enable support of some CPU
features without querying the system (without using the CPUID
instruction call), you must set the ippCPUID_NOCHECK bit for
ippcpSetCpuFeatures, otherwise, only the features supported by the
current CPU are set.
The ippcpGetCpuFeatures, ippcpGetEnabledCpuFeatures, and
ippcpSetCpuFeatures functions are a part of the ippCP library.
GetStatusString
The ippcpGetStatusString function decodes the numeric status return
value of Intel® Cryptography Primitives Library functions and converts them to a
human-readable text:
Ipp64u mask;
status = ippcpGetCpuFeatures(&mask);
if( status != ippStsNoErr ) {
printf("ippcpGetCpuFeatures() Error:\n");
printf("%s\n", ippcpGetStatusString(status) );
return -1;
}
The ippcpGetStatusString function is a part of the ippCP library.
GetLibVersion
The GetLibVersion function returns information about the library layer
in use from the dispatcher. The code snippet below demonstrates the
usage of the cryptoGetLibVersion:
const CryptoLibraryVersion* lib = cryptoGetLibVersion();
printf("%s %d.%d.%d\n", lib->name, lib->major, lib->minor, lib->patch);
// or you can print the library version string
printf("%s\n", lib->strVersion);