summaryrefslogtreecommitdiff
path: root/src/common/crypto.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/common/crypto.c')
-rw-r--r--src/common/crypto.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/common/crypto.c b/src/common/crypto.c
index 9fcd17742c..c98a968757 100644
--- a/src/common/crypto.c
+++ b/src/common/crypto.c
@@ -43,6 +43,7 @@ DISABLE_GCC_WARNING(redundant-decls)
#include <openssl/dh.h>
#include <openssl/conf.h>
#include <openssl/hmac.h>
+#include <openssl/ssl.h>
ENABLE_GCC_WARNING(redundant-decls)
@@ -204,8 +205,15 @@ crypto_early_init(void)
crypto_early_initialized_ = 1;
+#if OPENSSL_VERSION_NUMBER >= OPENSSL_V_SERIES(1,1,0)
+ OPENSSL_init_ssl(OPENSSL_INIT_LOAD_SSL_STRINGS |
+ OPENSSL_INIT_LOAD_CRYPTO_STRINGS |
+ OPENSSL_INIT_ADD_ALL_CIPHERS |
+ OPENSSL_INIT_ADD_ALL_DIGESTS, NULL);
+#else
ERR_load_crypto_strings();
OpenSSL_add_all_algorithms();
+#endif
setup_openssl_threading();
@@ -1660,11 +1668,15 @@ memwipe(void *mem, uint8_t byte, size_t sz)
int
crypto_global_cleanup(void)
{
+#if OPENSSL_VERSION_NUMBER < OPENSSL_V_SERIES(1,1,0)
EVP_cleanup();
+#endif
#ifndef NEW_THREAD_API
ERR_remove_thread_state(NULL);
#endif
+#if OPENSSL_VERSION_NUMBER < OPENSSL_V_SERIES(1,1,0)
ERR_free_strings();
+#endif
if (dh_param_p)
BN_clear_free(dh_param_p);
@@ -1676,11 +1688,15 @@ crypto_global_cleanup(void)
dh_param_p = dh_param_p_tls = dh_param_g = NULL;
#ifndef DISABLE_ENGINES
+#if OPENSSL_VERSION_NUMBER < OPENSSL_V_SERIES(1,1,0)
ENGINE_cleanup();
#endif
+#endif
CONF_modules_unload(1);
+#if OPENSSL_VERSION_NUMBER < OPENSSL_V_SERIES(1,1,0)
CRYPTO_cleanup_all_ex_data();
+#endif
crypto_openssl_free_all();