Changeset 1760


Ignore:
Timestamp:
Jan 30, 2008 9:47:57 AM (16 years ago)
Author:
bennylp
Message:

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

Location:
pjproject/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjmedia/src/pjmedia/transport_srtp.c

    r1759 r1760  
    297297 
    298298    /* Check crypto availability */ 
    299     if (opt->crypto_count == 0 &&  
     299    if (opt && opt->crypto_count == 0 &&  
    300300        opt->use == PJMEDIA_SRTP_MANDATORY) 
    301301        return PJMEDIA_SRTP_ESDPREQCRYPTO; 
    302302 
    303303    /* Check crypto */ 
    304     if (opt->use != PJMEDIA_SRTP_DISABLED) { 
     304    if (opt && opt->use != PJMEDIA_SRTP_DISABLED) { 
    305305        for (i=0; i < opt->crypto_count; ++i) { 
    306306            int cs_idx = get_crypto_idx(&opt->crypto[i].name); 
     
    970970                return PJMEDIA_SRTP_ESDPINTRANSPORT; 
    971971            } 
     972            goto BYPASS_SRTP; 
    972973        } else if (srtp->setting.use == PJMEDIA_SRTP_OPTIONAL) { 
    973974                m_loc->desc.transport = m_rem->desc.transport; 
     
    10131014            if (pj_stricmp(&m_rem->attr[i]->name, &ID_CRYPTO) != 0) 
    10141015                continue; 
    1015  
    1016             /* SRTP is disabled but there is crypto attr in remote media */ 
    1017             /* Put the checking here to save a bit memory for parsing */ 
    1018             if (srtp->setting.use == PJMEDIA_SRTP_DISABLED) { 
    1019                 //DEACTIVATE_MEDIA(pool, m_loc); 
    1020                 //return PJMEDIA_SRTP_ESDPINTRANSPORT; 
    1021                 continue; 
    1022             } 
    10231016 
    10241017            has_crypto_attr = PJ_TRUE; 
     
    10461039 
    10471040                        /* Force to use test key */ 
     1041                        /* bad keys for snom: */ 
    10481042                        //char *hex_test_key = "58b29c5c8f42308120ce857e439f2d" 
    10491043                        //                   "7810a8b10ad0b1446be5470faea496"; 
    1050                         //pj_str_t* test_key = &srtp->setting.crypto[j].key; 
     1044                        //char *hex_test_key = "20a26aac7ba062d356ff52b61e3993" 
     1045                        //                   "ccb78078f12c64db94b9c294927fd0"; 
     1046                        //pj_str_t *test_key = &srtp->setting.crypto[j].key; 
    10511047                        //char  *raw_test_key = pj_pool_zalloc(srtp->pool, 64); 
    10521048                        //hex_string_to_octet_string( 
     
    10561052                        //pj_strset(test_key, raw_test_key,  
    10571053                        //        crypto_suites[cs_idx].cipher_key_len); 
     1054                        /* EO Force to use test key */ 
    10581055 
    10591056                        if (tmp_rx_crypto.key.slen !=  
     
    10721069 
    10731070        if (srtp->setting.use == PJMEDIA_SRTP_DISABLED) { 
    1074             /* At this point, it is ensured remote has no crypto attr */ 
     1071            /* bypass when remote uses RTP/AVP and we disable SRTP */ 
    10751072            goto BYPASS_SRTP; 
    10761073        } else if (srtp->setting.use == PJMEDIA_SRTP_OPTIONAL) { 
  • pjproject/trunk/pjsip-apps/src/samples/streamutil.c

    r1735 r1760  
    2929 * \includelineno streamutil.c 
    3030 */ 
     31 
     32#include <pjlib.h> 
     33#include <pjlib-util.h> 
     34#include <pjmedia.h> 
     35#include <pjmedia-codec.h> 
     36#include <pjmedia/transport_srtp.h> 
     37 
     38#include <stdlib.h>     /* atoi() */ 
     39#include <stdio.h> 
     40 
     41#include "util.h" 
    3142 
    3243 
     
    7182 
    7283 
    73  
    74 #include <pjlib.h> 
    75 #include <pjlib-util.h> 
    76 #include <pjmedia.h> 
    77 #include <pjmedia-codec.h> 
    78 #include <pjmedia/transport_srtp.h> 
    79  
    80 #include <stdlib.h>     /* atoi() */ 
    81 #include <stdio.h> 
    82  
    83 #include "util.h" 
    8484 
    8585 
Note: See TracChangeset for help on using the changeset viewer.