Skip to content

Commit 24da558

Browse files
authored
Merge pull request cisco#683 from pabuhler/remove-gcm-8-byte-tag
remove support for gcm_x_8
2 parents 1742c3d + c997bf0 commit 24da558

File tree

7 files changed

+38
-201
lines changed

7 files changed

+38
-201
lines changed

fuzzer/fuzzer.h

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -150,16 +150,8 @@ const struct fuzz_srtp_crypto_policy_func_ext fuzz_srtp_crypto_policies[] = {
150150
"srtp_crypto_policy_set_aes_cm_192_null_auth" },
151151
{ srtp_crypto_policy_set_aes_gcm_128_16_auth,
152152
"srtp_crypto_policy_set_aes_gcm_128_16_auth" },
153-
{ srtp_crypto_policy_set_aes_gcm_128_8_auth,
154-
"srtp_crypto_policy_set_aes_gcm_128_8_auth" },
155-
{ srtp_crypto_policy_set_aes_gcm_128_8_only_auth,
156-
"srtp_crypto_policy_set_aes_gcm_128_8_only_auth" },
157153
{ srtp_crypto_policy_set_aes_gcm_256_16_auth,
158154
"srtp_crypto_policy_set_aes_gcm_256_16_auth" },
159-
{ srtp_crypto_policy_set_aes_gcm_256_8_auth,
160-
"srtp_crypto_policy_set_aes_gcm_256_8_auth" },
161-
{ srtp_crypto_policy_set_aes_gcm_256_8_only_auth,
162-
"srtp_crypto_policy_set_aes_gcm_256_8_only_auth" },
163155
#endif
164156
};
165157

include/srtp.h

Lines changed: 0 additions & 92 deletions
Original file line numberDiff line numberDiff line change
@@ -1022,98 +1022,6 @@ void srtp_crypto_policy_set_aes_cm_192_hmac_sha1_32(srtp_crypto_policy_t *p);
10221022
*/
10231023
void srtp_crypto_policy_set_aes_cm_192_null_auth(srtp_crypto_policy_t *p);
10241024

1025-
/**
1026-
* @brief srtp_crypto_policy_set_aes_gcm_128_8_auth() sets a crypto
1027-
* policy structure to an AEAD encryption policy.
1028-
*
1029-
* @param p is a pointer to the policy structure to be set
1030-
*
1031-
* The function call srtp_crypto_policy_set_aes_gcm_128_8_auth(&p) sets
1032-
* the srtp_crypto_policy_t at location p to use the SRTP default cipher
1033-
* (AES-128 Galois Counter Mode) with 8 octet auth tag. This
1034-
* policy applies confidentiality and authentication to both the
1035-
* RTP and RTCP packets.
1036-
*
1037-
* This function is a convenience that helps to avoid dealing directly
1038-
* with the policy data structure. You are encouraged to initialize
1039-
* policy elements with this function call. Doing so may allow your
1040-
* code to be forward compatible with later versions of libSRTP that
1041-
* include more elements in the srtp_crypto_policy_t datatype.
1042-
*
1043-
* @return void.
1044-
*
1045-
*/
1046-
void srtp_crypto_policy_set_aes_gcm_128_8_auth(srtp_crypto_policy_t *p);
1047-
1048-
/**
1049-
* @brief srtp_crypto_policy_set_aes_gcm_256_8_auth() sets a crypto
1050-
* policy structure to an AEAD encryption policy
1051-
*
1052-
* @param p is a pointer to the policy structure to be set
1053-
*
1054-
* The function call srtp_crypto_policy_set_aes_gcm_256_8_auth(&p) sets
1055-
* the srtp_crypto_policy_t at location p to use the SRTP default cipher
1056-
* (AES-256 Galois Counter Mode) with 8 octet auth tag. This
1057-
* policy applies confidentiality and authentication to both the
1058-
* RTP and RTCP packets.
1059-
*
1060-
* This function is a convenience that helps to avoid dealing directly
1061-
* with the policy data structure. You are encouraged to initialize
1062-
* policy elements with this function call. Doing so may allow your
1063-
* code to be forward compatible with later versions of libSRTP that
1064-
* include more elements in the srtp_crypto_policy_t datatype.
1065-
*
1066-
* @return void.
1067-
*
1068-
*/
1069-
void srtp_crypto_policy_set_aes_gcm_256_8_auth(srtp_crypto_policy_t *p);
1070-
1071-
/**
1072-
* @brief srtp_crypto_policy_set_aes_gcm_128_8_only_auth() sets a crypto
1073-
* policy structure to an AEAD authentication-only policy
1074-
*
1075-
* @param p is a pointer to the policy structure to be set
1076-
*
1077-
* The function call srtp_crypto_policy_set_aes_gcm_128_8_only_auth(&p) sets
1078-
* the srtp_crypto_policy_t at location p to use the SRTP default cipher
1079-
* (AES-128 Galois Counter Mode) with 8 octet auth tag. This policy
1080-
* applies confidentiality and authentication to the RTP packets,
1081-
* but only authentication to the RTCP packets.
1082-
*
1083-
* This function is a convenience that helps to avoid dealing directly
1084-
* with the policy data structure. You are encouraged to initialize
1085-
* policy elements with this function call. Doing so may allow your
1086-
* code to be forward compatible with later versions of libSRTP that
1087-
* include more elements in the srtp_crypto_policy_t datatype.
1088-
*
1089-
* @return void.
1090-
*
1091-
*/
1092-
void srtp_crypto_policy_set_aes_gcm_128_8_only_auth(srtp_crypto_policy_t *p);
1093-
1094-
/**
1095-
* @brief srtp_crypto_policy_set_aes_gcm_256_8_only_auth() sets a crypto
1096-
* policy structure to an AEAD authentication-only policy
1097-
*
1098-
* @param p is a pointer to the policy structure to be set
1099-
*
1100-
* The function call srtp_crypto_policy_set_aes_gcm_256_8_only_auth(&p) sets
1101-
* the srtp_crypto_policy_t at location p to use the SRTP default cipher
1102-
* (AES-256 Galois Counter Mode) with 8 octet auth tag. This policy
1103-
* applies confidentiality and authentication to the RTP packets,
1104-
* but only authentication to the RTCP packets.
1105-
*
1106-
* This function is a convenience that helps to avoid dealing directly
1107-
* with the policy data structure. You are encouraged to initialize
1108-
* policy elements with this function call. Doing so may allow your
1109-
* code to be forward compatible with later versions of libSRTP that
1110-
* include more elements in the srtp_crypto_policy_t datatype.
1111-
*
1112-
* @return void.
1113-
*
1114-
*/
1115-
void srtp_crypto_policy_set_aes_gcm_256_8_only_auth(srtp_crypto_policy_t *p);
1116-
11171025
/**
11181026
* @brief srtp_crypto_policy_set_aes_gcm_128_16_auth() sets a crypto
11191027
* policy structure to an AEAD encryption policy.

srtp.def

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,6 @@ srtp_crypto_policy_set_aes_cm_192_null_auth
2323
srtp_crypto_policy_set_aes_cm_256_hmac_sha1_80
2424
srtp_crypto_policy_set_aes_cm_256_hmac_sha1_32
2525
srtp_crypto_policy_set_aes_cm_256_null_auth
26-
srtp_crypto_policy_set_aes_gcm_128_8_auth
27-
srtp_crypto_policy_set_aes_gcm_256_8_auth
28-
srtp_crypto_policy_set_aes_gcm_128_8_only_auth
29-
srtp_crypto_policy_set_aes_gcm_256_8_only_auth
3026
srtp_crypto_policy_set_aes_gcm_128_16_auth
3127
srtp_crypto_policy_set_aes_gcm_256_16_auth
3228
srtp_dealloc

srtp/srtp.c

Lines changed: 0 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -3452,58 +3452,6 @@ void srtp_crypto_policy_set_aes_cm_192_null_auth(srtp_crypto_policy_t *p)
34523452
p->sec_serv = sec_serv_conf;
34533453
}
34543454

3455-
/*
3456-
* AES-128 GCM mode with 8 octet auth tag.
3457-
*/
3458-
void srtp_crypto_policy_set_aes_gcm_128_8_auth(srtp_crypto_policy_t *p)
3459-
{
3460-
p->cipher_type = SRTP_AES_GCM_128;
3461-
p->cipher_key_len = SRTP_AES_GCM_128_KEY_LEN_WSALT;
3462-
p->auth_type = SRTP_NULL_AUTH; /* GCM handles the auth for us */
3463-
p->auth_key_len = 0;
3464-
p->auth_tag_len = 8; /* 8 octet tag length */
3465-
p->sec_serv = sec_serv_conf_and_auth;
3466-
}
3467-
3468-
/*
3469-
* AES-256 GCM mode with 8 octet auth tag.
3470-
*/
3471-
void srtp_crypto_policy_set_aes_gcm_256_8_auth(srtp_crypto_policy_t *p)
3472-
{
3473-
p->cipher_type = SRTP_AES_GCM_256;
3474-
p->cipher_key_len = SRTP_AES_GCM_256_KEY_LEN_WSALT;
3475-
p->auth_type = SRTP_NULL_AUTH; /* GCM handles the auth for us */
3476-
p->auth_key_len = 0;
3477-
p->auth_tag_len = 8; /* 8 octet tag length */
3478-
p->sec_serv = sec_serv_conf_and_auth;
3479-
}
3480-
3481-
/*
3482-
* AES-128 GCM mode with 8 octet auth tag, no RTCP encryption.
3483-
*/
3484-
void srtp_crypto_policy_set_aes_gcm_128_8_only_auth(srtp_crypto_policy_t *p)
3485-
{
3486-
p->cipher_type = SRTP_AES_GCM_128;
3487-
p->cipher_key_len = SRTP_AES_GCM_128_KEY_LEN_WSALT;
3488-
p->auth_type = SRTP_NULL_AUTH; /* GCM handles the auth for us */
3489-
p->auth_key_len = 0;
3490-
p->auth_tag_len = 8; /* 8 octet tag length */
3491-
p->sec_serv = sec_serv_auth; /* This only applies to RTCP */
3492-
}
3493-
3494-
/*
3495-
* AES-256 GCM mode with 8 octet auth tag, no RTCP encryption.
3496-
*/
3497-
void srtp_crypto_policy_set_aes_gcm_256_8_only_auth(srtp_crypto_policy_t *p)
3498-
{
3499-
p->cipher_type = SRTP_AES_GCM_256;
3500-
p->cipher_key_len = SRTP_AES_GCM_256_KEY_LEN_WSALT;
3501-
p->auth_type = SRTP_NULL_AUTH; /* GCM handles the auth for us */
3502-
p->auth_key_len = 0;
3503-
p->auth_tag_len = 8; /* 8 octet tag length */
3504-
p->sec_serv = sec_serv_auth; /* This only applies to RTCP */
3505-
}
3506-
35073455
/*
35083456
* AES-128 GCM mode with 16 octet auth tag.
35093457
*/

test/rtp_decoder.c

Lines changed: 14 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -320,9 +320,8 @@ int main(int argc, char *argv[])
320320
}
321321
}
322322

323-
if (gcm_on && scs.tag_size != 8 && scs.tag_size != 16) {
324-
fprintf(stderr, "error: GCM tag size must be 8 or 16 (%d)\n",
325-
scs.tag_size);
323+
if (gcm_on && scs.tag_size != 16) {
324+
fprintf(stderr, "error: GCM tag size must be 16 (%d)\n", scs.tag_size);
326325
exit(1);
327326
}
328327

@@ -379,24 +378,12 @@ int main(int argc, char *argv[])
379378
#ifdef OPENSSL
380379
switch (scs.key_size) {
381380
case 128:
382-
if (scs.tag_size == 16) {
383-
srtp_crypto_policy_set_aes_gcm_128_16_auth(&policy.rtp);
384-
srtp_crypto_policy_set_aes_gcm_128_16_auth(
385-
&policy.rtcp);
386-
} else {
387-
srtp_crypto_policy_set_aes_gcm_128_8_auth(&policy.rtp);
388-
srtp_crypto_policy_set_aes_gcm_128_8_auth(&policy.rtcp);
389-
}
381+
srtp_crypto_policy_set_aes_gcm_128_16_auth(&policy.rtp);
382+
srtp_crypto_policy_set_aes_gcm_128_16_auth(&policy.rtcp);
390383
break;
391384
case 256:
392-
if (scs.tag_size == 16) {
393-
srtp_crypto_policy_set_aes_gcm_256_16_auth(&policy.rtp);
394-
srtp_crypto_policy_set_aes_gcm_256_16_auth(
395-
&policy.rtcp);
396-
} else {
397-
srtp_crypto_policy_set_aes_gcm_256_8_auth(&policy.rtp);
398-
srtp_crypto_policy_set_aes_gcm_256_8_auth(&policy.rtcp);
399-
}
385+
srtp_crypto_policy_set_aes_gcm_256_16_auth(&policy.rtp);
386+
srtp_crypto_policy_set_aes_gcm_256_16_auth(&policy.rtcp);
400387
break;
401388
}
402389
#else
@@ -495,14 +482,16 @@ int main(int argc, char *argv[])
495482
#ifdef OPENSSL
496483
switch (scs.key_size) {
497484
case 128:
498-
srtp_crypto_policy_set_aes_gcm_128_8_only_auth(&policy.rtp);
499-
srtp_crypto_policy_set_aes_gcm_128_8_only_auth(
500-
&policy.rtcp);
485+
srtp_crypto_policy_set_aes_gcm_128_16_auth(&policy.rtp);
486+
policy.rtp.sec_serv = sec_serv_auth;
487+
srtp_crypto_policy_set_aes_gcm_128_16_auth(&policy.rtcp);
488+
policy.rtcp.sec_serv = sec_serv_auth;
501489
break;
502490
case 256:
503-
srtp_crypto_policy_set_aes_gcm_256_8_only_auth(&policy.rtp);
504-
srtp_crypto_policy_set_aes_gcm_256_8_only_auth(
505-
&policy.rtcp);
491+
srtp_crypto_policy_set_aes_gcm_256_16_auth(&policy.rtp);
492+
policy.rtp.sec_serv = sec_serv_auth;
493+
srtp_crypto_policy_set_aes_gcm_256_16_auth(&policy.rtcp);
494+
policy.rtcp.sec_serv = sec_serv_auth;
506495
break;
507496
}
508497
#else

test/rtpw.c

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -378,12 +378,12 @@ int main(int argc, char *argv[])
378378
#ifdef GCM
379379
switch (key_size) {
380380
case 128:
381-
srtp_crypto_policy_set_aes_gcm_128_8_auth(&policy.rtp);
382-
srtp_crypto_policy_set_aes_gcm_128_8_auth(&policy.rtcp);
381+
srtp_crypto_policy_set_aes_gcm_128_16_auth(&policy.rtp);
382+
srtp_crypto_policy_set_aes_gcm_128_16_auth(&policy.rtcp);
383383
break;
384384
case 256:
385-
srtp_crypto_policy_set_aes_gcm_256_8_auth(&policy.rtp);
386-
srtp_crypto_policy_set_aes_gcm_256_8_auth(&policy.rtcp);
385+
srtp_crypto_policy_set_aes_gcm_256_16_auth(&policy.rtp);
386+
srtp_crypto_policy_set_aes_gcm_256_16_auth(&policy.rtcp);
387387
break;
388388
}
389389
#else
@@ -427,14 +427,16 @@ int main(int argc, char *argv[])
427427
#ifdef GCM
428428
switch (key_size) {
429429
case 128:
430-
srtp_crypto_policy_set_aes_gcm_128_8_only_auth(&policy.rtp);
431-
srtp_crypto_policy_set_aes_gcm_128_8_only_auth(
432-
&policy.rtcp);
430+
srtp_crypto_policy_set_aes_gcm_128_16_auth(&policy.rtp);
431+
policy.rtp.sec_serv = sec_serv_auth;
432+
srtp_crypto_policy_set_aes_gcm_128_16_auth(&policy.rtcp);
433+
policy.rtcp.sec_serv = sec_serv_auth;
433434
break;
434435
case 256:
435-
srtp_crypto_policy_set_aes_gcm_256_8_only_auth(&policy.rtp);
436-
srtp_crypto_policy_set_aes_gcm_256_8_only_auth(
437-
&policy.rtcp);
436+
srtp_crypto_policy_set_aes_gcm_256_16_auth(&policy.rtp);
437+
policy.rtp.sec_serv = sec_serv_auth;
438+
srtp_crypto_policy_set_aes_gcm_256_16_auth(&policy.rtcp);
439+
policy.rtcp.sec_serv = sec_serv_auth;
438440
break;
439441
}
440442
#else

test/srtp_driver.c

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2373,25 +2373,27 @@ srtp_err_status_t srtp_validate_encrypted_extensions_headers_gcm(void)
23732373
0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab,
23742374
0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab
23752375
};
2376-
uint8_t srtp_plaintext[64] = {
2376+
uint8_t srtp_plaintext[72] = {
23772377
0x90, 0x0f, 0x12, 0x34, 0xde, 0xca, 0xfb, 0xad,
23782378
0xca, 0xfe, 0xba, 0xbe, 0xBE, 0xDE, 0x00, 0x06,
23792379
0x17, 0x41, 0x42, 0x73, 0xA4, 0x75, 0x26, 0x27,
23802380
0x48, 0x22, 0x00, 0x00, 0xC8, 0x30, 0x8E, 0x46,
23812381
0x55, 0x99, 0x63, 0x86, 0xB3, 0x95, 0xFB, 0x00,
23822382
0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab,
23832383
0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab,
2384+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
23842385
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
23852386
};
2386-
uint8_t srtp_ciphertext[64] = {
2387+
uint8_t srtp_ciphertext[72] = {
23872388
0x90, 0x0f, 0x12, 0x34, 0xde, 0xca, 0xfb, 0xad,
23882389
0xca, 0xfe, 0xba, 0xbe, 0xBE, 0xDE, 0x00, 0x06,
23892390
0x17, 0x12, 0xe0, 0x20, 0x5b, 0xfa, 0x94, 0x9b,
23902391
0x1C, 0x22, 0x00, 0x00, 0xC8, 0x30, 0xbb, 0x46,
23912392
0x73, 0x27, 0x78, 0xd9, 0x92, 0x9a, 0xab, 0x00,
23922393
0x0e, 0xca, 0x0c, 0xf9, 0x5e, 0xe9, 0x55, 0xb2,
23932394
0x6c, 0xd3, 0xd2, 0x88, 0xb4, 0x9f, 0x6c, 0xa9,
2394-
0xf4, 0xb1, 0xb7, 0x59, 0x71, 0x9e, 0xb5, 0xbc
2395+
0xf4, 0xb1, 0xb7, 0x59, 0x71, 0x9e, 0xb5, 0xbc,
2396+
0x11, 0x3b, 0x9f, 0xf1, 0xd4, 0x0c, 0xd2, 0x5a
23952397
};
23962398
// clang-format on
23972399

@@ -2406,8 +2408,8 @@ srtp_err_status_t srtp_validate_encrypted_extensions_headers_gcm(void)
24062408
* policy and with the SSRC value 0xcafebabe
24072409
*/
24082410
memset(&policy, 0, sizeof(policy));
2409-
srtp_crypto_policy_set_aes_gcm_128_8_auth(&policy.rtp);
2410-
srtp_crypto_policy_set_aes_gcm_128_8_auth(&policy.rtcp);
2411+
srtp_crypto_policy_set_aes_gcm_128_16_auth(&policy.rtp);
2412+
srtp_crypto_policy_set_aes_gcm_128_16_auth(&policy.rtcp);
24112413
policy.ssrc.type = ssrc_specific;
24122414
policy.ssrc.value = 0xcafebabe;
24132415
policy.key = test_key_ext_headers;
@@ -2429,9 +2431,9 @@ srtp_err_status_t srtp_validate_encrypted_extensions_headers_gcm(void)
24292431
if (status || (len != sizeof(srtp_plaintext)))
24302432
return srtp_err_status_fail;
24312433

2432-
debug_print(mod_driver, "ciphertext:\n %s",
2434+
debug_print(mod_driver, " ? ciphertext:\n %s",
24332435
srtp_octet_string_hex_string(srtp_plaintext, len));
2434-
debug_print(mod_driver, "ciphertext reference:\n %s",
2436+
debug_print(mod_driver, " ? ciphertext reference:\n %s",
24352437
srtp_octet_string_hex_string(srtp_ciphertext, len));
24362438

24372439
if (srtp_octet_string_is_eq(srtp_plaintext, srtp_ciphertext, len))
@@ -2723,8 +2725,8 @@ srtp_err_status_t srtp_test_empty_payload_gcm(void)
27232725
* policy and with the SSRC value 0xcafebabe
27242726
*/
27252727
memset(&policy, 0, sizeof(policy));
2726-
srtp_crypto_policy_set_aes_gcm_128_8_auth(&policy.rtp);
2727-
srtp_crypto_policy_set_aes_gcm_128_8_auth(&policy.rtcp);
2728+
srtp_crypto_policy_set_aes_gcm_128_16_auth(&policy.rtp);
2729+
srtp_crypto_policy_set_aes_gcm_128_16_auth(&policy.rtcp);
27282730
policy.ssrc.type = ssrc_specific;
27292731
policy.ssrc.value = 0xcafebabe;
27302732
policy.key = test_key;
@@ -2745,7 +2747,7 @@ srtp_err_status_t srtp_test_empty_payload_gcm(void)
27452747
status = srtp_protect(srtp_snd, mesg, &len);
27462748
if (status) {
27472749
return status;
2748-
} else if (len != 12 + 8) {
2750+
} else if (len != 12 + 16) {
27492751
return srtp_err_status_fail;
27502752
}
27512753

0 commit comments

Comments
 (0)