Community
cancel
Showing results for 
Search instead for 
Did you mean: 
James_Wei
Beginner
146 Views

IPP Crypto link error - undefined reference to `ippsRijndael128GetSize'

I tried a sample (below) from the forum with IPP crypto library and encoutnered some link errors. Can you please help?

jawei-lnx-v1:537> echo $LIB

/ws/jawei-sjc/intel/ipp/ia32/lib

jawei-lnx-v1:538> echo $INCLUDE

/ws/jawei-sjc/intel/ipp/ia32/include:/ws/jawei-sjc/intel/mkl/include

jawei-lnx-v1:539> which icpc

/ws/jawei-sjc/intel/bin/ia32/icpc

jawei-lnx-v1:540> icpc -c sample.c

jawei-lnx-v1:541>

jawei-lnx-v1:541> ls sample.o libippcpmerged.a libippcore.a

libippcore.a libippcpmerged.a sample.o

jawei-lnx-v1:542> icpc -o sample sample.o libippcpmerged.a libippcore.a

sample.o: In function `main':

sample.c:(.text+0xb5): undefined reference to `ippsRijndael128GetSize'

sample.c:(.text+0xd0): undefined reference to `ippsRijndael128Init'

sample.c:(.text+0xec): undefined reference to `ippsRijndael128EncryptOFB'

sample.c:(.text+0x102): undefined reference to `ippsRijndael128DecryptOFB'

IPP / Crypto used:

l_cproc_p_11.1.073_ia32.tgz

l_cproc_crypto_ipp_p_11.1.073_ia32.tgz

Thanks,

-James

==============================================

#include

#include

#include

#include "ippcp.h"

using namespace std;

int main()

{

Ipp8u i_key[32] = {0x60, 0x3d, 0xeb, 0x10, 0x15, 0xca, 0x71, 0xbe, 0x2b, 0x73,

0xae, 0xf0, 0x85, 0x7d, 0x77, 0x81, 0x1f, 0x35, 0x2c, 0x07,

0x3b, 0x61, 0x08, 0xd7, 0x2d, 0x98, 0x10, 0xa3, 0x09, 0x14,

0xdf, 0xf4};

Ipp8u i_iv0[16] = {0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09,

0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f};

Ipp8u i_iv[16];

memcpy(i_iv,i_iv0,sizeof(i_iv0));

Ipp8u i_data[16] = {0x6b, 0xc1, 0xbe, 0xe2, 0x2e, 0x40, 0x9f, 0x96, 0xe9, 0x3d,

0x7e, 0x11, 0x73, 0x93, 0x17, 0x2a};

Ipp8u i_enc_data[16];

Ipp8u i_dec_data[16];

int context_size;

ippsRijndael128GetSize(&context_size);

IppsRijndael128Spec* aes_spec = (IppsRijndael128Spec*)(new Ipp8u[context_size]);

ippsRijndael128Init(i_key, IppsRijndaelKey256, aes_spec);

ippsRijndael128EncryptOFB(i_data, i_enc_data, 16, 16, aes_spec, i_iv0);

ippsRijndael128DecryptOFB(i_enc_data, i_dec_data, 16, 16, aes_spec, i_iv);

cout << "Encrypted: ";

for (int i = 0; i < 16; ++i)

printf("%x ", i_enc_data);

cout << endl << "Decrypted: ";

for (int i = 0; i < 16; ++i)

printf("%x ", i_dec_data);

cout << endl;

return 0;

}

0 Kudos
5 Replies
Ying_H_Intel
Employee
146 Views

Hello James,

You may try
>icpc -o sample sample.o libippcpemerged.alibippcpmerged.a libippcore.a
and see if it works.

Some KB for your reference:
Find the Intel IPP Libraries Needed by Your Application
How to build IPP application in Linux environment

Regards,
Ying
James_Wei
Beginner
146 Views

Hi Ying,

Yourinfo worked and thank you for the KB links. I really appreicate your prompthelp!

Cheers,

-James
James_Wei
Beginner
146 Views

Hi Ying,

What Itry to do is to statically build "timing_aes" from l_ipp-samples-cryptography_p_6.1.6.073.tgz that is supposed to enable AES-NI with patched OpenSSL. I was able tobuildlibscrypto.a and libssl.a withbuild_ssl_ipp.sh. I checked again and again but still received the following similar link errors?

jawei-lnx-v1:556> icpc -o timing_aes timing_aes.o libippcpemerged.a libippcpmerged.a libippcore.a libcrypto.a libssl.a

libcrypto.a(aes_cfb.o): In function `AES_cfb8_encrypt':

aes_cfb.c:(.text+0xa9): undefined reference to `ippsRijndael128DecryptCFB'

aes_cfb.c:(.text+0x162): undefined reference to `ippsRijndael128EncryptCFB'

libcrypto.a(aes_cfb.o): In function `AES_cfb128_encrypt':

aes_cfb.c:(.text+0x255): undefined reference to `ippsRijndael128DecryptCFB'

aes_cfb.c:(.text+0x2d2): undefined reference to `ippsRijndael128EncryptCFB'

libcrypto.a(aes_ofb.o): In function `AES_InitIppContext':

aes_ofb.c:(.text+0x190): undefined reference to `ippGetCpuFeatures'

libcrypto.a(aes_ofb.o): In function `AES_ofb128_encrypt':

aes_ofb.c:(.text+0x21c): undefined reference to `ippGetCpuFeatures'

aes_ofb.c:(.text+0x303): undefined reference to `ippsRijndael128EncryptOFB'

libcrypto.a(aes_cbc.o): In function `AES_cbc_encrypt':

aes_cbc.c:(.text+0xd8): undefined reference to `ippsRijndael128DecryptCBC'

aes_cbc.c:(.text+0x170): undefined reference to `ippsRijndael128EncryptCBC'

Thanks,

-James
Chao_Y_Intel
Employee
146 Views



James,

"libippcpemerged.a libippcpmerged.a libippcore.a" needs to be after "libcrypto.a libssl.a", could you try if the following linking line works:

>>icpc -o timing_aes timing_aes.o libcrypto.a libssl.a libippcpemerged.a libippcpmerged.a libippcore.a
Ying_H_Intel
Employee
146 Views

Hello James,

does "icpc -o timing_aes timing_aes.o libcrypto.a libssl.a libippcpemerged.a libippcpmerged.a libippcore.a" work?

The library order is essential under linux asGNU linkerjustreview the library once time in order. So the symboldefinedlibrary need belocatedafter the symbol-used library.

One more reference, the sample of crypto should provided a buildscriptfile and Makefile. You may try them first following by the readme.htm, thenlook atthe build command in the log file.
For example, as the step in the KB article Boosting OpenSSL AES Encryption with Intel IPP

Step 4: Build the performance test program
$. ./build_perftest.sh linuxem64t
The resulting executables timing_aes , timing_rsa and timing_sha will be created in ./bin.

the build log is in ssl_ipp_test.log.

Regards
Ying
Reply