[svn-commits] mjordan: branch mjordan/1.8-srtp r372147 - in /team/mjordan/1.8-srtp: ./ chan...
SVN commits to the Digium repositories
svn-commits at lists.digium.com
Tue Sep 4 13:07:48 CDT 2012
Author: mjordan
Date: Tue Sep 4 13:07:44 2012
New Revision: 372147
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=372147
Log:
Branch out some SRTP tweaks for testing
Added:
team/mjordan/1.8-srtp/
- copied from r372132, branches/1.8/
Modified:
team/mjordan/1.8-srtp/channels/chan_sip.c
team/mjordan/1.8-srtp/channels/sip/sdp_crypto.c
Modified: team/mjordan/1.8-srtp/channels/chan_sip.c
URL: http://svnview.digium.com/svn/asterisk/team/mjordan/1.8-srtp/channels/chan_sip.c?view=diff&rev=372147&r1=372132&r2=372147
==============================================================================
--- team/mjordan/1.8-srtp/channels/chan_sip.c (original)
+++ team/mjordan/1.8-srtp/channels/chan_sip.c Tue Sep 4 13:07:44 2012
@@ -9197,6 +9197,10 @@
} else if (!processed_crypto && process_crypto(p, p->rtp, &p->srtp, value)) {
processed_crypto = TRUE;
processed = TRUE;
+ if (secure_audio == FALSE) {
+ ast_log(AST_LOG_NOTICE, "Processed audio crypto attribute without SAVP specified; accepting anyway\n");
+ secure_audio = TRUE;
+ }
} else if (process_sdp_a_audio(value, p, &newaudiortp, &last_rtpmap_codec)) {
processed = TRUE;
}
@@ -9206,6 +9210,10 @@
if (!processed_crypto && process_crypto(p, p->vrtp, &p->vsrtp, value)) {
processed_crypto = TRUE;
processed = TRUE;
+ if (secure_video == FALSE) {
+ ast_log(AST_LOG_NOTICE, "Processed video crypto attribute without SAVP specified; accepting anyway\n");
+ secure_video = TRUE;
+ }
} else if (process_sdp_a_video(value, p, &newvideortp, &last_rtpmap_codec)) {
processed = TRUE;
}
Modified: team/mjordan/1.8-srtp/channels/sip/sdp_crypto.c
URL: http://svnview.digium.com/svn/asterisk/team/mjordan/1.8-srtp/channels/sip/sdp_crypto.c?view=diff&rev=372147&r1=372132&r2=372147
==============================================================================
--- team/mjordan/1.8-srtp/channels/sip/sdp_crypto.c (original)
+++ team/mjordan/1.8-srtp/channels/sip/sdp_crypto.c Tue Sep 4 13:07:44 2012
@@ -49,6 +49,8 @@
char *a_crypto;
unsigned char local_key[SRTP_MASTER_LEN];
char local_key64[SRTP_MASTER_LEN64];
+ unsigned char remote_key[SRTP_MASTER_LEN];
+ char suite[64];
};
static int set_crypto_policy(struct ast_srtp_policy *policy, int suite_val, const unsigned char *master_key, unsigned long ssrc, int inbound);
@@ -257,11 +259,19 @@
return -1;
}
-
if ((key_len = ast_base64decode(remote_key, key_salt, sizeof(remote_key))) != SRTP_MASTER_LEN) {
- ast_log(LOG_WARNING, "SRTP sdescriptions key %d != %d\n", key_len, SRTP_MASTER_LEN);
- return -1;
- }
+ ast_log(LOG_WARNING, "SRTP descriptions key %d != %d\n", key_len, SRTP_MASTER_LEN);
+ return -1;
+ }
+
+ if (!memcmp(p->remote_key, remote_key, sizeof(p->remote_key))) {
+ ast_debug(1, "SRTP remote key unchanged; maintaining current policy\n");
+ return 0;
+ }
+
+ /* Set the accepted policy and remote key */
+ strcpy(p->suite, suite);
+ memcpy(p->remote_key, remote_key, sizeof(p->remote_key));
if (sdp_crypto_activate(p, suite_val, remote_key, rtp) < 0) {
return -1;
@@ -280,13 +290,17 @@
int sdp_crypto_offer(struct sdp_crypto *p)
{
char crypto_buf[128];
- const char *crypto_suite = "AES_CM_128_HMAC_SHA1_80"; /* Crypto offer */
+
+ if (ast_strlen_zero(p->suite)) {
+ /* Default crypto offer */
+ strcpy(p->suite, "AES_CM_128_HMAC_SHA1_80");
+ }
if (p->a_crypto) {
ast_free(p->a_crypto);
}
- if (snprintf(crypto_buf, sizeof(crypto_buf), "a=crypto:1 %s inline:%s\r\n", crypto_suite, p->local_key64) < 1) {
+ if (snprintf(crypto_buf, sizeof(crypto_buf), "a=crypto:1 %s inline:%s\r\n", p->suite, p->local_key64) < 1) {
return -1;
}
More information about the svn-commits
mailing list