[asterisk-commits] irroot: branch irroot/distrotech-customers-trunk r320619 - in /team/irroot/di...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Mon May 23 12:15:01 CDT 2011


Author: irroot
Date: Mon May 23 12:14:47 2011
New Revision: 320619

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

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


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

Modified: team/irroot/distrotech-customers-trunk/channels/chan_sip.c
URL: http://svnview.digium.com/svn/asterisk/team/irroot/distrotech-customers-trunk/channels/chan_sip.c?view=diff&rev=320619&r1=320618&r2=320619
==============================================================================
--- team/irroot/distrotech-customers-trunk/channels/chan_sip.c (original)
+++ team/irroot/distrotech-customers-trunk/channels/chan_sip.c Mon May 23 12:14:47 2011
@@ -11079,7 +11079,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) {
@@ -11089,13 +11089,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);
 		}
 
@@ -26237,27 +26237,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-trunk/channels/sip/include/sdp_crypto.h
URL: http://svnview.digium.com/svn/asterisk/team/irroot/distrotech-customers-trunk/channels/sip/include/sdp_crypto.h?view=diff&rev=320619&r1=320618&r2=320619
==============================================================================
--- team/irroot/distrotech-customers-trunk/channels/sip/include/sdp_crypto.h (original)
+++ team/irroot/distrotech-customers-trunk/channels/sip/include/sdp_crypto.h Mon May 23 12:14:47 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-trunk/channels/sip/sdp_crypto.c
URL: http://svnview.digium.com/svn/asterisk/team/irroot/distrotech-customers-trunk/channels/sip/sdp_crypto.c?view=diff&rev=320619&r1=320618&r2=320619
==============================================================================
--- team/irroot/distrotech-customers-trunk/channels/sip/sdp_crypto.c (original)
+++ team/irroot/distrotech-customers-trunk/channels/sip/sdp_crypto.c Mon May 23 12:14:47 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 asterisk-commits mailing list