Skip to content

Commit 812a683

Browse files
author
Richard L. Barnes
committed
Set full-size key length in crypto policies
1 parent c4a5455 commit 812a683

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

srtp/srtp.c

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -757,22 +757,20 @@ static inline int base_key_length(const srtp_cipher_type_t *cipher,
757757
int key_length)
758758
{
759759
switch (cipher->id) {
760+
case SRTP_NULL_CIPHER:
761+
return 0;
760762
case SRTP_AES_ICM_128:
761763
case SRTP_AES_ICM_192:
762764
case SRTP_AES_ICM_256:
763765
/* The legacy modes are derived from
764766
* the configured key length on the policy */
765767
return key_length - SRTP_SALT_LEN;
766-
break;
767768
case SRTP_AES_GCM_128:
768769
return key_length - SRTP_AEAD_SALT_LEN;
769-
break;
770770
case SRTP_AES_GCM_256:
771771
return key_length - SRTP_AEAD_SALT_LEN;
772-
break;
773772
default:
774773
return key_length;
775-
break;
776774
}
777775
}
778776

@@ -3279,7 +3277,7 @@ void srtp_crypto_policy_set_null_cipher_hmac_sha1_80(srtp_crypto_policy_t *p)
32793277
*/
32803278

32813279
p->cipher_type = SRTP_NULL_CIPHER;
3282-
p->cipher_key_len = 0;
3280+
p->cipher_key_len = 16;
32833281
p->auth_type = SRTP_HMAC_SHA1;
32843282
p->auth_key_len = 20;
32853283
p->auth_tag_len = 10;
@@ -3293,7 +3291,7 @@ void srtp_crypto_policy_set_null_cipher_hmac_null(srtp_crypto_policy_t *p)
32933291
*/
32943292

32953293
p->cipher_type = SRTP_NULL_CIPHER;
3296-
p->cipher_key_len = 0;
3294+
p->cipher_key_len = 16;
32973295
p->auth_type = SRTP_NULL_AUTH;
32983296
p->auth_key_len = 0;
32993297
p->auth_tag_len = 0;

0 commit comments

Comments
 (0)