From: jfigus Date: Mon, 28 Apr 2014 14:06:17 +0000 (-0400) Subject: Set the algorithm member on cipher_t when allocating AES crypto instance. Apply... X-Git-Tag: v1.5.13~69 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b9da5149e2c4d443ef32e7edb8bc5b0e0ca6ee3b;p=thirdparty%2Ffreeswitch.git Set the algorithm member on cipher_t when allocating AES crypto instance. Apply same fix to NULL cipher. --- diff --git a/libs/srtp/crypto/cipher/aes_icm.c b/libs/srtp/crypto/cipher/aes_icm.c index 7a8e56f850..cf316b1ffd 100644 --- a/libs/srtp/crypto/cipher/aes_icm.c +++ b/libs/srtp/crypto/cipher/aes_icm.c @@ -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); diff --git a/libs/srtp/crypto/cipher/null_cipher.c b/libs/srtp/crypto/cipher/null_cipher.c index 001e20ff47..8c2f09f996 100644 --- a/libs/srtp/crypto/cipher/null_cipher.c +++ b/libs/srtp/crypto/cipher/null_cipher.c @@ -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);