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

Friendly Automation asteriskteam at digium.com
Wed May 20 10:11:54 CDT 2020


Friendly Automation has submitted this change. ( https://gerrit.asterisk.org/c/asterisk/+/14428 )

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(-)

Approvals:
  Joshua Colp: Looks good to me, but someone else must approve
  Kevin Harwell: Looks good to me, but someone else must approve
  George Joseph: Looks good to me, approved
  Friendly Automation: Approved for Submit



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/+/14428
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: 16
Gerrit-Change-Id: I1b9d7aade7d5120244ce7e3a8865518cbd6e0eee
Gerrit-Change-Number: 14428
Gerrit-PatchSet: 2
Gerrit-Owner: Alexander Traud <pabstraud at compuserve.com>
Gerrit-Reviewer: Friendly Automation
Gerrit-Reviewer: George Joseph <gjoseph at digium.com>
Gerrit-Reviewer: Joshua Colp <jcolp at sangoma.com>
Gerrit-Reviewer: Kevin Harwell <kharwell at digium.com>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20200520/0d30de6d/attachment.html>


More information about the asterisk-code-review mailing list