diff options
author | Liong Sauw Ming <ming@teluu.com> | 2016-11-16 05:53:23 +0000 |
---|---|---|
committer | Liong Sauw Ming <ming@teluu.com> | 2016-11-16 05:53:23 +0000 |
commit | 21a681c52e3e8c1fe95125a87363ee1f846a1ab9 (patch) | |
tree | dfdb16ebeb7918d8c7a8680652f358e8807a5e12 /aconfigure | |
parent | 273b7964359262ab42523ea657f3c5313c151988 (diff) |
Re #1975: Add autoconf detection of OpenSSL elliptic curve and sigalg support
git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@5483 74dad513-b988-da41-8d7b-12977e46ad98
Diffstat (limited to 'aconfigure')
-rwxr-xr-x | aconfigure | 124 |
1 files changed, 124 insertions, 0 deletions
@@ -641,9 +641,13 @@ opencore_amrnb_present opencore_amrnb_h_present ac_no_opencore_amrwb ac_no_opencore_amrnb +ec_curve_present +set_curve_present libcrypto_present libssl_present openssl_h_present +ac_ssl_has_sigalg +ac_ssl_has_ec ac_ssl_has_aes_gcm ac_no_ssl ac_openh264_ldflags @@ -5414,12 +5418,14 @@ if test "x$ac_cv_header_net_if_h" = xyes; then : fi + ac_fn_c_check_func "$LINENO" "localtime_r" "ac_cv_func_localtime_r" if test "x$ac_cv_func_localtime_r" = xyes; then : $as_echo "#define PJ_HAS_LOCALTIME_R 1" >>confdefs.h fi + { $as_echo "$as_me:${as_lineno-$LINENO}: result: Setting PJ_OS_NAME to $target" >&5 $as_echo "Setting PJ_OS_NAME to $target" >&6; } cat >>confdefs.h <<_ACEOF @@ -7783,6 +7789,10 @@ fi ac_ssl_has_aes_gcm=0 +ac_ssl_has_ec=0 + +ac_ssl_has_sigalg=0 + # Check whether --enable-ssl was given. if test "${enable_ssl+set}" = set; then : enableval=$enable_ssl; @@ -7945,6 +7955,120 @@ $as_echo "OpenSSL has AES GCM support, SRTP will use OpenSSL" >&6; } $as_echo "OpenSSL AES GCM support not found, SRTP will only support AES CM cryptos" >&6; } fi + # Check if OpenSSL supports setting curve algorithm + # and has elliptic curve + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking OpenSSL setting curve functions" >&5 +$as_echo_n "checking OpenSSL setting curve functions... " >&6; } + set_curve_present=0 + + ec_curve_present=0 + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include <openssl/ssl.h> + +int +main () +{ + SSL_set1_curves(NULL, NULL, 0); + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + set_curve_present=1 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: ok" >&5 +$as_echo "ok" >&6; } + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for EC_curve_nid2nist in -lssl" >&5 +$as_echo_n "checking for EC_curve_nid2nist in -lssl... " >&6; } +if ${ac_cv_lib_ssl_EC_curve_nid2nist+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lssl $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char EC_curve_nid2nist (); +int +main () +{ +return EC_curve_nid2nist (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_ssl_EC_curve_nid2nist=yes +else + ac_cv_lib_ssl_EC_curve_nid2nist=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_ssl_EC_curve_nid2nist" >&5 +$as_echo "$ac_cv_lib_ssl_EC_curve_nid2nist" >&6; } +if test "x$ac_cv_lib_ssl_EC_curve_nid2nist" = xyes; then : + ec_curve_present=1 +fi + + if test "x$set_curve_present" = "x1" -a "x$ec_curve_present" = "x1"; then + ac_ssl_has_ec=1 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: OpenSSL has elliptic curve support" >&5 +$as_echo "OpenSSL has elliptic curve support" >&6; } + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: OpenSSL elliptic curve algorithm unsupported" >&5 +$as_echo "OpenSSL elliptic curve algorithm unsupported" >&6; } + fi + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking OpenSSL setting sigalg" >&5 +$as_echo_n "checking OpenSSL setting sigalg... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include <openssl/ssl.h> + +int +main () +{ +SSL_set1_sigalgs_list(NULL, NULL); + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_ssl_has_sigalg=1 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: ok" >&5 +$as_echo "ok" >&6; } + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + # PJSIP_HAS_TLS_TRANSPORT setting follows PJ_HAS_SSL_SOCK #AC_DEFINE(PJSIP_HAS_TLS_TRANSPORT, 1) $as_echo "#define PJ_HAS_SSL_SOCK 1" >>confdefs.h |