summaryrefslogtreecommitdiff
path: root/src/common/crypto.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2018-04-18 12:31:24 -0400
committerNick Mathewson <nickm@torproject.org>2018-04-18 12:31:24 -0400
commita15b2c57e1f901c531a5f063513a541adb418ae1 (patch)
tree09b5402461a963d741ce77302c4245b198c1e28b /src/common/crypto.c
parent8e562874a42a1a3eb982ba2df3ff1f3860db0d31 (diff)
downloadtor-a15b2c57e1f901c531a5f063513a541adb418ae1.tar.gz
tor-a15b2c57e1f901c531a5f063513a541adb418ae1.zip
Add support for openssl built with "no-deprecated".
Patch from Andrew John Hughes; partial fix for 19981.
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();