]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
[Core] Add AEAD_AES_128_GCM and AEAD_AES_256_GCM ciphers support. 702/head
authorAndrew Cassidy <andee@bytz.co.uk>
Sun, 21 Jun 2020 07:42:13 +0000 (08:42 +0100)
committerAndrey Volk <andywolk@gmail.com>
Mon, 22 Jun 2020 12:26:22 +0000 (16:26 +0400)
src/include/switch_types.h
src/switch_core_media.c
src/switch_rtp.c

index 24f278f04104004e3115ee41b21cfe3d1046f478..133422764b70602b2e46c6d913321de3fa79a5e6 100644 (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,
index 65ea2f3a6bb6d27d79b54f36fb36d2ae6e2d72ae..ca6be2c16df5aa7add20dd6a50b16b0bbe29b1cc 100644 (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},
index 28a91ee32800b209cb809238f17b463588f5fc89..080aee637a21e0f28eea9f24639657ac584522f4 100644 (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);