File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -66,6 +66,9 @@ Core and Builtins
6666Library
6767-------
6868
69+ - Issue #18777: The ssl module now uses the new CRYPTO_THREADID API of
70+ OpenSSL 1.0.0+ instead of the deprecated CRYPTO id callback function.
71+
6972- Issue #18768: Correct doc string of RAND_edg(). Patch by Vajrasky Kok.
7073
7174- Issue #18178: Fix ctypes on BSD. dlmalloc.c was compiled twice which broke
Original file line number Diff line number Diff line change @@ -2610,9 +2610,21 @@ static PyMethodDef PySSL_methods[] = {
26102610
26112611static PyThread_type_lock * _ssl_locks = NULL ;
26122612
2613- static unsigned long _ssl_thread_id_function (void ) {
2613+ #if OPENSSL_VERSION_NUMBER >= 0x10000000
2614+ /* use new CRYPTO_THREADID API. */
2615+ static void
2616+ _ssl_threadid_callback (CRYPTO_THREADID * id )
2617+ {
2618+ CRYPTO_THREADID_set_numeric (id ,
2619+ (unsigned long )PyThread_get_thread_ident ());
2620+ }
2621+ #else
2622+ /* deprecated CRYPTO_set_id_callback() API. */
2623+ static unsigned long
2624+ _ssl_thread_id_function (void ) {
26142625 return PyThread_get_thread_ident ();
26152626}
2627+ #endif
26162628
26172629static void _ssl_thread_locking_function
26182630 (int mode , int n , const char * file , int line ) {
@@ -2665,7 +2677,11 @@ static int _setup_ssl_threads(void) {
26652677 }
26662678 }
26672679 CRYPTO_set_locking_callback (_ssl_thread_locking_function );
2680+ #if OPENSSL_VERSION_NUMBER >= 0x10000000
2681+ CRYPTO_THREADID_set_callback (_ssl_threadid_callback );
2682+ #else
26682683 CRYPTO_set_id_callback (_ssl_thread_id_function );
2684+ #endif
26692685 }
26702686 return 1 ;
26712687}
You can’t perform that action at this time.
0 commit comments