[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] [tor/master] Try to work around changes in openssl 1.1.0
commit e9caa8645e5da69ac503a365624896d33b91504b
Author: Nick Mathewson <nickm@xxxxxxxxxxxxxx>
Date: Wed Jan 28 10:00:58 2015 -0500
Try to work around changes in openssl 1.1.0
Prefer not to use a couple of deprecated functions; include more
headers in tortls.c
This is part of ticket 14188.
---
changes/ticket14188_part1 | 2 ++
src/common/crypto.c | 18 +++++++++++++++++-
src/common/tortls.c | 2 ++
3 files changed, 21 insertions(+), 1 deletion(-)
diff --git a/changes/ticket14188_part1 b/changes/ticket14188_part1
new file mode 100644
index 0000000..9d66bba
--- /dev/null
+++ b/changes/ticket14188_part1
@@ -0,0 +1,2 @@
+ o Compilation fixes:
+ - Compile correctly with (unreleased) OpenSSL 1.1.0 headers.
diff --git a/src/common/crypto.c b/src/common/crypto.c
index 370c04a..218c7be 100644
--- a/src/common/crypto.c
+++ b/src/common/crypto.c
@@ -1780,9 +1780,13 @@ crypto_generate_dynamic_dh_modulus(void)
dynamic_dh_modulus = BN_new();
tor_assert(dynamic_dh_modulus);
- dh_parameters = DH_generate_parameters(DH_BYTES*8, DH_GENERATOR, NULL, NULL);
+ dh_parameters = DH_new();
tor_assert(dh_parameters);
+ r = DH_generate_parameters_ex(dh_parameters,
+ DH_BYTES*8, DH_GENERATOR, NULL);
+ tor_assert(r == 0);
+
r = DH_check(dh_parameters, &dh_codes);
tor_assert(r && !dh_codes);
@@ -3115,6 +3119,14 @@ openssl_dynlock_destroy_cb_(struct CRYPTO_dynlock_value *v,
tor_free(v);
}
+#if OPENSSL_VERSION_NUMBER >= OPENSSL_V_SERIES(1,0,0)
+static void
+tor_set_openssl_thread_id(CRYPTO_THREADID *threadid)
+{
+ CRYPTO_THREADID_set_numeric(threadid, tor_get_thread_id());
+}
+#endif
+
/** @{ */
/** Helper: Construct mutexes, and set callbacks to help OpenSSL handle being
* multithreaded. */
@@ -3128,7 +3140,11 @@ setup_openssl_threading(void)
for (i=0; i < n; ++i)
openssl_mutexes_[i] = tor_mutex_new();
CRYPTO_set_locking_callback(openssl_locking_cb_);
+#if OPENSSL_VERSION_NUMBER < OPENSSL_V_SERIES(1,0,0)
CRYPTO_set_id_callback(tor_get_thread_id);
+#else
+ CRYPTO_THREADID_set_callback(tor_set_openssl_thread_id);
+#endif
CRYPTO_set_dynlock_create_callback(openssl_dynlock_create_cb_);
CRYPTO_set_dynlock_lock_callback(openssl_dynlock_lock_cb_);
CRYPTO_set_dynlock_destroy_callback(openssl_dynlock_destroy_cb_);
diff --git a/src/common/tortls.c b/src/common/tortls.c
index ca62913..5df6364 100644
--- a/src/common/tortls.c
+++ b/src/common/tortls.c
@@ -50,6 +50,8 @@
#include <openssl/asn1.h>
#include <openssl/bio.h>
#include <openssl/opensslv.h>
+#include <openssl/bn.h>
+#include <openssl/rsa.h>
#if __GNUC__ && GCC_VERSION >= 402
#if GCC_VERSION >= 406
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits