aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2015-02-02 10:15:26 -0500
committerNick Mathewson <nickm@torproject.org>2015-02-02 10:15:26 -0500
commite78b7e27761df246349b4eee7667c304a68b73fd (patch)
treea53225df5e498e5e842cbb0247a942287af308e5
parentaa4f773670e79bc78ed68de3b4c05e7d5afadea0 (diff)
parente9caa8645e5da69ac503a365624896d33b91504b (diff)
downloadtor-e78b7e27761df246349b4eee7667c304a68b73fd.tar.gz
tor-e78b7e27761df246349b4eee7667c304a68b73fd.zip
Merge remote-tracking branch 'public/14188_part1'
-rw-r--r--changes/ticket14188_part12
-rw-r--r--src/common/crypto.c18
-rw-r--r--src/common/tortls.c2
3 files changed, 21 insertions, 1 deletions
diff --git a/changes/ticket14188_part1 b/changes/ticket14188_part1
new file mode 100644
index 0000000000..9d66bba1fc
--- /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 370c04a315..218c7bea1e 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 ca629135a6..5df6364393 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