- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi all,
anybody have a good example for AES_GCM encrypt and decrypt example? Can somebody tell me if there is one available?
Thanks a lot,
Jing
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
hello,
// ippgcm.cpp : Defines the entry point for the console application.
//
#include <stdio.h>
#include "ipp.h"
#include "ippcp.h"
int _tmain(int argc, _TCHAR* argv[])
{
IppsRijndael128GCMState *ctx;
IppStatus rc;
unsigned char thekey[16];
Ipp32u ctxsize;
IppStatus status ; //paf;
memset(thekey, 0, sizeof(thekey));
if( status = ippInit() )
printf( "%d = ippInit status\n", status ) ;
ippsRijndael128GCMGetSize(&ctxsize);
printf("ctxSize = %d\n", ctxsize);
ctx = (IppsRijndael128GCMState*) ippsMalloc_8u( ctxsize ) ;
rc = ippsRijndael128GCMInit(thekey, IppsRijndaelKey128, ctx);
printf("rc = %d\n", rc);
unsigned char data[2048];
unsigned char edata[2048];
unsigned char authdata[16];
unsigned char iv[8];
unsigned char tag[16];
rc = ippsRijndael128GCMEncryptMessage(thekey, IppsRijndaelKey128, iv, sizeof(iv), authdata, sizeof(authdata), data, edata, size, tag, sizeof(tag));
if (rc != 0) {
printf("Encrc = %d\n", rc);
}
int size = 1000;
rc = ippsRijndael128GCMStart(iv, sizeof(iv), authdata, sizeof(authdata), ctx);
if (rc != 0) {
printf("Encrc = %d\n", rc);
}
rc = ippsRijndael128GCMEncrypt(data, edata, size, ctx);
if (rc != 0) {
printf("Encrc = %d\n", rc);
}
rc = ippsRijndael128GCMGetTag(tag, sizeof(tag), ctx);
if (rc != 0) {
printf("Encrc = %d\n", rc);
}
ippsFree( ctx ) ;
return 0;
}
regards, Igor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thank you very much, lgor.
I check the document, said IppsRijndael128GCM* related functions are DEPRECATED.
Do you have example which is using ippsAES_GCM* functions?
I am using Cryptography for Intel® Integrated Performance Primitives 8.0 Library.
Thanks,
Jing
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Jing,
changing from Rijndael signature to AES is cosmetic one - I guess you can do this simple task yourself easily.
regards, Igor

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page