From: Alexander Traud Date: Mon, 18 May 2020 15:10:01 +0000 (+0200) Subject: res_srtp: Set all possible flags while selecting the Crypto Suite. X-Git-Tag: 18.0.0-rc1~93 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4de0e50c320a89ae0938008642716ac19802faf0;p=thirdparty%2Fasterisk.git res_srtp: Set all possible flags while selecting the Crypto Suite. 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 --- diff --git a/res/res_srtp.c b/res/res_srtp.c index 3e4b51fafb..7874216079 100644 --- a/res/res_srtp.c +++ b/res/res_srtp.c @@ -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);