bind: fixes for openssl 1.1.0 thread compatibility
Signed-off-by: Philip Prindeville <philipp@redfish-solutions.com>
This commit is contained in:
parent
eab56b6bee
commit
6ebaad1529
1 changed files with 49 additions and 0 deletions
49
net/bind/patches/003-openssl-1.1.0-thread-fix.patch
Normal file
49
net/bind/patches/003-openssl-1.1.0-thread-fix.patch
Normal file
|
@ -0,0 +1,49 @@
|
||||||
|
--- a/lib/dns/openssl_link.c 2017-07-07 09:02:06.000000000 -0600
|
||||||
|
+++ b/lib/dns/openssl_link.c 2017-08-07 10:23:18.886182931 -0600
|
||||||
|
@@ -177,6 +177,14 @@ mem_realloc(void *ptr, size_t size FLARG
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
+#if OPENSSL_VERSION_NUMBER >= 0x10000000L
|
||||||
|
+static void
|
||||||
|
+_set_thread_id(CRYPTO_THREADID *id)
|
||||||
|
+{
|
||||||
|
+ CRYPTO_THREADID_set_numeric(id, pthread_self());
|
||||||
|
+}
|
||||||
|
+#endif
|
||||||
|
+
|
||||||
|
isc_result_t
|
||||||
|
dst__openssl_init(const char *engine) {
|
||||||
|
isc_result_t result;
|
||||||
|
@@ -193,7 +203,7 @@ dst__openssl_init(const char *engine) {
|
||||||
|
CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_ON);
|
||||||
|
#endif
|
||||||
|
CRYPTO_set_mem_functions(mem_alloc, mem_realloc, mem_free);
|
||||||
|
-#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
|
||||||
|
+#if defined(OPENSSL_VERSION_NUMBER) || defined(LIBRESSL_VERSION_NUMBER)
|
||||||
|
nlocks = CRYPTO_num_locks();
|
||||||
|
locks = mem_alloc(sizeof(isc_mutex_t) * nlocks FILELINE);
|
||||||
|
if (locks == NULL)
|
||||||
|
@@ -202,7 +204,11 @@ dst__openssl_init(const char *engine) {
|
||||||
|
if (result != ISC_R_SUCCESS)
|
||||||
|
goto cleanup_mutexalloc;
|
||||||
|
CRYPTO_set_locking_callback(lock_callback);
|
||||||
|
+# if OPENSSL_VERSION_NUMBER >= 0x10000000L
|
||||||
|
+ CRYPTO_THREADID_set_callback(_set_thread_id);
|
||||||
|
+# else
|
||||||
|
CRYPTO_set_id_callback(id_callback);
|
||||||
|
+# endif
|
||||||
|
|
||||||
|
ERR_load_crypto_strings();
|
||||||
|
#endif
|
||||||
|
@@ -323,7 +335,9 @@ dst__openssl_destroy(void) {
|
||||||
|
CRYPTO_cleanup_all_ex_data();
|
||||||
|
#endif
|
||||||
|
ERR_clear_error();
|
||||||
|
-#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
|
||||||
|
+#if OPENSSL_VERSION >= 0x10000000L
|
||||||
|
+ ERR_remove_thread_state(NULL);
|
||||||
|
+#elif OPENSSL_VERSION_NUMBER < 0x10000000L || defined(LIBRESSL_VERSION_NUMBER)
|
||||||
|
ERR_remove_state(0);
|
||||||
|
#endif
|
||||||
|
ERR_free_strings();
|
Loading…
Reference in a new issue