Changeset 5079


Ignore:
Timestamp:
Apr 23, 2015 11:58:22 PM (6 years ago)
Author:
ming
Message:

Re #1843: Add support if app uses external libSRTP 1.5.x or above (thanks to Alexander Traud for the patch)

File:
1 edited

Legend:

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

    r4728 r5079  
    3131#if defined(PJMEDIA_HAS_SRTP) && (PJMEDIA_HAS_SRTP != 0) 
    3232 
     33#if defined(PJ_HAS_SSL_SOCK) && (PJ_HAS_SSL_SOCK != 0) 
     34#  include <openssl/rand.h> 
     35 
     36/* Suppress compile warning of OpenSSL deprecation (OpenSSL is deprecated 
     37 * since MacOSX 10.7). 
     38 */ 
     39#if defined(PJ_DARWINOS) && PJ_DARWINOS==1 
     40#  pragma GCC diagnostic ignored "-Wdeprecated-declarations" 
     41#endif 
     42 
     43#endif 
     44 
    3345#if defined(PJMEDIA_EXTERNAL_SRTP) && (PJMEDIA_EXTERNAL_SRTP != 0) 
    3446#  include <srtp/srtp.h> 
     47#  include <srtp/crypto_kernel.h> 
    3548#else 
    3649#  include <srtp.h> 
     
    10851098            key_ok = PJ_TRUE; 
    10861099 
     1100 
     1101#if defined(PJ_HAS_SSL_SOCK) && (PJ_HAS_SSL_SOCK != 0) 
     1102            err = RAND_bytes((unsigned char*)key, 
     1103                             crypto_suites[cs_idx].cipher_key_len); 
     1104            if (err != 1) { 
     1105                PJ_LOG(5,(THIS_FILE, "Failed generating random key")); 
     1106                return PJMEDIA_ERRNO_FROM_LIBSRTP(1); 
     1107            } 
     1108#else        
    10871109            err = crypto_get_random((unsigned char*)key, 
    10881110                                     crypto_suites[cs_idx].cipher_key_len); 
     
    10921114                return PJMEDIA_ERRNO_FROM_LIBSRTP(err); 
    10931115            } 
     1116#endif 
    10941117            for (i=0; i<crypto_suites[cs_idx].cipher_key_len && key_ok; ++i) 
    10951118                if (key[i] == 0) key_ok = PJ_FALSE; 
Note: See TracChangeset for help on using the changeset viewer.