GCM mode and GCRY_CIPHER_AES256

David Dahl ddahl at nulltxt.se
Fri May 30 01:23:09 CEST 2014


Hello,

Please excuse my dumb question that comes with a bit of ignorance.

I want to wrap a key generated with gcry_kdf_derive using AES256 + GCM mode:

err = gcry_cipher_open(&handle, GCRY_CIPHER, GCRY_CIPHER_MODE, 0);

returns with: "GCM algo 9, gcry_cipher_open failed: Invalid cipher mode"

(I am trying to match an existing library that generates a key ring with
SJCL, which uses GCM mode when wrapping the keys).

After seeing this error, I re-read the docs and see that is says:
"GCRY_CIPHER_MODE_CCM and GCRY_CIPHER_MODE_GCM
modes will only work with block cipher algorithms which have the block
size of 16 bytes"

Doesn't AES 256 use a block size of 16 bytes?

Please help me understand what I am doing wrong. I should mention that
SJCL and gcrypt both seem to be using the same NIST test vectors for the
GCM mode tests. Theoretically, I should be able to write a compatible
set of functions with gcrypt to handle gcrypt <-> SJCL interop.

Best Regards,

David



More information about the Gcrypt-devel mailing list