]> git.ipfire.org Git - thirdparty/unbound.git/commitdiff
- Fix compile with openssl 1.1.0 with api=1.1.0.
authorWouter Wijngaards <wouter@nlnetlabs.nl>
Fri, 2 Sep 2016 09:59:09 +0000 (09:59 +0000)
committerWouter Wijngaards <wouter@nlnetlabs.nl>
Fri, 2 Sep 2016 09:59:09 +0000 (09:59 +0000)
git-svn-id: file:///svn/unbound/trunk@3844 be551aaa-1e26-0410-a405-d3ace91eadb9

13 files changed:
config.h.in
configure
configure.ac
daemon/daemon.c
daemon/remote.c
daemon/unbound.c
doc/Changelog
sldns/keyraw.c
smallapp/unbound-anchor.c
smallapp/unbound-control.c
testcode/petal.c
testcode/streamtcp.c
testcode/unitmain.c

index 9d02382fa8232d7aace9112077a9b6b979087c64..1e4ba124428baa99f0b9a5d24bf3d6817c0282be 100644 (file)
@@ -51,6 +51,9 @@
 /* Define to 1 if you have the `chroot' function. */
 #undef HAVE_CHROOT
 
+/* Define to 1 if you have the `CRYPTO_cleanup_all_ex_data' function. */
+#undef HAVE_CRYPTO_CLEANUP_ALL_EX_DATA
+
 /* Define to 1 if you have the `ctime_r' function. */
 #undef HAVE_CTIME_R
 
 /* Define to 1 if you have the `endservent' function. */
 #undef HAVE_ENDSERVENT
 
+/* Define to 1 if you have the `ERR_free_strings' function. */
+#undef HAVE_ERR_FREE_STRINGS
+
+/* Define to 1 if you have the `ERR_load_crypto_strings' function. */
+#undef HAVE_ERR_LOAD_CRYPTO_STRINGS
+
 /* Define to 1 if you have the `event_base_free' function. */
 #undef HAVE_EVENT_BASE_FREE
 
 /* Define to 1 if you have the <event.h> header file. */
 #undef HAVE_EVENT_H
 
+/* Define to 1 if you have the `EVP_cleanup' function. */
+#undef HAVE_EVP_CLEANUP
+
 /* Define to 1 if you have the `EVP_MD_CTX_new' function. */
 #undef HAVE_EVP_MD_CTX_NEW
 
 /* Use libnss for crypto */
 #undef HAVE_NSS
 
+/* Define to 1 if you have the `OpenSSL_add_all_algorithms' function. */
+#undef HAVE_OPENSSL_ADD_ALL_ALGORITHMS
+
+/* Define to 1 if you have the `OpenSSL_add_all_digests' function. */
+#undef HAVE_OPENSSL_ADD_ALL_DIGESTS
+
+/* Define to 1 if you have the <openssl/bn.h> header file. */
+#undef HAVE_OPENSSL_BN_H
+
 /* Define to 1 if you have the `OPENSSL_config' function. */
 #undef HAVE_OPENSSL_CONFIG
 
 /* Define to 1 if you have the <openssl/conf.h> header file. */
 #undef HAVE_OPENSSL_CONF_H
 
+/* Define to 1 if you have the <openssl/dh.h> header file. */
+#undef HAVE_OPENSSL_DH_H
+
+/* Define to 1 if you have the <openssl/dsa.h> header file. */
+#undef HAVE_OPENSSL_DSA_H
+
 /* Define to 1 if you have the <openssl/engine.h> header file. */
 #undef HAVE_OPENSSL_ENGINE_H
 
 /* Define to 1 if you have the <openssl/rand.h> header file. */
 #undef HAVE_OPENSSL_RAND_H
 
+/* Define to 1 if you have the <openssl/rsa.h> header file. */
+#undef HAVE_OPENSSL_RSA_H
+
 /* Define to 1 if you have the <openssl/ssl.h> header file. */
 #undef HAVE_OPENSSL_SSL_H
 
 /* Define to 1 if you have the `random' function. */
 #undef HAVE_RANDOM
 
+/* Define to 1 if you have the `RAND_cleanup' function. */
+#undef HAVE_RAND_CLEANUP
+
 /* Define to 1 if you have the `reallocarray' function. */
 #undef HAVE_REALLOCARRAY
 
 /* Define if you have the SSL libraries installed. */
 #undef HAVE_SSL
 
+/* Define to 1 if you have the `SSL_library_init' function. */
+#undef HAVE_SSL_LIBRARY_INIT
+
 /* Define to 1 if you have the <stdarg.h> header file. */
 #undef HAVE_STDARG_H
 
index 5541ff3a5b2a74c887167982342d3a8e443b7cb3..02ede56556dfd1aed3e31807a17d155f817cd314 100755 (executable)
--- a/configure
+++ b/configure
@@ -17430,11 +17430,11 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 #ifdef __cplusplus
 extern "C"
 #endif
-char OPENSSL_config ();
+char HMAC_Update ();
 int
 main ()
 {
-return OPENSSL_config ();
+return HMAC_Update ();
   ;
   return 0;
 }
@@ -17521,33 +17521,21 @@ else
        { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 fi
-for ac_header in openssl/conf.h
+for ac_header in openssl/conf.h openssl/engine.h openssl/bn.h openssl/dh.h openssl/dsa.h openssl/rsa.h
 do :
-  ac_fn_c_check_header_compile "$LINENO" "openssl/conf.h" "ac_cv_header_openssl_conf_h" "$ac_includes_default
-"
-if test "x$ac_cv_header_openssl_conf_h" = xyes; then :
-  cat >>confdefs.h <<_ACEOF
-#define HAVE_OPENSSL_CONF_H 1
-_ACEOF
-
-fi
-
-done
-
-for ac_header in openssl/engine.h
-do :
-  ac_fn_c_check_header_compile "$LINENO" "openssl/engine.h" "ac_cv_header_openssl_engine_h" "$ac_includes_default
+  as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
+ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default
 "
-if test "x$ac_cv_header_openssl_engine_h" = xyes; then :
+if eval test \"x\$"$as_ac_Header"\" = x"yes"; then :
   cat >>confdefs.h <<_ACEOF
-#define HAVE_OPENSSL_ENGINE_H 1
+#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
 _ACEOF
 
 fi
 
 done
 
-for ac_func in OPENSSL_config EVP_sha1 EVP_sha256 EVP_sha512 FIPS_mode EVP_MD_CTX_new
+for ac_func in OPENSSL_config EVP_sha1 EVP_sha256 EVP_sha512 FIPS_mode EVP_MD_CTX_new OpenSSL_add_all_digests EVP_cleanup ERR_load_crypto_strings OpenSSL_add_all_algorithms SSL_library_init CRYPTO_cleanup_all_ex_data ERR_free_strings RAND_cleanup
 do :
   as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
 ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
index 9e269246c27ba217262ac85e040d9d78da3dd54c..5aec63875e0fa41641b191d391fc2068d1e0c968 100644 (file)
@@ -653,7 +653,7 @@ SSLLIB="-lssl"
 BAKLIBS="$LIBS"
 LIBS="-lssl $LIBS"
 AC_MSG_CHECKING([if libssl needs -lcrypt32])
-AC_TRY_LINK_FUNC([OPENSSL_config], [
+AC_TRY_LINK_FUNC([HMAC_Update], [
        AC_MSG_RESULT([no])
        LIBS="$BAKLIBS"
 ], [
@@ -672,9 +672,8 @@ if grep VERSION_TEXT $ssldir/include/openssl/opensslv.h | grep "LibreSSL" >/dev/
 else
        AC_MSG_RESULT([no])
 fi
-AC_CHECK_HEADERS([openssl/conf.h],,, [AC_INCLUDES_DEFAULT])
-AC_CHECK_HEADERS([openssl/engine.h],,, [AC_INCLUDES_DEFAULT])
-AC_CHECK_FUNCS([OPENSSL_config EVP_sha1 EVP_sha256 EVP_sha512 FIPS_mode EVP_MD_CTX_new])
+AC_CHECK_HEADERS([openssl/conf.h openssl/engine.h openssl/bn.h openssl/dh.h openssl/dsa.h openssl/rsa.h],,, [AC_INCLUDES_DEFAULT])
+AC_CHECK_FUNCS([OPENSSL_config EVP_sha1 EVP_sha256 EVP_sha512 FIPS_mode EVP_MD_CTX_new OpenSSL_add_all_digests EVP_cleanup ERR_load_crypto_strings OpenSSL_add_all_algorithms SSL_library_init CRYPTO_cleanup_all_ex_data ERR_free_strings RAND_cleanup])
 AC_CHECK_DECLS([SSL_COMP_get_compression_methods,sk_SSL_COMP_pop_free,SSL_CTX_set_ecdh_auto], [], [], [
 AC_INCLUDES_DEFAULT
 #ifdef HAVE_OPENSSL_ERR_H
index b339e7db23940a4b687d2b0af1c95750978851b9..3fd06e241a95d196b7190ad1338a5cd9eb53d36c 100644 (file)
@@ -204,17 +204,29 @@ daemon_init(void)
        signal_handling_record();
        checklock_start();
 #ifdef HAVE_SSL
+#  ifdef HAVE_ERR_LOAD_CRYPTO_STRINGS
        ERR_load_crypto_strings();
+#  endif
        ERR_load_SSL_strings();
 #  ifdef USE_GOST
        (void)sldns_key_EVP_load_gost_id();
 #  endif
+#  ifdef HAVE_OPENSSL_ADD_ALL_ALGORITHMS
        OpenSSL_add_all_algorithms();
+#  else
+       OPENSSL_init_crypto(OPENSSL_INIT_ADD_ALL_CIPHERS
+               | OPENSSL_INIT_ADD_ALL_DIGESTS
+               | OPENSSL_INIT_LOAD_CRYPTO_STRINGS, NULL);
+#  endif
 #  if HAVE_DECL_SSL_COMP_GET_COMPRESSION_METHODS
        /* grab the COMP method ptr because openssl leaks it */
        comp_meth = (void*)SSL_COMP_get_compression_methods();
 #  endif
+#  ifdef HAVE_SSL_LIBRARY_INIT
        (void)SSL_library_init();
+#  else
+       (void)OPENSSL_init_ssl(0, NULL);
+#  endif
 #  if defined(HAVE_SSL) && defined(OPENSSL_THREADS) && !defined(THREADS_DISABLED)
        if(!ub_openssl_lock_init())
                fatal_exit("could not init openssl locks");
@@ -657,8 +669,12 @@ daemon_delete(struct daemon* daemon)
 #  endif
        CONF_modules_free();
 #  endif
+#  ifdef HAVE_CRYPTO_CLEANUP_ALL_EX_DATA
        CRYPTO_cleanup_all_ex_data(); /* safe, no more threads right now */
+#  endif
+#  ifdef HAVE_ERR_FREE_STRINGS
        ERR_free_strings();
+#  endif
 #  if OPENSSL_VERSION_NUMBER < 0x10100000
        RAND_cleanup();
 #  endif
index 4b38e4bc5c72e89650e32f14d2c1ef211e377825..4c8375f9046f3d749904292c570d4857cbaf5309 100644 (file)
 #ifdef HAVE_OPENSSL_ERR_H
 #include <openssl/err.h>
 #endif
-#ifndef HEADER_DH_H
+#ifdef HAVE_OPENSSL_DH_H
 #include <openssl/dh.h>
 #endif
+#ifdef HAVE_OPENSSL_BN_H
+#include <openssl/bn.h>
+#endif
 
 #include <ctype.h>
 #include "daemon/remote.h"
index fc3281e4ba26d9682f2742c77ec6908f35160bb5..7ec6edba1c6441e2c8c43b90eeb5aee96ccfaefc 100644 (file)
@@ -118,7 +118,11 @@ static void usage()
        printf("linked libs: %s %s (it uses %s), %s\n", 
                evnm, evsys, evmethod,
 #ifdef HAVE_SSL
+#  ifdef SSLEAY_VERSION
                SSLeay_version(SSLEAY_VERSION)
+#  else
+               OpenSSL_version(OPENSSL_VERSION)
+#  endif
 #elif defined(HAVE_NSS)
                NSS_GetVersion()
 #elif defined(HAVE_NETTLE)
index 56aaec94163e84bd86fab30f5996840a178dff21..46224de10deed412f0c6a48bda120fa363913776 100644 (file)
@@ -1,3 +1,6 @@
+2 September 2016: Wouter
+       - Fix compile with openssl 1.1.0 with api=1.1.0.
+
 1 September 2016: Wouter
        - RFC 7958 is now out, updated docs for unbound-anchor.
        - Fix for compile without warnings with openssl 1.1.0.
index 8b1c18f2b79daad643a8aa5514dfa9177a14f981..8498def7ef55c521b3a1b4ce9ee98ae3336b0699 100644 (file)
 #ifdef HAVE_OPENSSL_ENGINE_H
 #  include <openssl/engine.h>
 #endif
+#ifdef HAVE_OPENSSL_BN_H
+#include <openssl/bn.h>
+#endif
+#ifdef HAVE_OPENSSL_RSA_H
+#include <openssl/rsa.h>
+#endif
+#ifdef HAVE_OPENSSL_DSA_H
+#include <openssl/dsa.h>
+#endif
 #endif /* HAVE_SSL */
 
 size_t
index 756fcf7f089f7d8c55c196aba90c719bbdce494e..f5783e1b2addb1a2528363b7fe64ee3c29d6754c 100644 (file)
@@ -2311,10 +2311,22 @@ int main(int argc, char* argv[])
        if(argc != 0)
                usage();
 
+#ifdef HAVE_ERR_LOAD_CRYPTO_STRINGS
        ERR_load_crypto_strings();
+#endif
        ERR_load_SSL_strings();
+#ifdef HAVE_OPENSSL_ADD_ALL_ALGORITHMS
        OpenSSL_add_all_algorithms();
+#else
+       OPENSSL_init_crypto(OPENSSL_INIT_ADD_ALL_CIPHERS
+               | OPENSSL_INIT_ADD_ALL_DIGESTS
+               | OPENSSL_INIT_LOAD_CRYPTO_STRINGS, NULL);
+#endif
+#ifdef HAVE_SSL_LIBRARY_INIT
        (void)SSL_library_init();
+#else
+       (void)OPENSSL_init_ssl(0, NULL);
+#endif
 
        if(dolist) do_list_builtin();
 
index 23e265c7074ba88249092205a84b87afc50764da..9338f7d7579a6b2e92f4d1254d2981b1d3c693e4 100644 (file)
@@ -418,10 +418,22 @@ int main(int argc, char* argv[])
                cfgfile = CONFIGFILE;
 #endif
 
+#ifdef HAVE_ERR_LOAD_CRYPTO_STRINGS
        ERR_load_crypto_strings();
+#endif
        ERR_load_SSL_strings();
+#ifdef HAVE_OPENSSL_ADD_ALL_ALGORITHMS
        OpenSSL_add_all_algorithms();
+#else
+       OPENSSL_init_crypto(OPENSSL_INIT_ADD_ALL_CIPHERS
+               | OPENSSL_INIT_ADD_ALL_DIGESTS
+               | OPENSSL_INIT_LOAD_CRYPTO_STRINGS, NULL);
+#endif
+#ifdef HAVE_SSL_LIBRARY_INIT
        (void)SSL_library_init();
+#else
+       (void)OPENSSL_init_ssl(0, NULL);
+#endif
 
        if(!RAND_status()) {
                 /* try to seed it */
index 24d94a5569697ac6ef78a59a52ccfc7c3f385da9..8b8eccabdcf377a7019a0e3f33c0af142c2a7905 100644 (file)
@@ -634,14 +634,30 @@ int main(int argc, char* argv[])
 #ifdef SIGPIPE
        (void)signal(SIGPIPE, SIG_IGN);
 #endif
+#ifdef HAVE_ERR_LOAD_CRYPTO_STRINGS
        ERR_load_crypto_strings();
+#endif
        ERR_load_SSL_strings();
+#ifdef HAVE_OPENSSL_ADD_ALL_ALGORITHMS
        OpenSSL_add_all_algorithms();
+#else
+       OPENSSL_init_crypto(OPENSSL_INIT_ADD_ALL_CIPHERS
+               | OPENSSL_INIT_ADD_ALL_DIGESTS
+               | OPENSSL_INIT_LOAD_CRYPTO_STRINGS, NULL);
+#endif
+#ifdef HAVE_SSL_LIBRARY_INIT
        (void)SSL_library_init();
+#else
+       (void)OPENSSL_init_ssl(0, NULL);
+#endif
 
        do_service(addr, port, key, cert);
 
+#ifdef HAVE_CRYPTO_CLEANUP_ALL_EX_DATA
        CRYPTO_cleanup_all_ex_data();
+#endif
+#ifdef HAVE_ERR_FREE_STRINGS
        ERR_free_strings();
+#endif
        return 0;
 }
index b78506beb5df00b8c942c5abf2d0c3503c63ac45..626a6588545036a15eca5e09a69b87a2e69495ef 100644 (file)
@@ -406,8 +406,18 @@ int main(int argc, char** argv)
        }
        if(usessl) {
                ERR_load_SSL_strings();
+#ifdef HAVE_OPENSSL_ADD_ALL_ALGORITHMS
                OpenSSL_add_all_algorithms();
-               SSL_library_init();
+#else
+               OPENSSL_init_crypto(OPENSSL_INIT_ADD_ALL_CIPHERS
+                       | OPENSSL_INIT_ADD_ALL_DIGESTS
+                       | OPENSSL_INIT_LOAD_CRYPTO_STRINGS, NULL);
+#endif
+#ifdef HAVE_SSL_LIBRARY_INIT
+               (void)SSL_library_init();
+#else
+               (void)OPENSSL_init_ssl(0, NULL);
+#endif
        }
        send_em(svr, udp, usessl, noanswer, argc, argv);
        checklock_stop();
index 3daa7383f8ebf82af2affb0b9f4156843b1822da..988346a1efc9233a27bb586951f23425d74c9080 100644 (file)
@@ -588,7 +588,9 @@ main(int argc, char* argv[])
        }
        printf("Start of %s unit test.\n", PACKAGE_STRING);
 #ifdef HAVE_SSL
+#  ifdef HAVE_ERR_LOAD_CRYPTO_STRINGS
        ERR_load_crypto_strings();
+#  endif
 #  ifdef USE_GOST
        (void)sldns_key_EVP_load_gost_id();
 #  endif
@@ -623,13 +625,21 @@ main(int argc, char* argv[])
        sldns_key_EVP_unload_gost();
 #  endif
 #  ifdef HAVE_OPENSSL_CONFIG
+#  ifdef HAVE_EVP_CLEANUP
        EVP_cleanup();
+#  endif
        ENGINE_cleanup();
        CONF_modules_free();
 #  endif
+#  ifdef HAVE_CRYPTO_CLEANUP_ALL_EX_DATA
        CRYPTO_cleanup_all_ex_data();
+#  endif
+#  ifdef HAVE_ERR_FREE_STRINGS
        ERR_free_strings();
+#  endif
+#  ifdef HAVE_RAND_CLEANUP
        RAND_cleanup();
+#  endif
 #elif defined(HAVE_NSS)
        if(NSS_Shutdown() != SECSuccess)
                fatal_exit("could not shutdown NSS");