]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
res_srtp: Set all possible flags while selecting the Crypto Suite.
authorAlexander Traud <pabstraud@compuserve.com>
Mon, 18 May 2020 15:10:01 +0000 (17:10 +0200)
committerFriendly Automation <jenkins2@gerrit.asterisk.org>
Wed, 20 May 2020 15:46:07 +0000 (10:46 -0500)
The flags of a previous selection could have been set within the
object 'srtp', for example, when the previous selection returned
failure after setting just 'some' flags. Now, not to clutter the
code, all possible flags are cleared first, and then the selected
flags are set as before.

ASTERISK-28903

Change-Id: I1b9d7aade7d5120244ce7e3a8865518cbd6e0eee

res/res_srtp.c

index 3e4b51fafb42b396b7cb216652edb832446e9d05..78742160798867efb9da18326e365cdcf6dd7b55 100644 (file)
@@ -863,6 +863,14 @@ static int res_sdp_crypto_parse_offer(struct ast_rtp_instance *rtp, struct ast_s
                crypto->tag = tag_from_sdp;
        }
 
+       ast_clear_flag(srtp, AST_SRTP_CRYPTO_TAG_8);
+       ast_clear_flag(srtp, AST_SRTP_CRYPTO_TAG_16);
+       ast_clear_flag(srtp, AST_SRTP_CRYPTO_TAG_32);
+       ast_clear_flag(srtp, AST_SRTP_CRYPTO_TAG_80);
+       ast_clear_flag(srtp, AST_SRTP_CRYPTO_AES_192);
+       ast_clear_flag(srtp, AST_SRTP_CRYPTO_AES_256);
+       ast_clear_flag(srtp, AST_SRTP_CRYPTO_OLD_NAME);
+
        if (!strcmp(suite, "AES_CM_128_HMAC_SHA1_80")) {
                suite_val = AST_AES_CM_128_HMAC_SHA1_80;
                ast_set_flag(srtp, AST_SRTP_CRYPTO_TAG_80);