Community
cancel
Showing results for 
Search instead for 
Did you mean: 
ebubekir_t_
Beginner
56 Views

Cryptography unresolved external symbol

I installed Trial Composer 15 Desktop and IPP and Cryptography lib 8.2. I have found below code. I run the code, there is no compilation error but there are  four link error like unresolved external symbol.  I searched some issues. Issues say that you must add lib called ippid.lib, libemerged ext. but there is no these libraries. How can I solve this problem.

1>IntelRijndael.obj : error LNK2019: unresolved external symbol _ippsRijndael128GetSize@4 referenced in function _main
1>IntelRijndael.obj : error LNK2019: unresolved external symbol _ippsRijndael128Init@12 referenced in function _main
1>IntelRijndael.obj : error LNK2019: unresolved external symbol _ippsRijndael128EncryptCTR@24 referenced in function _main
1>IntelRijndael.obj : error LNK2019: unresolved external symbol _ippsRijndael128DecryptCTR@24 referenced in function _main
1>D:\RijndaelRefactoring\IntelDeneme\Debug\IntelRijndael.exe : fatal error LNK1120: 4 unresolved externals

 

 

Code:

// size of Rijndael-128 algorithm block is equal to 16
   const int aesBlkSize = 16;
 
   // get the size of the context needed for the encryption/decryption operation
   int ctxSize;
   ippsRijndael128GetSize(&ctxSize);
 
   // and allocate one
   IppsRijndael128Spec* pCtx = (IppsRijndael128Spec*)( new Ipp8u [ctxSize] );
   // define the key
   Ipp8u key[16] = {0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,
                    0x08,0x09,0x10,0x11,0x12,0x13,0x14,0x15};
 
   // and prepare the context for Rijndael128 usage
   ippsRijndael128Init(key,IppsRijndaelKey128, pCtx);
 
   // define the message to be encrypted
   Ipp8u ptext[] = {"quick brown fox jupm over lazy dog"};
 
  // define an initial vector
   Ipp8u crt0[aesBlkSize] = {0xff,0xee,0xdd,0xcc,0xbb,0xaa,0x99,0x88,                         
   0x77,0x66,0x55,0x44,0x33,0x22,0x11,0x00};
   Ipp8u  crt[aesBlkSize];
 
   // counter the variable number of bits
   int ctrNumBitSize = 64;
 
 
    // allocate enough memory for the ciphertext
   // note that
   // the size of the ciphertext is always equal to that of the planetext
   Ipp8u ctext[sizeof(ptext)];
 
   // init the counter
   memcpy(crt, crt0, sizeof(crt0));
   // encrypt (CTR mode) ptext message
   // pay attention to the 'length' parameter
   // it defines the number of bytes to be encrypted
   memcpy(crt, crt0, sizeof(crt0));
   ippsRijndael128EncryptCTR(ptext, ctext, sizeof(ptext),
                             pCtx,
                             crt, ctrNumBitSize);
 
   // allocate memory for the decrypted message
   Ipp8u rtext[sizeof(ptext)];
 
   // init the counter
   memcpy(crt, crt0, sizeof(crt0));
 
 
   // decrypt (ECTR mode) ctext message
   // pay attention to the 'length' parameter
   // it defines the number of bytes to be decrypted
   ippsRijndael128DecryptCTR(ctext, rtext, sizeof(ptext),
                             pCtx,
                             crt, ctrNumBitSize);
   delete (Ipp8u*)pCtx;

0 Kudos
10 Replies
Igor_A_Intel
Employee
56 Views

Hi,

For this code example you need ippCP library that is not a part of trial version of Composer and should be installed separately. ippdi (data integrity) library doesn't have any relation to the code above.

regards, Igor

ebubekir_t_
Beginner
56 Views

Thank you igor for your reply. I understand  ippid.lib. When I installed parallel_studio_xe_2015_setup.exe, ipp installed and then I installed cryptography lib separately. I can see ipp folder in my installation folder in C drive. I can see ippcp.lib also. But I have taken  unresolved externals symbol error like above. How can I solve this problem. I use vs studio 2012 and windows 7.  

Igor_A_Intel
Employee
56 Views

please show your Linker Command Line from your project Configuration Properties -> Linker - it should contain ippcpmt.lib

regards, Igor

ebubekir_t_
Beginner
56 Views

I made below settings in vs 2012 but there are still link errors 

Configuration Properties -> C/C++ ->Additional Include Directories : intel\Composer XE 2015\ipp\include;

Configuration Properties -> Linker ->Additional Library Directories : intel\Composer XE 2015\ipp\lib\intel64;

Configuration Properties -> Linker ->Input  ippcore.lib;ippcp.lib;ippcpmt.lib 

 

Igor_A_Intel
Employee
56 Views

what kind of linking you need - static or dynamic? ippcpmt.lib is static merged library while ippcp.lib is a stub lib for dynamic linking. So I see you have both in the command line, while you use stub lib for ippcore library... I think there should be either ippcore.lib, ippcp.lib (for dynamic linking - you'll need then ippcore.dll and ippcp.dll for application run), or ippcoremt.lib, ippcpmt.lib for static linking, but not some mix of them.

regards, Igor

Pavel_B_Intel1
Employee
56 Views

Hi,

if you would like to link with static, you should link with: ippcpmt.lib ippcoremt.lib

if you would like to link with dynamic, you should link with: ippcp.lib ippcore.lib

You should not mix static and dynamic libraries in link command!

Pavel

ebubekir_t_
Beginner
56 Views

I use dynamic link.  I deleted ippcpmt.lib and there are only  ippcp.lib ippcore.lib in linker input. My configuration is in below

What else should I do?

 

Configuration Properties -> C/C++ ->Additional Include Directories : intel\Composer XE 2015\ipp\include;

Configuration Properties -> Linker ->Additional Library Directories : intel\Composer XE 2015\ipp\lib\intel64;

Configuration Properties -> Linker ->Input  ippcore.lib;ippcp.lib;

Pavel_B_Intel1
Employee
56 Views

I guess you missed #include "ippcp.h"

I can compile your example without problems to add necessary includes:

#include <memory.h>
#include <stdlib.h>
#include "ipp.h"
#include "ippcp.h"

int main()
{
   // size of Rijndael-128 algorithm block is equal to 16
   const int aesBlkSize = 16;

   // get the size of the context needed for the encryption/decryption operation
   int ctxSize;

   ippsRijndael128GetSize(&ctxSize);

   // and allocate one
   IppsRijndael128Spec* pCtx = (IppsRijndael128Spec*)( new Ipp8u [ctxSize] );

   // define the key
   Ipp8u key[16] = {0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,
                    0x08,0x09,0x10,0x11,0x12,0x13,0x14,0x15};

   // and prepare the context for Rijndael128 usage
   ippsRijndael128Init(key,IppsRijndaelKey128, pCtx);

   // define the message to be encrypted
   Ipp8u ptext[] = {"quick brown fox jupm over lazy dog"};

  // define an initial vector
   Ipp8u crt0[aesBlkSize] = {0xff,0xee,0xdd,0xcc,0xbb,0xaa,0x99,0x88,                         
                             0x77,0x66,0x55,0x44,0x33,0x22,0x11,0x00};

   Ipp8u  crt[aesBlkSize];

   // counter the variable number of bits
   int ctrNumBitSize = 64;

   // allocate enough memory for the ciphertext
   // note that
   // the size of the ciphertext is always equal to that of the planetext
   Ipp8u ctext[sizeof(ptext)];

   // init the counter
   memcpy(crt, crt0, sizeof(crt0));

   // encrypt (CTR mode) ptext message
   // pay attention to the 'length' parameter
   // it defines the number of bytes to be encrypted
   memcpy(crt, crt0, sizeof(crt0));

   ippsRijndael128EncryptCTR(ptext, ctext, sizeof(ptext),
                             pCtx,
                             crt, ctrNumBitSize);

   // allocate memory for the decrypted message
   Ipp8u rtext[sizeof(ptext)];

   // init the counter
   memcpy(crt, crt0, sizeof(crt0));

   // decrypt (ECTR mode) ctext message
   // pay attention to the 'length' parameter
   // it defines the number of bytes to be decrypted
   ippsRijndael128DecryptCTR(ctext, rtext, sizeof(ptext),
                             pCtx,
                             crt, ctrNumBitSize);

   delete (Ipp8u*)pCtx;

   return 0;
}

 

ebubekir_t_
Beginner
56 Views

Whatever I did,  I can not run this code. I always take a link error. should I add  to env. variables anyting.

Pavel_B_Intel1
Employee
56 Views

Did you try to build exactly my example?

Reply