From 1f136fe8859c8c4b42e9608bab01eab45d549a55 Mon Sep 17 00:00:00 2001 From: Sean Bright Date: Fri, 26 May 2017 12:15:42 -0400 Subject: res_srtp: Add support for libsrtp2 ASTERISK-25294 #close Reported by: Tzafrir Cohen ASTERISK-26976 #close Reported by: Alex Change-Id: I789b1c3d1ed31365bbd9339fa58ef36f48833c40 --- configure.ac | 93 +++++++++++++++++++++++++++++++++--------------------------- 1 file changed, 52 insertions(+), 41 deletions(-) (limited to 'configure.ac') diff --git a/configure.ac b/configure.ac index 3bfb82eea..9c07a4f6d 100644 --- a/configure.ac +++ b/configure.ac @@ -2476,53 +2476,64 @@ then AST_C_DEFINE_CHECK([SSL_OP_NO_TLSV1_2], [SSL_OP_NO_TLSv1_2], [openssl/ssl.h]) fi -AST_EXT_LIB_CHECK([SRTP], [srtp], [srtp_init], [srtp/srtp.h]) +AST_EXT_LIB_CHECK([SRTP], [srtp2], [srtp_init], [srtp2/srtp.h], [], [], [2]) +AST_EXT_LIB_CHECK_SHARED([SRTP], [srtp2], [srtp_init], [srtp2/srtp.h], [], [], [], [ + AC_MSG_WARN([***]) + AC_MSG_WARN([*** libsrtp2 could not be linked as a shared object.]) + AC_MSG_WARN([*** Try compiling libsrtp2 manually. Configure libsrtp2]) + AC_MSG_WARN([*** with ./configure --prefix=/usr replacing /usr with]) + AC_MSG_WARN([*** the prefix of your choice, and then make with]) + AC_MSG_WARN([*** 'make libsrtp2.so']) + AC_MSG_WARN([***]) + AC_MSG_WARN([*** After re-installing libsrtp2, re-run the Asterisk]) + AC_MSG_WARN([*** configure script.]) + AC_MSG_WARN([***]) + AC_MSG_WARN([*** If you do not need SRTP support re-run configure]) + AC_MSG_WARN([*** with the --without-srtp option.]) + exit 1 +]) -if test "$PBX_SRTP" = "1"; +if test "x$PBX_SRTP" = x1; then - saved_libs="${LIBS}" - saved_ldflags="${LDFLAGS}" - saved_cflags="${CFLAGS}" - LIBS="${LIBS} ${SRTP_LIB}" - LDFLAGS="${LDFLAGS} -shared -fPIC" - CFLAGS="${CFLAGS} ${SRTP_INCLUDE}" - AC_MSG_CHECKING(for the ability of -lsrtp to be linked in a shared object) - AC_LINK_IFELSE( - [ - AC_LANG_PROGRAM( - [#include ], - [srtp_init();] - ) - ], - [ AC_MSG_RESULT(yes) ], - [ - AC_MSG_RESULT(no) - AC_MSG_WARN(***) - AC_MSG_WARN(*** libsrtp could not be linked as a shared object.) - AC_MSG_WARN(*** Try compiling libsrtp manually. Configure libsrtp) - AC_MSG_WARN(*** with ./configure CFLAGS=-fPIC --prefix=/usr) - AC_MSG_WARN(*** replacing /usr with the prefix of your choice.) - AC_MSG_WARN(*** After re-installing libsrtp, re-run the Asterisk) - AC_MSG_WARN(*** configure script.) - AC_MSG_WARN(***) - AC_MSG_WARN(*** If you do not need SRTP support re-run configure) - AC_MSG_WARN(*** with the --without-srtp option.) - exit 1 - ] - ) - LIBS="${saved_libs}" - LDFLAGS="${saved_ldflags}" - CFLAGS="${saved_cflags}" + AST_EXT_LIB_CHECK([SRTP_256], [srtp2], [srtp_crypto_policy_set_aes_cm_256_hmac_sha1_80]) + AST_EXT_LIB_CHECK([SRTP_GCM], [srtp2], [srtp_crypto_policy_set_aes_gcm_128_8_auth]) + AST_EXT_LIB_CHECK([SRTP_SHUTDOWN], [srtp2], [srtp_shutdown], [srtp2/srtp.h]) + + # libsrtp2 removed support for PRNG, so we require OpenSSL + if test "x$PBX_OPENSSL" != x1; + then + AC_MSG_WARN([***]) + AC_MSG_WARN([*** OpenSSL required when using libsrtp2, checking for libsrtp instead.]) + AC_MSG_WARN([***]) + PBX_SRTP=0 + fi fi -if test "$PBX_SRTP" = "1"; +if test "x$PBX_SRTP" != x1; then - AST_EXT_LIB_CHECK([SRTP_256], [srtp], [crypto_policy_set_aes_cm_256_hmac_sha1_80]) - AST_EXT_LIB_CHECK([SRTP_192], [srtp], [crypto_policy_set_aes_cm_192_hmac_sha1_80]) - AST_EXT_LIB_CHECK([SRTP_GCM], [srtp], [aes_gcm_128_openssl]) -fi + AST_EXT_LIB_CHECK([SRTP], [srtp], [srtp_init], [srtp/srtp.h], [], [], [1]) + AST_EXT_LIB_CHECK_SHARED([SRTP], [srtp], [srtp_init], [srtp/srtp.h], [], [], [], [ + AC_MSG_WARN([***]) + AC_MSG_WARN([*** libsrtp could not be linked as a shared object.]) + AC_MSG_WARN([*** Try compiling libsrtp manually. Configure libsrtp]) + AC_MSG_WARN([*** with ./configure CFLAGS=-fPIC --prefix=/usr]) + AC_MSG_WARN([*** replacing /usr with the prefix of your choice.]) + AC_MSG_WARN([*** After re-installing libsrtp, re-run the Asterisk]) + AC_MSG_WARN([*** configure script.]) + AC_MSG_WARN([***]) + AC_MSG_WARN([*** If you do not need SRTP support re-run configure]) + AC_MSG_WARN([*** with the --without-srtp option.]) + exit 1 + ]) -AST_EXT_LIB_CHECK([SRTP_SHUTDOWN], [srtp], [srtp_shutdown], [srtp/srtp.h]) + if test "x$PBX_SRTP" = x1; + then + AST_EXT_LIB_CHECK([SRTP_256], [srtp], [crypto_policy_set_aes_cm_256_hmac_sha1_80]) + AST_EXT_LIB_CHECK([SRTP_192], [srtp], [crypto_policy_set_aes_cm_192_hmac_sha1_80]) + AST_EXT_LIB_CHECK([SRTP_GCM], [srtp], [crypto_policy_set_aes_gcm_128_8_auth]) + AST_EXT_LIB_CHECK([SRTP_SHUTDOWN], [srtp], [srtp_shutdown], [srtp/srtp.h]) + fi +fi for ver in 2.0 2.2 2.4 2.6; do AST_PKG_CONFIG_CHECK([GMIME], gmime-$ver) -- cgit v1.2.3