From: Ondřej Surý Date: Fri, 30 Aug 2019 13:32:11 +0000 (+0200) Subject: configure.ac: Add OpenSSL SipHash support detection X-Git-Tag: v9.15.4~15^2~1 X-Git-Url: http://git.ipfire.org/gitweb/index.cgi?a=commitdiff_plain;h=9b6c6f57d88232def3e76aaea862767f85ef669f;p=thirdparty%2Fbind9.git configure.ac: Add OpenSSL SipHash support detection Add check for creating new EVP_PKEY with EVP_PKEY_SIPHASH, but disable SipHash on OpenSSL 1.1.1 as the hash length initialization is broken before OpenSSL 1.1.1a release. --- diff --git a/config.h.in b/config.h.in index eeba105ec60..e2cf7e911e0 100644 --- a/config.h.in +++ b/config.h.in @@ -279,6 +279,9 @@ /* define if OpenSSL supports Ed448 */ #undef HAVE_OPENSSL_ED448 +/* define if OpenSSL supports SipHash */ +#undef HAVE_OPENSSL_SIPHASH + /* Define to 1 if you have the `processor_bind' function. */ #undef HAVE_PROCESSOR_BIND diff --git a/configure b/configure index 757dacb06e3..33f4fd8a3c2 100755 --- a/configure +++ b/configure @@ -16596,6 +16596,36 @@ $as_echo "no" >&6; } fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for SipHash support" >&5 +$as_echo_n "checking for SipHash support... " >&6; } +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + #include +int +main () +{ +#if OPENSSL_VERSION_NUMBER < 0x10101010L + #error OpenSSL >= 1.1.1a required for working SipHash initialization + #endif + EVP_PKEY *key = EVP_PKEY_new_raw_private_key( + EVP_PKEY_SIPHASH, NULL, NULL, 0); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + +$as_echo "#define HAVE_OPENSSL_SIPHASH 1" >>confdefs.h + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&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_ext + # # Check for OpenSSL SHA-1 support # diff --git a/configure.ac b/configure.ac index b04c6519664..9dacb39aa59 100644 --- a/configure.ac +++ b/configure.ac @@ -776,6 +776,19 @@ AC_COMPILE_IFELSE( AC_MSG_RESULT([yes])], [AC_MSG_RESULT([no])]) +AC_MSG_CHECKING([for SipHash support]) +AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM([[#include + #include ]], + [[#if OPENSSL_VERSION_NUMBER < 0x10101010L + #error OpenSSL >= 1.1.1a required for working SipHash initialization + #endif + EVP_PKEY *key = EVP_PKEY_new_raw_private_key( + EVP_PKEY_SIPHASH, NULL, NULL, 0);]])], + [AC_DEFINE([HAVE_OPENSSL_SIPHASH], [1], [define if OpenSSL supports SipHash]) + AC_MSG_RESULT([yes])], + [AC_MSG_RESULT([no])]) + # # Check for OpenSSL SHA-1 support #