Changeset 5656


Ignore:
Timestamp:
Sep 22, 2017 2:42:22 AM (22 months ago)
Author:
ming
Message:

Re #1993: With the update of bundled libSRTP to 2.1, external SRTP needs to be of version 2.x as well. This changeset will allow external SRTP users the option to continue using their current version 1.x.

  • Also add autodetection of external SRTP version via the configure script.

Thanks to Alexander Traud for the report.

Location:
pjproject/trunk
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/aconfigure

    r5630 r5656  
    691691ac_srtp_shutdown_present 
    692692ac_srtp_deinit_present 
     693ac_external_srtp_lib 
    693694ac_external_srtp 
    694695ac_external_gsm 
     
    758759oldincludedir 
    759760includedir 
    760 runstatedir 
    761761localstatedir 
    762762sharedstatedir 
     
    883883sharedstatedir='${prefix}/com' 
    884884localstatedir='${prefix}/var' 
    885 runstatedir='${localstatedir}/run' 
    886885includedir='${prefix}/include' 
    887886oldincludedir='/usr/include' 
     
    11361135    silent=yes ;; 
    11371136 
    1138   -runstatedir | --runstatedir | --runstatedi | --runstated \ 
    1139   | --runstate | --runstat | --runsta | --runst | --runs \ 
    1140   | --run | --ru | --r) 
    1141     ac_prev=runstatedir ;; 
    1142   -runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \ 
    1143   | --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \ 
    1144   | --run=* | --ru=* | --r=*) 
    1145     runstatedir=$ac_optarg ;; 
    1146  
    11471137  -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) 
    11481138    ac_prev=sbindir ;; 
     
    12821272                datadir sysconfdir sharedstatedir localstatedir includedir \ 
    12831273                oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ 
    1284                 libdir localedir mandir runstatedir 
     1274                libdir localedir mandir 
    12851275do 
    12861276  eval ac_val=\$$ac_var 
     
    14351425  --sharedstatedir=DIR    modifiable architecture-independent data [PREFIX/com] 
    14361426  --localstatedir=DIR     modifiable single-machine data [PREFIX/var] 
    1437   --runstatedir=DIR       modifiable per-process data [LOCALSTATEDIR/run] 
    14381427  --libdir=DIR            object code libraries [EPREFIX/lib] 
    14391428  --includedir=DIR        C header files [PREFIX/include] 
     
    60105999 
    60116000 
     6001 
    60126002# Check whether --with-external-srtp was given. 
    60136003if test "${with_external_srtp+set}" = set; then : 
     
    60196009                cat confdefs.h - <<_ACEOF >conftest.$ac_ext 
    60206010/* end confdefs.h.  */ 
    6021 #include <srtp/srtp.h> 
     6011#include <srtp2/srtp.h> 
    60226012 
    60236013int 
     
    60306020_ACEOF 
    60316021if ac_fn_c_try_compile "$LINENO"; then : 
    6032   { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes!!" >&5 
    6033 $as_echo "yes!!" >&6; } 
     6022  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes: version 2.x" >&5 
     6023$as_echo "yes: version 2.x" >&6; } 
     6024                                   ac_external_srtp="2" 
     6025                                   ac_external_srtp_lib="srtp2" 
     6026 
     6027else 
     6028  cat confdefs.h - <<_ACEOF >conftest.$ac_ext 
     6029/* end confdefs.h.  */ 
     6030#include <srtp/srtp.h> 
     6031 
     6032int 
     6033main () 
     6034{ 
     6035srtp_init(); 
     6036  ; 
     6037  return 0; 
     6038} 
     6039_ACEOF 
     6040if ac_fn_c_try_compile "$LINENO"; then : 
     6041  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes: version 1.x" >&5 
     6042$as_echo "yes: version 1.x" >&6; } 
    60346043                                   ac_external_srtp="1" 
     6044                                   ac_external_srtp_lib="srtp" 
    60356045 
    60366046else 
    60376047  as_fn_error $? "Unable to use SRTP. If SRTP development files are not available in the default locations, use CFLAGS and LDFLAGS env var to set the include/lib paths" "$LINENO" 5 
     6048fi 
     6049rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext 
    60386050fi 
    60396051rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext 
     
    60446056 
    60456057 
    6046 if test "x$ac_external_srtp" = "x1"; then 
     6058if test "x$ac_external_srtp" != "x0"; then 
    60476059        ac_srtp_deinit_present=0 
    60486060 
    60496061        ac_srtp_shutdown_present=0 
    60506062 
    6051         { $as_echo "$as_me:${as_lineno-$LINENO}: checking for srtp_deinit in -lsrtp" >&5 
    6052 $as_echo_n "checking for srtp_deinit in -lsrtp... " >&6; } 
    6053 if ${ac_cv_lib_srtp_srtp_deinit+:} false; then : 
     6063        as_ac_Lib=`$as_echo "ac_cv_lib_$ac_external_srtp_lib''_srtp_deinit" | $as_tr_sh` 
     6064{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for srtp_deinit in -l$ac_external_srtp_lib" >&5 
     6065$as_echo_n "checking for srtp_deinit in -l$ac_external_srtp_lib... " >&6; } 
     6066if eval \${$as_ac_Lib+:} false; then : 
    60546067  $as_echo_n "(cached) " >&6 
    60556068else 
    60566069  ac_check_lib_save_LIBS=$LIBS 
    6057 LIBS="-lsrtp  $LIBS" 
     6070LIBS="-l$ac_external_srtp_lib  $LIBS" 
    60586071cat confdefs.h - <<_ACEOF >conftest.$ac_ext 
    60596072/* end confdefs.h.  */ 
     
    60756088_ACEOF 
    60766089if ac_fn_c_try_link "$LINENO"; then : 
    6077   ac_cv_lib_srtp_srtp_deinit=yes 
    6078 else 
    6079   ac_cv_lib_srtp_srtp_deinit=no 
     6090  eval "$as_ac_Lib=yes" 
     6091else 
     6092  eval "$as_ac_Lib=no" 
    60806093fi 
    60816094rm -f core conftest.err conftest.$ac_objext \ 
     
    60836096LIBS=$ac_check_lib_save_LIBS 
    60846097fi 
    6085 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_srtp_srtp_deinit" >&5 
    6086 $as_echo "$ac_cv_lib_srtp_srtp_deinit" >&6; } 
    6087 if test "x$ac_cv_lib_srtp_srtp_deinit" = xyes; then : 
     6098eval ac_res=\$$as_ac_Lib 
     6099               { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 
     6100$as_echo "$ac_res" >&6; } 
     6101if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then : 
    60886102  ac_srtp_deinit_present=1 
    60896103fi 
    60906104 
    60916105        if test "x$ac_srtp_deinit_present" != "x1"; then 
    6092                 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for srtp_shutdown in -lsrtp" >&5 
    6093 $as_echo_n "checking for srtp_shutdown in -lsrtp... " >&6; } 
    6094 if ${ac_cv_lib_srtp_srtp_shutdown+:} false; then : 
     6106                as_ac_Lib=`$as_echo "ac_cv_lib_$ac_external_srtp_lib''_srtp_shutdown" | $as_tr_sh` 
     6107{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for srtp_shutdown in -l$ac_external_srtp_lib" >&5 
     6108$as_echo_n "checking for srtp_shutdown in -l$ac_external_srtp_lib... " >&6; } 
     6109if eval \${$as_ac_Lib+:} false; then : 
    60956110  $as_echo_n "(cached) " >&6 
    60966111else 
    60976112  ac_check_lib_save_LIBS=$LIBS 
    6098 LIBS="-lsrtp  $LIBS" 
     6113LIBS="-l$ac_external_srtp_lib  $LIBS" 
    60996114cat confdefs.h - <<_ACEOF >conftest.$ac_ext 
    61006115/* end confdefs.h.  */ 
     
    61166131_ACEOF 
    61176132if ac_fn_c_try_link "$LINENO"; then : 
    6118   ac_cv_lib_srtp_srtp_shutdown=yes 
    6119 else 
    6120   ac_cv_lib_srtp_srtp_shutdown=no 
     6133  eval "$as_ac_Lib=yes" 
     6134else 
     6135  eval "$as_ac_Lib=no" 
    61216136fi 
    61226137rm -f core conftest.err conftest.$ac_objext \ 
     
    61246139LIBS=$ac_check_lib_save_LIBS 
    61256140fi 
    6126 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_srtp_srtp_shutdown" >&5 
    6127 $as_echo "$ac_cv_lib_srtp_srtp_shutdown" >&6; } 
    6128 if test "x$ac_cv_lib_srtp_srtp_shutdown" = xyes; then : 
     6141eval ac_res=\$$as_ac_Lib 
     6142               { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 
     6143$as_echo "$ac_res" >&6; } 
     6144if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then : 
    61296145  ac_srtp_shutdown_present=1 
    61306146fi 
  • pjproject/trunk/aconfigure.ac

    r5630 r5656  
    567567dnl # Use external SRTP installation 
    568568AC_SUBST(ac_external_srtp,0) 
     569AC_SUBST(ac_external_srtp_lib) 
    569570AC_ARG_WITH(external-srtp, 
    570571    AS_HELP_STRING([--with-external-srtp], 
     
    574575                # Test SRTP installation 
    575576                AC_MSG_CHECKING([if external SRTP devkit is installed]) 
    576                 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <srtp/srtp.h> 
     577                AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <srtp2/srtp.h> 
    577578                                                     ]], 
    578579                                                  [srtp_init();])], 
    579                                   [AC_MSG_RESULT(yes!!) 
     580                                  [AC_MSG_RESULT(yes: version 2.x) 
     581                                   ac_external_srtp="2" 
     582                                   ac_external_srtp_lib="srtp2" 
     583                                   ], 
     584                                  [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <srtp/srtp.h> 
     585                                                     ]], 
     586                                                  [srtp_init();])], 
     587                                  [AC_MSG_RESULT(yes: version 1.x) 
    580588                                   ac_external_srtp="1" 
     589                                   ac_external_srtp_lib="srtp" 
    581590                                   ], 
    582                                   [AC_MSG_ERROR([Unable to use SRTP. If SRTP development files are not available in the default locations, use CFLAGS and LDFLAGS env var to set the include/lib paths])]) 
     591                                  [AC_MSG_ERROR([Unable to use SRTP. If SRTP development files are not available in the default locations, use CFLAGS and LDFLAGS env var to set the include/lib paths])])]) 
    583592        fi 
    584593    ] 
     
    586595 
    587596dnl # For external SRTP, check availability of srtp_deinit() or srtp_shutdown() 
    588 if test "x$ac_external_srtp" = "x1"; then 
     597if test "x$ac_external_srtp" != "x0"; then 
    589598        AC_SUBST(ac_srtp_deinit_present,0) 
    590599        AC_SUBST(ac_srtp_shutdown_present,0) 
    591         AC_CHECK_LIB(srtp,srtp_deinit,[ac_srtp_deinit_present=1]) 
     600        AC_CHECK_LIB($ac_external_srtp_lib,srtp_deinit,[ac_srtp_deinit_present=1]) 
    592601        if test "x$ac_srtp_deinit_present" != "x1"; then 
    593                 AC_CHECK_LIB(srtp,srtp_shutdown,[ac_srtp_shutdown_present=1]) 
     602                AC_CHECK_LIB($ac_external_srtp_lib,srtp_shutdown,[ac_srtp_shutdown_present=1]) 
    594603        fi 
    595604fi 
  • pjproject/trunk/build.mak.in

    r5606 r5656  
    2929export APP_THIRD_PARTY_LIB_FILES := 
    3030 
    31 ifeq (@ac_external_srtp@,1) 
     31ifneq (@ac_external_srtp@,0) 
    3232# External SRTP library 
    33 APP_THIRD_PARTY_EXT += -lsrtp 
     33APP_THIRD_PARTY_EXT += -l@ac_external_srtp_lib@ 
    3434else 
    3535APP_THIRD_PARTY_LIB_FILES += $(PJ_DIR)/third_party/lib/libsrtp-$(LIB_SUFFIX) 
  • pjproject/trunk/pjmedia/build/os-auto.mak.in

    r5630 r5656  
    149149# SRTP 
    150150# 
    151 ifeq (@ac_external_srtp@,1) 
     151ifneq (@ac_external_srtp@,0) 
    152152# External SRTP 
    153 export CFLAGS += -DPJMEDIA_EXTERNAL_SRTP=1 
     153export CFLAGS += -DPJMEDIA_EXTERNAL_SRTP=@ac_external_srtp@ 
    154154# SRTP srtp_deinit()/srtp_shutdown() API availability settings 
    155155export CFLAGS += -DPJMEDIA_SRTP_HAS_DEINIT=@ac_srtp_deinit_present@ \ 
  • pjproject/trunk/pjmedia/src/pjmedia/transport_srtp.c

    r5640 r5656  
    4545#endif 
    4646 
    47 #if defined(PJMEDIA_EXTERNAL_SRTP) && (PJMEDIA_EXTERNAL_SRTP != 0) 
     47#if defined(PJMEDIA_EXTERNAL_SRTP) 
     48 
     49#if (PJMEDIA_EXTERNAL_SRTP == 1)        /* External SRTP 1.x */ 
    4850#  include <srtp/srtp.h> 
    4951#  include <srtp/crypto_kernel.h> 
    50 #else 
     52#define srtp_crypto_policy_t            crypto_policy_t 
     53#define srtp_cipher_type_id_t           cipher_type_id_t 
     54#define srtp_cipher_type_t              cipher_type_t 
     55#define srtp_auth_type_id_t             auth_type_id_t 
     56#define srtp_sec_serv_t                 sec_serv_t 
     57#define srtp_err_status_t               err_status_t 
     58#define srtp_err_status_ok              err_status_ok 
     59#define srtp_err_status_replay_old      err_status_replay_old 
     60#define srtp_err_status_replay_fail     err_status_replay_fail 
     61#define srtp_crypto_policy_set_aes_cm_256_hmac_sha1_32 \ 
     62             crypto_policy_set_aes_cm_256_hmac_sha1_32 
     63#define srtp_crypto_policy_set_aes_cm_256_hmac_sha1_80 \ 
     64             crypto_policy_set_aes_cm_256_hmac_sha1_80 
     65#define SRTP_NULL_CIPHER                NULL_CIPHER 
     66#define SRTP_NULL_AUTH                  NULL_AUTH 
     67#define SRTP_AES_ICM_128                AES_ICM 
     68#define SRTP_AES_ICM_256                AES_ICM 
     69#define SRTP_HMAC_SHA1                  HMAC_SHA1 
     70 
     71#else                                   /* External SRTP 2.x */ 
     72#  include <srtp2/srtp.h> 
     73#  include <srtp2/cipher.h> 
     74#endif 
     75 
     76#else                                   /* Bundled SRTP */ 
    5177#  include <srtp.h> 
    5278#  include <crypto_kernel.h> 
  • pjproject/trunk/third_party/build/os-auto.mak.in

    r5614 r5656  
    4040endif 
    4141 
    42 ifeq (@ac_external_srtp@,1) 
     42ifneq (@ac_external_srtp@,0) 
    4343# External SRTP 
    4444else 
Note: See TracChangeset for help on using the changeset viewer.