Test for OPENSSL_init_crypto before using.

Check for the presence of OPENSSL_init_crypto and all the flags we want
before trying to use it (bz#2931).
This commit is contained in:
Darren Tucker 2018-11-16 14:11:44 +11:00
parent 6010c0303a
commit d0d1dfa55b
2 changed files with 7 additions and 3 deletions

View File

@ -2710,6 +2710,7 @@ if test "x$openssl" = "xyes" ; then
])
# LibreSSL/OpenSSL 1.1x API
AC_CHECK_FUNCS([ \
OPENSSL_init_crypto \
DH_get0_key \
DH_get0_pqg \
DH_set0_key \

View File

@ -76,11 +76,14 @@ ssh_OpenSSL_add_all_algorithms(void)
ENGINE_load_builtin_engines();
ENGINE_register_all_complete();
#if OPENSSL_VERSION_NUMBER < 0x10100000L
OPENSSL_config(NULL);
#else
#if defined(HAVE_OPENSSL_INIT_CRYPTO) && \
defined(OPENSSL_INIT_ADD_ALL_CIPHERS) && \
defined(OPENSSL_INIT_ADD_ALL_DIGESTS) && \
defined(OPENSSL_INIT_LOAD_CONFIG)
OPENSSL_init_crypto(OPENSSL_INIT_ADD_ALL_CIPHERS |
OPENSSL_INIT_ADD_ALL_DIGESTS | OPENSSL_INIT_LOAD_CONFIG, NULL);
#else
OPENSSL_config(NULL);
#endif
}
#endif