mirror of
https://github.com/python/cpython.git
synced 2025-11-03 03:22:27 +00:00
Issue #18777: The ssl module now uses the new CRYPTO_THREADID API of
OpenSSL 1.0.0+ instead of the deprecated CRYPTO id callback function.
This commit is contained in:
parent
e0f0cf4067
commit
4d98ca9ff6
2 changed files with 20 additions and 1 deletions
|
|
@ -66,6 +66,9 @@ Core and Builtins
|
||||||
Library
|
Library
|
||||||
-------
|
-------
|
||||||
|
|
||||||
|
- Issue #18777: The ssl module now uses the new CRYPTO_THREADID API of
|
||||||
|
OpenSSL 1.0.0+ instead of the deprecated CRYPTO id callback function.
|
||||||
|
|
||||||
- Issue #18768: Correct doc string of RAND_edg(). Patch by Vajrasky Kok.
|
- Issue #18768: Correct doc string of RAND_edg(). Patch by Vajrasky Kok.
|
||||||
|
|
||||||
- Issue #18178: Fix ctypes on BSD. dlmalloc.c was compiled twice which broke
|
- Issue #18178: Fix ctypes on BSD. dlmalloc.c was compiled twice which broke
|
||||||
|
|
|
||||||
|
|
@ -2610,9 +2610,21 @@ static PyMethodDef PySSL_methods[] = {
|
||||||
|
|
||||||
static PyThread_type_lock *_ssl_locks = NULL;
|
static PyThread_type_lock *_ssl_locks = NULL;
|
||||||
|
|
||||||
static unsigned long _ssl_thread_id_function (void) {
|
#if OPENSSL_VERSION_NUMBER >= 0x10000000
|
||||||
|
/* use new CRYPTO_THREADID API. */
|
||||||
|
static void
|
||||||
|
_ssl_threadid_callback(CRYPTO_THREADID *id)
|
||||||
|
{
|
||||||
|
CRYPTO_THREADID_set_numeric(id,
|
||||||
|
(unsigned long)PyThread_get_thread_ident());
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
/* deprecated CRYPTO_set_id_callback() API. */
|
||||||
|
static unsigned long
|
||||||
|
_ssl_thread_id_function (void) {
|
||||||
return PyThread_get_thread_ident();
|
return PyThread_get_thread_ident();
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
static void _ssl_thread_locking_function
|
static void _ssl_thread_locking_function
|
||||||
(int mode, int n, const char *file, int line) {
|
(int mode, int n, const char *file, int line) {
|
||||||
|
|
@ -2665,7 +2677,11 @@ static int _setup_ssl_threads(void) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
CRYPTO_set_locking_callback(_ssl_thread_locking_function);
|
CRYPTO_set_locking_callback(_ssl_thread_locking_function);
|
||||||
|
#if OPENSSL_VERSION_NUMBER >= 0x10000000
|
||||||
|
CRYPTO_THREADID_set_callback(_ssl_threadid_callback);
|
||||||
|
#else
|
||||||
CRYPTO_set_id_callback(_ssl_thread_id_function);
|
CRYPTO_set_id_callback(_ssl_thread_id_function);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue