[svn-commits] irroot: branch irroot/distrotech-customers-1.8 r320639 - in /team/irroot/dist...

SVN commits to the Digium repositories svn-commits at lists.digium.com
Mon May 23 12:22:22 CDT 2011


Author: irroot
Date: Mon May 23 12:22:08 2011
New Revision: 320639

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=320639
Log:

Change bitlen to taglen
Add option encryption_taglen_32 = [y/n] default no


Modified:
    team/irroot/distrotech-customers-1.8/channels/chan_sip.c
    team/irroot/distrotech-customers-1.8/channels/sip/include/sdp_crypto.h
    team/irroot/distrotech-customers-1.8/channels/sip/sdp_crypto.c

Modified: team/irroot/distrotech-customers-1.8/channels/chan_sip.c
URL: http://svnview.digium.com/svn/asterisk/team/irroot/distrotech-customers-1.8/channels/chan_sip.c?view=diff&rev=320639&r1=320638&r2=320639
==============================================================================
--- team/irroot/distrotech-customers-1.8/channels/chan_sip.c (original)
+++ team/irroot/distrotech-customers-1.8/channels/chan_sip.c Mon May 23 12:22:08 2011
@@ -10846,7 +10846,7 @@
 
 static void get_crypto_attrib(struct sip_pvt *p, struct sip_srtp *srtp, const char **a_crypto)
 {
-	int bitlen = 80;
+	int taglen = 80;
 
 	/* Set encryption properties */
 	if (srtp) {
@@ -10856,13 +10856,13 @@
 
 		/* set the key length based on INVITE or settings */
 		if (ast_test_flag(srtp, SRTP_CRYPTO_TAG_80)) {
-			bitlen = 80;
+			taglen = 80;
 		} else if (ast_test_flag(&p->flags[2], SIP_PAGE3_SRTP_TAG_32) ||
 		    ast_test_flag(srtp, SRTP_CRYPTO_TAG_32)) {
-			bitlen = 32;
-		}
-
-		if (srtp->crypto && (sdp_crypto_offer(srtp->crypto, bitlen) >= 0)) {
+			taglen = 32;
+		}
+
+		if (srtp->crypto && (sdp_crypto_offer(srtp->crypto, taglen) >= 0)) {
 			*a_crypto = sdp_crypto_attrib(srtp->crypto);
 		}
 
@@ -25904,27 +25904,20 @@
 	} else if (!strcasecmp(v->name, "buggymwi")) {
 		ast_set_flag(&mask[1], SIP_PAGE2_BUGGY_MWI);
 		ast_set2_flag(&flags[1], ast_true(v->value), SIP_PAGE2_BUGGY_MWI);
+	} else if (!strcasecmp(v->name, "encryption_taglen_32")) {
+		ast_set_flag(&mask[2], SIP_PAGE3_SRTP_TAG_32);
+		ast_set2_flag(&flags[2], ast_true(v->value), SIP_PAGE3_SRTP_TAG_32);
 	} else if (!strcasecmp(v->name, "encryption")) {
-		char *buf = ast_strdupa(v->value);
-		char *word, *next = buf;
-
 		ast_set_flag(&mask[1], SIP_PAGE2_USE_SRTP);
 		ast_set_flag(&mask[2], SIP_PAGE3_SRTP_TRY);
-		ast_set_flag(&mask[2], SIP_PAGE3_SRTP_TAG_32);
-		ast_clear_flag(&flags[2], SIP_PAGE3_SRTP_TAG_32);
-
-		while ((word = strsep(&next, ","))) {
-			if (!strcasecmp(word,"try")) {
-				ast_set_flag(&flags[1], SIP_PAGE2_USE_SRTP);
-				ast_set_flag(&flags[2], SIP_PAGE3_SRTP_TRY);
-			} else if (!strcasecmp(word,"32bit")) {
-				ast_set_flag(&flags[2], SIP_PAGE3_SRTP_TAG_32);
-			} else if (ast_true(word) || ast_false(word)) {
-				ast_set2_flag(&flags[1], ast_true(word), SIP_PAGE2_USE_SRTP);
-				ast_clear_flag(&flags[2], SIP_PAGE3_SRTP_TRY);
-			}
-		}
-
+
+		if (!strcasecmp(v->value, "try")) {
+			ast_set_flag(&flags[1], SIP_PAGE2_USE_SRTP);
+			ast_set_flag(&flags[2], SIP_PAGE3_SRTP_TRY);
+		} else {
+			ast_set2_flag(&flags[1], ast_true(v->value), SIP_PAGE2_USE_SRTP);
+			ast_clear_flag(&flags[2], SIP_PAGE3_SRTP_TRY);
+		}
 	} else
 		res = 0;
 

Modified: team/irroot/distrotech-customers-1.8/channels/sip/include/sdp_crypto.h
URL: http://svnview.digium.com/svn/asterisk/team/irroot/distrotech-customers-1.8/channels/sip/include/sdp_crypto.h?view=diff&rev=320639&r1=320638&r2=320639
==============================================================================
--- team/irroot/distrotech-customers-1.8/channels/sip/include/sdp_crypto.h (original)
+++ team/irroot/distrotech-customers-1.8/channels/sip/include/sdp_crypto.h Mon May 23 12:22:08 2011
@@ -70,7 +70,7 @@
  * \retval 0 success
  * \retval nonzero failure
  */
-int sdp_crypto_offer(struct sdp_crypto *p, int bitlen);
+int sdp_crypto_offer(struct sdp_crypto *p, int taglen);
 
 
 /*! \brief Return the a_crypto value of the sdp_crypto struct

Modified: team/irroot/distrotech-customers-1.8/channels/sip/sdp_crypto.c
URL: http://svnview.digium.com/svn/asterisk/team/irroot/distrotech-customers-1.8/channels/sip/sdp_crypto.c?view=diff&rev=320639&r1=320638&r2=320639
==============================================================================
--- team/irroot/distrotech-customers-1.8/channels/sip/sdp_crypto.c (original)
+++ team/irroot/distrotech-customers-1.8/channels/sip/sdp_crypto.c Mon May 23 12:22:08 2011
@@ -286,7 +286,7 @@
 	return 0;
 }
 
-int sdp_crypto_offer(struct sdp_crypto *p,int bitlen)
+int sdp_crypto_offer(struct sdp_crypto *p,int taglen)
 {
 	char crypto_buf[128];
 
@@ -295,7 +295,7 @@
 	}
 
 	if (snprintf(crypto_buf, sizeof(crypto_buf), "a=crypto:1 AES_CM_128_HMAC_SHA1_%i inline:%s\r\n",
-			bitlen, p->local_key64) < 1) {
+			taglen, p->local_key64) < 1) {
 		return -1;
 	}
 




More information about the svn-commits mailing list