summaryrefslogtreecommitdiff
path: root/openbsd-compat/openssl-compat.c
diff options
context:
space:
mode:
authorDarren Tucker <dtucker@dtucker.net>2018-11-16 14:11:44 +1100
committerDarren Tucker <dtucker@dtucker.net>2018-11-16 14:11:44 +1100
commitd0d1dfa55be1c5c0d77ab3096b198a64235f936d (patch)
tree2ffa51fb6aa1ad2c71656118071a37b024944ef0 /openbsd-compat/openssl-compat.c
parent6010c0303a422a9c5fa8860c061bf7105eb7f8b2 (diff)
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).
Diffstat (limited to 'openbsd-compat/openssl-compat.c')
-rw-r--r--openbsd-compat/openssl-compat.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/openbsd-compat/openssl-compat.c b/openbsd-compat/openssl-compat.c
index 590b66d1..5ade8f0b 100644
--- a/openbsd-compat/openssl-compat.c
+++ b/openbsd-compat/openssl-compat.c
@@ -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