From: Wouter Wijngaards Date: Thu, 15 Sep 2016 12:03:10 +0000 (+0000) Subject: - Test for openssl init_crypto and init_ssl functions. X-Git-Tag: release-1.5.10~5 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=42d2190343bd44a47e999bd56805b36f73f56754;p=thirdparty%2Funbound.git - Test for openssl init_crypto and init_ssl functions. git-svn-id: file:///svn/unbound/trunk@3860 be551aaa-1e26-0410-a405-d3ace91eadb9 --- diff --git a/config.h.in b/config.h.in index 245ea490f..04fc74396 100644 --- a/config.h.in +++ b/config.h.in @@ -299,6 +299,12 @@ /* Define to 1 if you have the header file. */ #undef HAVE_OPENSSL_ERR_H +/* Define to 1 if you have the `OPENSSL_init_crypto' function. */ +#undef HAVE_OPENSSL_INIT_CRYPTO + +/* Define to 1 if you have the `OPENSSL_init_ssl' function. */ +#undef HAVE_OPENSSL_INIT_SSL + /* Define to 1 if you have the header file. */ #undef HAVE_OPENSSL_RAND_H diff --git a/configure b/configure index b5a9f4941..b852a7e6c 100755 --- a/configure +++ b/configure @@ -17535,7 +17535,7 @@ fi done -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 CRYPTO_cleanup_all_ex_data ERR_free_strings RAND_cleanup +for ac_func in OPENSSL_config EVP_sha1 EVP_sha256 EVP_sha512 FIPS_mode EVP_MD_CTX_new OpenSSL_add_all_digests OPENSSL_init_crypto OPENSSL_init_ssl EVP_cleanup ERR_load_crypto_strings 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" diff --git a/configure.ac b/configure.ac index 1bf36630e..c582ef1f3 100644 --- a/configure.ac +++ b/configure.ac @@ -673,7 +673,7 @@ else AC_MSG_RESULT([no]) fi 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 CRYPTO_cleanup_all_ex_data ERR_free_strings RAND_cleanup]) +AC_CHECK_FUNCS([OPENSSL_config EVP_sha1 EVP_sha256 EVP_sha512 FIPS_mode EVP_MD_CTX_new OpenSSL_add_all_digests OPENSSL_init_crypto OPENSSL_init_ssl EVP_cleanup ERR_load_crypto_strings 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 diff --git a/daemon/daemon.c b/daemon/daemon.c index 66f705905..2ed9af8fe 100644 --- a/daemon/daemon.c +++ b/daemon/daemon.c @@ -211,7 +211,7 @@ daemon_init(void) # ifdef USE_GOST (void)sldns_key_EVP_load_gost_id(); # endif -# if OPENSSL_VERSION_NUMBER < 0x10100000 +# if OPENSSL_VERSION_NUMBER < 0x10100000 || !defined(HAVE_OPENSSL_INIT_CRYPTO) OpenSSL_add_all_algorithms(); # else OPENSSL_init_crypto(OPENSSL_INIT_ADD_ALL_CIPHERS @@ -222,7 +222,7 @@ daemon_init(void) /* grab the COMP method ptr because openssl leaks it */ comp_meth = (void*)SSL_COMP_get_compression_methods(); # endif -# if OPENSSL_VERSION_NUMBER < 0x10100000 +# if OPENSSL_VERSION_NUMBER < 0x10100000 || !defined(HAVE_OPENSSL_INIT_SSL) (void)SSL_library_init(); # else (void)OPENSSL_init_ssl(0, NULL); diff --git a/doc/Changelog b/doc/Changelog index 35cff7d6d..76966c233 100644 --- a/doc/Changelog +++ b/doc/Changelog @@ -1,5 +1,6 @@ 15 September 2016: Wouter - Fix 883: error for duplicate local zone entry. + - Test for openssl init_crypto and init_ssl functions. 15 September 2016: Ralph - fix potential memory leak in daemon/remote.c and nullpointer diff --git a/smallapp/unbound-anchor.c b/smallapp/unbound-anchor.c index 08b8641a4..00ab5e2ae 100644 --- a/smallapp/unbound-anchor.c +++ b/smallapp/unbound-anchor.c @@ -2315,14 +2315,14 @@ int main(int argc, char* argv[]) ERR_load_crypto_strings(); #endif ERR_load_SSL_strings(); -#if OPENSSL_VERSION_NUMBER < 0x10100000 +#if OPENSSL_VERSION_NUMBER < 0x10100000 || !defined(HAVE_OPENSSL_INIT_CRYPTO) 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 OPENSSL_VERSION_NUMBER < 0x10100000 +#if OPENSSL_VERSION_NUMBER < 0x10100000 || !defined(HAVE_OPENSSL_INIT_SSL) (void)SSL_library_init(); #else (void)OPENSSL_init_ssl(0, NULL); diff --git a/smallapp/unbound-control.c b/smallapp/unbound-control.c index ffaf5e04d..19268edab 100644 --- a/smallapp/unbound-control.c +++ b/smallapp/unbound-control.c @@ -422,14 +422,14 @@ int main(int argc, char* argv[]) ERR_load_crypto_strings(); #endif ERR_load_SSL_strings(); -#if OPENSSL_VERSION_NUMBER < 0x10100000 +#if OPENSSL_VERSION_NUMBER < 0x10100000 || !defined(HAVE_OPENSSL_INIT_CRYPTO) 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 OPENSSL_VERSION_NUMBER < 0x10100000 +#if OPENSSL_VERSION_NUMBER < 0x10100000 || !defined(HAVE_OPENSSL_INIT_SSL) (void)SSL_library_init(); #else (void)OPENSSL_init_ssl(0, NULL); diff --git a/testcode/petal.c b/testcode/petal.c index be8f3bde0..b30549365 100644 --- a/testcode/petal.c +++ b/testcode/petal.c @@ -644,14 +644,14 @@ int main(int argc, char* argv[]) ERR_load_crypto_strings(); #endif ERR_load_SSL_strings(); -#if OPENSSL_VERSION_NUMBER < 0x10100000 +#if OPENSSL_VERSION_NUMBER < 0x10100000 || !defined(HAVE_OPENSSL_INIT_CRYPTO) 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 OPENSSL_VERSION_NUMBER < 0x10100000 +#if OPENSSL_VERSION_NUMBER < 0x10100000 || !defined(HAVE_OPENSSL_INIT_SSL) (void)SSL_library_init(); #else (void)OPENSSL_init_ssl(0, NULL); diff --git a/testcode/streamtcp.c b/testcode/streamtcp.c index e7d18e629..05dcf98a8 100644 --- a/testcode/streamtcp.c +++ b/testcode/streamtcp.c @@ -406,14 +406,14 @@ int main(int argc, char** argv) } if(usessl) { ERR_load_SSL_strings(); -#if OPENSSL_VERSION_NUMBER < 0x10100000 +#if OPENSSL_VERSION_NUMBER < 0x10100000 || !defined(HAVE_OPENSSL_INIT_CRYPTO) 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 OPENSSL_VERSION_NUMBER < 0x10100000 +#if OPENSSL_VERSION_NUMBER < 0x10100000 || !defined(HAVE_OPENSSL_INIT_SSL) (void)SSL_library_init(); #else (void)OPENSSL_init_ssl(0, NULL);