mirror of
https://github.com/python/cpython.git
synced 2025-09-30 04:15:43 +00:00
[3.6] bpo-30102: Call OPENSSL_add_all_algorithms_noconf (GH-3112) (#3342)
The ssl and hashlib modules now call OPENSSL_add_all_algorithms_noconf() on
OpenSSL < 1.1.0. The function detects CPU features and enables optimizations
on some CPU architectures such as POWER8. Patch is based on research from
Gustavo Serra Scalet.
Signed-off-by: Christian Heimes <christian@python.org>
(cherry picked from commit c941e62
)
This commit is contained in:
parent
02854dab62
commit
2ddea0f098
3 changed files with 13 additions and 2 deletions
|
@ -0,0 +1,4 @@
|
||||||
|
The ssl and hashlib modules now call OPENSSL_add_all_algorithms_noconf() on
|
||||||
|
OpenSSL < 1.1.0. The function detects CPU features and enables optimizations
|
||||||
|
on some CPU architectures such as POWER8. Patch is based on research from
|
||||||
|
Gustavo Serra Scalet.
|
|
@ -1022,8 +1022,11 @@ PyInit__hashlib(void)
|
||||||
{
|
{
|
||||||
PyObject *m, *openssl_md_meth_names;
|
PyObject *m, *openssl_md_meth_names;
|
||||||
|
|
||||||
OpenSSL_add_all_digests();
|
#ifndef OPENSSL_VERSION_1_1
|
||||||
|
/* Load all digest algorithms and initialize cpuid */
|
||||||
|
OPENSSL_add_all_algorithms_noconf();
|
||||||
ERR_load_crypto_strings();
|
ERR_load_crypto_strings();
|
||||||
|
#endif
|
||||||
|
|
||||||
/* TODO build EVP_functions openssl_* entries dynamically based
|
/* TODO build EVP_functions openssl_* entries dynamically based
|
||||||
* on what hashes are supported rather than listing many
|
* on what hashes are supported rather than listing many
|
||||||
|
|
|
@ -5171,9 +5171,14 @@ PyInit__ssl(void)
|
||||||
return NULL;
|
return NULL;
|
||||||
PySocketModule = *socket_api;
|
PySocketModule = *socket_api;
|
||||||
|
|
||||||
|
#ifndef OPENSSL_VERSION_1_1
|
||||||
|
/* Load all algorithms and initialize cpuid */
|
||||||
|
OPENSSL_add_all_algorithms_noconf();
|
||||||
/* Init OpenSSL */
|
/* Init OpenSSL */
|
||||||
SSL_load_error_strings();
|
SSL_load_error_strings();
|
||||||
SSL_library_init();
|
SSL_library_init();
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef WITH_THREAD
|
#ifdef WITH_THREAD
|
||||||
#ifdef HAVE_OPENSSL_CRYPTO_LOCK
|
#ifdef HAVE_OPENSSL_CRYPTO_LOCK
|
||||||
/* note that this will start threading if not already started */
|
/* note that this will start threading if not already started */
|
||||||
|
@ -5185,7 +5190,6 @@ PyInit__ssl(void)
|
||||||
_ssl_locks_count++;
|
_ssl_locks_count++;
|
||||||
#endif
|
#endif
|
||||||
#endif /* WITH_THREAD */
|
#endif /* WITH_THREAD */
|
||||||
OpenSSL_add_all_algorithms();
|
|
||||||
|
|
||||||
/* Add symbols to module dict */
|
/* Add symbols to module dict */
|
||||||
sslerror_type_slots[0].pfunc = PyExc_OSError;
|
sslerror_type_slots[0].pfunc = PyExc_OSError;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue