On Fri, May 18, 2012, Li, David wrote: > Hi Experts, > > First time I am using AES-GCM mode to run the NIST test vectors. The API is: > > void AES_gcm128_encrypt(GCM128_CONTEXT *ctx, > const unsigned char *in, unsigned char *out, > size_t len) > > > After initialization and encryption, my cipher text matched the one from NIST > vector but tag value didn't. I obtained the tag value by: > > Unsigned char tag[16]; > memcpy(tag, ctx.Xi.c, 16); > > Anyone can think of a reason what might have gone wrong? >
Don't use the low level APIs: use EVP instead. There is program fips/aes/fips_gcmtest.c which has already been put through the FIPS 140-2 validation tests on a number of platforms. That uses the special FIPS api but it isn't hard to see the equivalent functions for "normal" EVP. Steve. -- Dr Stephen N. Henson. OpenSSL project core developer. Commercial tech support now available see: http://www.openssl.org ______________________________________________________________________ OpenSSL Project http://www.openssl.org User Support Mailing List openssl-users@openssl.org Automated List Manager majord...@openssl.org