Merge pull request #702 from zandeez/master

[Core] Add AEAD_AES_128_GCM and AEAD_AES_256_GCM ciphers support.
This commit is contained in:
Andrey Volk 2020-06-22 18:58:48 +04:00 committed by GitHub
commit a862491bf8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 22 additions and 0 deletions

View File

@ -2642,7 +2642,9 @@ typedef enum {
typedef enum {
AEAD_AES_256_GCM_8,
AEAD_AES_256_GCM,
AEAD_AES_128_GCM_8,
AEAD_AES_128_GCM,
AES_CM_256_HMAC_SHA1_80,
AES_CM_192_HMAC_SHA1_80,
AES_CM_128_HMAC_SHA1_80,

View File

@ -279,7 +279,9 @@ struct switch_media_handle_s {
switch_srtp_crypto_suite_t SUITES[CRYPTO_INVALID] = {
{ "AEAD_AES_256_GCM_8", "", AEAD_AES_256_GCM_8, 44, 12},
{ "AEAD_AES_256_GCM", "", AEAD_AES_256_GCM, 44, 12},
{ "AEAD_AES_128_GCM_8", "", AEAD_AES_128_GCM_8, 28, 12},
{ "AEAD_AES_128_GCM", "", AEAD_AES_128_GCM, 28, 12},
{ "AES_256_CM_HMAC_SHA1_80", "AES_CM_256_HMAC_SHA1_80", AES_CM_256_HMAC_SHA1_80, 46, 14},
{ "AES_192_CM_HMAC_SHA1_80", "AES_CM_192_HMAC_SHA1_80", AES_CM_192_HMAC_SHA1_80, 38, 14},
{ "AES_CM_128_HMAC_SHA1_80", "", AES_CM_128_HMAC_SHA1_80, 30, 14},

View File

@ -4075,6 +4075,15 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_add_crypto_key(switch_rtp_t *rtp_sess
}
break;
case AEAD_AES_256_GCM:
srtp_crypto_policy_set_aes_gcm_256_16_auth(&policy->rtp);
srtp_crypto_policy_set_aes_gcm_256_16_auth(&policy->rtcp);
if (switch_channel_direction(channel) == SWITCH_CALL_DIRECTION_OUTBOUND) {
switch_channel_set_variable(channel, "rtp_has_crypto", "AEAD_AES_256_GCM");
}
break;
case AEAD_AES_128_GCM_8:
srtp_crypto_policy_set_aes_gcm_128_8_auth(&policy->rtp);
srtp_crypto_policy_set_aes_gcm_128_8_auth(&policy->rtcp);
@ -4084,6 +4093,15 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_add_crypto_key(switch_rtp_t *rtp_sess
}
break;
case AEAD_AES_128_GCM:
srtp_crypto_policy_set_aes_gcm_128_16_auth(&policy->rtp);
srtp_crypto_policy_set_aes_gcm_128_16_auth(&policy->rtcp);
if (switch_channel_direction(channel) == SWITCH_CALL_DIRECTION_OUTBOUND) {
switch_channel_set_variable(channel, "rtp_has_crypto", "AEAD_AES_128_GCM");
}
break;
case AES_CM_256_HMAC_SHA1_80:
srtp_crypto_policy_set_aes_cm_256_hmac_sha1_80(&policy->rtp);
srtp_crypto_policy_set_aes_cm_256_hmac_sha1_80(&policy->rtcp);