Browse code

openssl: Only use CRYPTO_set_id_callback on OpenSSL < 1.0.0

Since 1.0.0, this function is deprecated. A new function,
CRYPTO_THREADID_set_callback is available, but if not set at all,
it uses the address of errno as thread id, which should be
sufficient for most systems.

On windows, it never was necessary to use this function even
before 1.0.0, it used the right win32 API function for this
by default.

Signed-off-by: Martin Storsjö <martin@martin.st>

Martin Storsjö authored on 2011/11/06 08:50:03
Showing 1 changed files
... ...
@@ -45,7 +45,7 @@ static void openssl_lock(int mode, int type, const char *file, int line)
45 45
     else
46 46
         pthread_mutex_unlock(&openssl_mutexes[type]);
47 47
 }
48
-#ifndef WIN32
48
+#if !defined(WIN32) && OPENSSL_VERSION_NUMBER < 0x10000000
49 49
 static unsigned long openssl_thread_id(void)
50 50
 {
51 51
     return (intptr_t) pthread_self();
... ...
@@ -78,7 +78,7 @@ void ff_tls_init(void)
78 78
             for (i = 0; i < CRYPTO_num_locks(); i++)
79 79
                 pthread_mutex_init(&openssl_mutexes[i], NULL);
80 80
             CRYPTO_set_locking_callback(openssl_lock);
81
-#ifndef WIN32
81
+#if !defined(WIN32) && OPENSSL_VERSION_NUMBER < 0x10000000
82 82
             CRYPTO_set_id_callback(openssl_thread_id);
83 83
 #endif
84 84
         }