- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
I'm developping a Windows application that relies on AES 128 CBC algorithm and I'm considering both OpenSSL & IPP implementations ! To that purpose I'm testing the following Windows IPP Crypto 7 code provided in http://software.intel.com/sites/default/files/article/181895/intelcrypt710.pdf (page 16) compiled with visual studio 10.0 ....
const int blkSize = 16; // block size
int ctxSize; // context size
ippsRijndael128GetSize(&ctxSize); // evaluating context size
IppsRijndael128Spec* ctx = (IppsRijndael128Spec*)( new Ipp8u [ctxSize] );
Ipp8u key[16] = {0xff,0xee,0xdd,0xcc,0xbb,0xaa,0x99,0x88,0x77,0x66,0x55,0x44,0x33,0x22,0x11,0x00};
ippsRijndael128Init(key,IppsRijndaelKey128,ctx);//128-bit key
Ipp8u plain[] = "Rijndael-128 Cipher Block Chaining mode";
Ipp8u ciph[(sizeof(plain)+blkSize-1) &~(blkSize-1)];
Ipp8u iv[blkSize] = {0x0f,0x0e,0x0d,0x0c,0x0b,0x0a,0x09,0x08,0x07,0x06,0x05,0x04,0x03,0x02,0x01,0x00};
ippsRijndael128EncryptCBC(plain,ciph,sizeof(plain),ctx,iv,IppsCPPaddingNONE);
Ipp8u deciph[sizeof(ciph)];
ippsRijndael128DecryptCBC(ciph,deciph,sizeof(ciph),ctx,iv,IppsCPPaddingNONE);
cout <<"Decrypted text: "<< deciph << endl;
delete (Ipp8u*) ctx;
and I'm confused plaintext & deciph text are not the same ! what's wrong ? where is (are) my mistake(s) ?
Plain text: Rijndael-128 Cipher Block Chaining mode
IN (40) 00000000: 52 69 6a 6e 64 61 65 6c 2d 31 32 38 20 43 69 70 Rijndael-128 Cip
IN (40) 00000010: cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc ................
IN (40) 00000020: cc cc cc cc cc cc cc cc ........
Decrypted text: xµ-gEŧ!4♥M└¥?‗ä╗$ýºéI0Õ ╔q±?H╗$ýºéI0Õ ╔q±?H╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠►hG
OUT (48) 00000000: 78 e6 2d 67 45 8f f5 21 34 03 4d c0 be 3f f2 84 x.-gE..!4.M..?..
OUT (48) 00000010: cc cc cc cc cc cc cc cc 10 68 47 00 00 00 00 00 .........hG.....
OUT (48) 00000020: cc cc cc cc cc cc cc cc fe b5 3c fb f7 be 00 00 ..........<.....
second question : in case we consider CBC & Padding (such PK7 for instance) how to retreive the real deciph buffer size I mean the plain text size ??
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page