]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
Set the algorithm member on cipher_t when allocating AES crypto instance. Apply...
authorjfigus <jfig_us@yahoo.com>
Mon, 28 Apr 2014 14:06:17 +0000 (10:06 -0400)
committerTravis Cross <tc@traviscross.com>
Mon, 30 Jun 2014 19:18:20 +0000 (19:18 +0000)
libs/srtp/crypto/cipher/aes_icm.c
libs/srtp/crypto/cipher/null_cipher.c

index 7a8e56f850059ec48bc7af27e7636ce515ac2115..cf316b1ffdf0d5c373f82255526b48b26d18559a 100644 (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);
 
index 001e20ff47cffa69d22fb5a8645d10111c90c5c5..8c2f09f9967de00ae028b272f48d42743b8c32fd 100644 (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);