Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Chen_Chen
Beginner
85 Views

how to install cryptography library?how to call it?

I have no ideal how to install cryptography library of Intel@IPP 6.1.
Does it need to install the Intel@IPP first?
Moreover,when we compile a C program, how to call the function in cryptography library?
By the way: the OS is linux.

0 Kudos
2 Replies
Ying_H_Intel
Employee
85 Views

Hi ChenChen,

Yes, it need to install IPP first.Here is steps to install the latestIPP 6.1 udpate 4 versionfor your reference


$tar xzvf l_ipp_em64t_p_6.1.4.059.tar.gz
$./l_ipp_em64t_p_6.1.4.059/install.sh

(may require root passwd if install library to default directory /opt/intel/ipp)

$ tar xzvf l_crypto_ipp_em64t_p_6.1.4.059.tar.gz

$./l_crypto_ipp_em64t_p_6.1.4.059/install.sh

For how to download the two packages (the version number must be exactly same, i.e _6.1.4.059) , please see IPP Downloads, Registration and Licensing

Once you install them sucessfully, you will see some c example code in ippcp manualippcpman.pdf under /doc/.
For example Example 2-1 DES/TDES Encryption and Decryption
// use of the ECB mode
void DES_sample(void)
{
// size of the DES algorithm block is equal to 8
const int desBlkSize = 8;
// get size of the context needed for the encryption/decryption operation
int ctxSize;
ippsDESGetSize(&ctxSize);
// and allocate one
IppsDESSpec* pCtx = (IppsDESSpec*)( new Ipp8u [ctxSize] );
// define the key
Ipp8u key[] = {0x01,0x2,0x3,0x4,0x5,0x6,0x7,0x8};
// and prepare the context for the DES usage
ippsDESInit(key, pCtx);
// define the message to be encrypted
Ipp8u ptext[] = {"quick brown fox jupm over lazy dog"};
// allocate enough memory for the ciphertext,
// note thatthe size of ciphertext is always multiple of cipher block size
Ipp8u ctext[(sizeof(ptext)+desBlkSize-1) &~(desBlkSize-1)];
// encrypt (ECB mode) ptext message pay attention to the 'length' parameter
// it defines the number of bytes to be encrypted
ippsDESEncryptECB(ptext, ctext, sizeof(ctext),
pCtx,
IppsCPPaddingNONE);
// allocate memory for the decrypted message
Ipp8u rtext[sizeof(ctext)];
// decrypt (ECB mode) ctext message
// pay attention to the 'length' parameter
// it defines the number of bytes to be decrypted
ippsDESDecryptECB(ctext, rtext, sizeof(ctext),
pCtx,
IppsCPPaddingNONE);
delete (Ipp8u*)pCtx;
}

Then build it, for example,
>gcc main.cpp -L/opt/intel/ipp/6.1.4.xxx/em64t/sharedlib -lippcp -lippcore -liomp5 -lpthread.
See more from How to build IPP application in Linux environment
orHow to Build an Intel IPP Application

Hope it helps
Best Regards,
Ying

Chen_Chen
Beginner
85 Views

Thank you, Ying~

Your answer helps me a lot~
Best regards~
Reply