]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
configure.ac: Add OpenSSL SipHash support detection
authorOndřej Surý <ondrej@sury.org>
Fri, 30 Aug 2019 13:32:11 +0000 (15:32 +0200)
committerOndřej Surý <ondrej@sury.org>
Tue, 3 Sep 2019 07:19:55 +0000 (09:19 +0200)
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.

config.h.in
configure
configure.ac

index eeba105ec6021222fd62d11895ae0979494e72a4..e2cf7e911e0ff9dc22d3bcbfa276149aba84f6ab 100644 (file)
 /* 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
 
index 757dacb06e316b0675280d8158035c0c0b47d644..33f4fd8a3c2283b8a88451d9671954b4f504080c 100755 (executable)
--- 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 <openssl/evp.h>
+                      #include <openssl/opensslv.h>
+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
 #
index b04c6519664105a00cc57ed280668091290bb916..9dacb39aa593b1ddb486dfbf0f658d147ea808d6 100644 (file)
@@ -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 <openssl/evp.h>
+                      #include <openssl/opensslv.h>]],
+                    [[#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
 #