Set the algorithm member on cipher_t when allocating AES crypto instance. Apply same fix to NULL cipher.

This commit is contained in:
jfigus 2014-04-28 10:06:17 -04:00 committed by Travis Cross
parent aa4261d11f
commit b9da5149e2
2 changed files with 12 additions and 0 deletions

View File

@ -118,6 +118,17 @@ aes_icm_alloc_ismacryp(cipher_t **c, int key_len, int forIsmacryp) {
/* set pointers */
*c = (cipher_t *)pointer;
switch (key_len) {
case 46:
(*c)->algorithm = AES_256_ICM;
break;
case 38:
(*c)->algorithm = AES_192_ICM;
break;
default:
(*c)->algorithm = AES_128_ICM;
break;
}
(*c)->type = &aes_icm;
(*c)->state = pointer + sizeof(cipher_t);

View File

@ -68,6 +68,7 @@ null_cipher_alloc(cipher_t **c, int key_len) {
/* set pointers */
*c = (cipher_t *)pointer;
(*c)->algorithm = NULL_CIPHER;
(*c)->type = &null_cipher;
(*c)->state = pointer + sizeof(cipher_t);