From c00b032bbfc14f40537989477229f189a1b529d7 Mon Sep 17 00:00:00 2001 From: Alexander Traud Date: Mon, 18 May 2020 17:10:01 +0200 Subject: [PATCH] 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 --- res/res_srtp.c | 8 ++++++++ 1 file changed, 8 insertions(+) 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); -- 2.47.2