Intel® Integrated Performance Primitives
Community support and discussions relating to developing high-performance vision, signal, security, and storage applications.
Announcements
Welcome to the Intel Community. If you get an answer you like, please mark it as an Accepted Solution to help others. Thank you!
6594 Discussions

Problems running AES Rijndael-128 example code

charopy
Beginner
98 Views
Hi folks,

I got troubles running the AES example with Rijndael Functions.

When the example calls the decryption function... in this case 'ippsRijndael128DecryptCTR(ctext, rtext, sizeof(ptext), pCtx, crt, ctrNumBitSize);' it returns fewer bytes as spected compared with the original plain text buffer.

I made a function to dump the content of all buffers involved in the crypt/decrypt example, and I got this output:

// \\\\ Plain text before crypt ... // \\\\
========================================== DUMP len (0035) =======================================
HEXA Output:
71 75 69 63 6b 20 62 72 6f 77 6e 20 66 6f 78 20 6a 75 70 6d 20 6f 76 65 72 20 6c 61 7a 79 20 64 6f 67 00
ASCII Output:
quick brown fox jupm over lazy dog.
==================================================================================================
// \\\\ Cipher text after encrypt ... // \\\\
========================================== DUMP len (0035) =======================================
HEXA Output:
40 5d 2a 06 ab d4 40 00 71 f8 a3 e6 47 28 2b e2 c1 8f 4d 89 44 48 c1 4b 92 42 70 5d c6 3f 97 6e 05 00 00
ASCII Output:
@]*...@.q...G(+...M.DH.K.Bp].?.n...
==================================================================================================
// \\\\ Plain text before crypt ... // \\\\
========================================== DUMP len (0035) =======================================
HEXA Output:
71 75 69 63 6b 20 62 72 6f 77 6e 20 66 6f 78 20 6a 75 70 6d 20 6f 76 65 72 20 6c 61 7a 79 20 64 02 00 00
ASCII Output:
quick brown fox jupm over lazy d...
==================================================================================================

Last word sould be dog, and instead I got something else ...

Thanks in advance,

Chuck

P.D.: The example has been gotten from the ippcp reference manual
0 Kudos
2 Replies
PaulF_IntelCorp
Employee
98 Views
Hello Chuck,

Not sure if it will impact the results, but the sample you show above and the sample I found in the documentation are different on one line. Here's the sample in the current version of the on-line documentation:

http://software.intel.com/sites/products/documentation/hpc/ipp/ippcp/index.htm

This is the line in your code:

ippsRijndael128Init(key,IppsRijndaelKey256, pCtx);

and this is the line in the sample referenced above:

ippsRijndael128Init(key,IppsRijndaelKey128, pCtx);

which looks like a mistake in the key length input parameter.

Paul
charopy
Beginner
98 Views
You are right Paul. I've allready fixed it and got the same thing.

// \\ Plain text before crypt ... // \\
========================================== DUMP len (0035) =======================================
HEXA Output:
71 75 69 63 6b 20 62 72 6f 77 6e 20 66 6f 78 20 6a 75 70 6d 20 6f 76 65 72 20 6c 61 7a 79 20 64 6f 67 00
ASCII Output:
quick brown fox jupm over lazy dog.
==================================================================================================
// \\ Cipher text after encrypt ... // \\
========================================== DUMP len (0035) =======================================
HEXA Output:
f9 54 2a 89 0d 5f 6b 5c f4 ff 39 46 58 7e 84 ed e7 fe 38 c2 de 83 4d d8 6d 14 05 18 35 75 f7 de 05 00 00
ASCII Output:
.T*.._k\..9FX~....8...M.m...5u.....
==================================================================================================
// \\ Plain text before crypt ... // \\
========================================== DUMP len (0035) =======================================
HEXA Output:
71 75 69 63 6b 20 62 72 6f 77 6e 20 66 6f 78 20 6a 75 70 6d 20 6f 76 65 72 20 6c 61 7a 79 20 64 02 00 00
ASCII Output:
quick brown fox jupm over lazy d...
==================================================================================================

I attached the changed source code.

Regards,

Chuck
Reply