summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYawning Angel <yawning@schwanenlied.me>2016-06-14 04:40:36 +0000
committerNick Mathewson <nickm@torproject.org>2016-06-14 12:13:09 -0400
commit86f0b806812da8a53c25061acca500e0dcfb1103 (patch)
tree3b5dc75e7053761ab88156a1fe0586f73f3836f3
parent60b8aaefa1b1d0d828f04778df970e65a87eb2d6 (diff)
downloadtor-86f0b806812da8a53c25061acca500e0dcfb1103.tar.gz
tor-86f0b806812da8a53c25061acca500e0dcfb1103.zip
Bug 19406: OpenSSL changed the Thread API in 1.1.0 again.
Instead of `ERR_remove_thread_state()` having a modified prototype, it now has the old prototype and a deprecation annotation. Since it's pointless to add extra complexity just to remain compatible with an old OpenSSL development snapshot, update the code to work with 1.1.0pre5 and later.
-rw-r--r--src/common/crypto.c21
1 files changed, 11 insertions, 10 deletions
diff --git a/src/common/crypto.c b/src/common/crypto.c
index 933f1033f7..ca04e4ec3f 100644
--- a/src/common/crypto.c
+++ b/src/common/crypto.c
@@ -72,13 +72,18 @@
#define DISABLE_ENGINES
#endif
-#if OPENSSL_VERSION_NUMBER >= OPENSSL_VER(1,1,0,0,4) && \
+#if OPENSSL_VERSION_NUMBER >= OPENSSL_VER(1,1,0,0,5) && \
!defined(LIBRESSL_VERSION_NUMBER)
-/* OpenSSL as of 1.1.0-pre4 has an "new" thread API, which doesn't require
+/* OpenSSL as of 1.1.0pre4 has an "new" thread API, which doesn't require
* seting up various callbacks.
*
- * Note: Yes, using OPENSSL_VER is naughty, but this was introduced in the
- * pre-release series.
+ * OpenSSL 1.1.0pre4 has a messed up `ERR_remove_thread_state()` prototype,
+ * while the previous one was restored in pre5, and the function made a no-op
+ * (along with a deprecated annotation, which produces a compiler warning).
+ *
+ * While it is possible to support all three versions of the thread API,
+ * a version that existed only for one snapshot pre-release is kind of
+ * pointless, so let's not.
*/
#define NEW_THREAD_API
#endif
@@ -430,9 +435,7 @@ crypto_global_init(int useAccel, const char *accelName, const char *accelDir)
void
crypto_thread_cleanup(void)
{
-#ifdef NEW_THREAD_API
- ERR_remove_thread_state();
-#else
+#ifndef NEW_THREAD_API
ERR_remove_thread_state(NULL);
#endif
}
@@ -3193,9 +3196,7 @@ int
crypto_global_cleanup(void)
{
EVP_cleanup();
-#ifdef NEW_THREAD_API
- ERR_remove_thread_state();
-#else
+#ifndef NEW_THREAD_API
ERR_remove_thread_state(NULL);
#endif
ERR_free_strings();