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
This commit is contained in:
Alexander Traud 2020-05-18 17:10:01 +02:00 committed by Friendly Automation
parent 229cb16d52
commit c00b032bbf
1 changed files with 8 additions and 0 deletions

View 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);