[Asterisk-code-review] res_srtp: Set all possible flags while selecting the Crypto Suite. (asterisk[master])

Alexander Traud asteriskteam at digium.com
Mon May 18 10:21:15 CDT 2020


Alexander Traud has uploaded this change for review. ( https://gerrit.asterisk.org/c/asterisk/+/14415 )


Change subject: res_srtp: Set all possible flags while selecting the Crypto Suite.
......................................................................

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
---
M res/res_srtp.c
1 file changed, 8 insertions(+), 0 deletions(-)



  git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/15/14415/1

diff --git a/res/res_srtp.c b/res/res_srtp.c
index 3e4b51f..7874216 100644
--- a/res/res_srtp.c
+++ b/res/res_srtp.c
@@ -863,6 +863,14 @@
 		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);

-- 
To view, visit https://gerrit.asterisk.org/c/asterisk/+/14415
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-Change-Id: I1b9d7aade7d5120244ce7e3a8865518cbd6e0eee
Gerrit-Change-Number: 14415
Gerrit-PatchSet: 1
Gerrit-Owner: Alexander Traud <pabstraud at compuserve.com>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20200518/17d00552/attachment-0001.html>


More information about the asterisk-code-review mailing list