diff options
author | Benny Prijono <bennylp@teluu.com> | 2008-01-30 09:47:57 +0000 |
---|---|---|
committer | Benny Prijono <bennylp@teluu.com> | 2008-01-30 09:47:57 +0000 |
commit | 920663005689e0776d893e69cef14ea6a35fcc59 (patch) | |
tree | 4da07269a36f20072a8ff9acc3c7ea6c5edffef7 /pjmedia | |
parent | b7c0c5a8e7f39da77e6bedf2361ade10314ddacc (diff) |
Ticket #61: undo r1759 and replace it with other patches to fix unable to accept RTP/AVP offer with a=crypto attribute when use_sdp is set to zero. Also minor fix to streamutil
git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@1760 74dad513-b988-da41-8d7b-12977e46ad98
Diffstat (limited to 'pjmedia')
-rw-r--r-- | pjmedia/src/pjmedia/transport_srtp.c | 21 |
1 files changed, 9 insertions, 12 deletions
diff --git a/pjmedia/src/pjmedia/transport_srtp.c b/pjmedia/src/pjmedia/transport_srtp.c index 19cc701d..ec6435fb 100644 --- a/pjmedia/src/pjmedia/transport_srtp.c +++ b/pjmedia/src/pjmedia/transport_srtp.c @@ -296,12 +296,12 @@ PJ_DEF(pj_status_t) pjmedia_transport_srtp_create( PJ_ASSERT_RETURN(endpt && p_tp, PJ_EINVAL); /* Check crypto availability */ - if (opt->crypto_count == 0 && + if (opt && opt->crypto_count == 0 && opt->use == PJMEDIA_SRTP_MANDATORY) return PJMEDIA_SRTP_ESDPREQCRYPTO; /* Check crypto */ - if (opt->use != PJMEDIA_SRTP_DISABLED) { + if (opt && opt->use != PJMEDIA_SRTP_DISABLED) { for (i=0; i < opt->crypto_count; ++i) { int cs_idx = get_crypto_idx(&opt->crypto[i].name); @@ -969,6 +969,7 @@ static pj_status_t transport_media_create(pjmedia_transport *tp, DEACTIVATE_MEDIA(pool, m_loc); return PJMEDIA_SRTP_ESDPINTRANSPORT; } + goto BYPASS_SRTP; } else if (srtp->setting.use == PJMEDIA_SRTP_OPTIONAL) { m_loc->desc.transport = m_rem->desc.transport; } else if (srtp->setting.use == PJMEDIA_SRTP_MANDATORY) { @@ -1013,14 +1014,6 @@ static pj_status_t transport_media_create(pjmedia_transport *tp, if (pj_stricmp(&m_rem->attr[i]->name, &ID_CRYPTO) != 0) continue; - /* SRTP is disabled but there is crypto attr in remote media */ - /* Put the checking here to save a bit memory for parsing */ - if (srtp->setting.use == PJMEDIA_SRTP_DISABLED) { - //DEACTIVATE_MEDIA(pool, m_loc); - //return PJMEDIA_SRTP_ESDPINTRANSPORT; - continue; - } - has_crypto_attr = PJ_TRUE; status = parse_attr_crypto(srtp->pool, m_rem->attr[i], @@ -1045,9 +1038,12 @@ static pj_status_t transport_media_create(pjmedia_transport *tp, int cs_idx = get_crypto_idx(&tmp_rx_crypto.name); /* Force to use test key */ + /* bad keys for snom: */ //char *hex_test_key = "58b29c5c8f42308120ce857e439f2d" // "7810a8b10ad0b1446be5470faea496"; - //pj_str_t* test_key = &srtp->setting.crypto[j].key; + //char *hex_test_key = "20a26aac7ba062d356ff52b61e3993" + // "ccb78078f12c64db94b9c294927fd0"; + //pj_str_t *test_key = &srtp->setting.crypto[j].key; //char *raw_test_key = pj_pool_zalloc(srtp->pool, 64); //hex_string_to_octet_string( // raw_test_key, @@ -1055,6 +1051,7 @@ static pj_status_t transport_media_create(pjmedia_transport *tp, // strlen(hex_test_key)); //pj_strset(test_key, raw_test_key, // crypto_suites[cs_idx].cipher_key_len); + /* EO Force to use test key */ if (tmp_rx_crypto.key.slen != (int)crypto_suites[cs_idx].cipher_key_len) @@ -1071,7 +1068,7 @@ static pj_status_t transport_media_create(pjmedia_transport *tp, } if (srtp->setting.use == PJMEDIA_SRTP_DISABLED) { - /* At this point, it is ensured remote has no crypto attr */ + /* bypass when remote uses RTP/AVP and we disable SRTP */ goto BYPASS_SRTP; } else if (srtp->setting.use == PJMEDIA_SRTP_OPTIONAL) { /* bypass SRTP when no crypto-attr but remote uses RTP/AVP */ |