diff options
author | Christian Heimes <christian@python.org> | 2017-09-05 15:12:03 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-09-05 15:12:03 (GMT) |
commit | 2ddea0f098b42dfd74f53bcbf08c8e68c83e1049 (patch) | |
tree | 344ca48430eb1dfaeffb101dd621351c6a05831d /Modules | |
parent | 02854dab6231d726fa2c63d44ab25598988c44f4 (diff) | |
download | cpython-2ddea0f098b42dfd74f53bcbf08c8e68c83e1049.zip cpython-2ddea0f098b42dfd74f53bcbf08c8e68c83e1049.tar.gz cpython-2ddea0f098b42dfd74f53bcbf08c8e68c83e1049.tar.bz2 |
[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)
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/_hashopenssl.c | 5 | ||||
-rw-r--r-- | Modules/_ssl.c | 6 |
2 files changed, 9 insertions, 2 deletions
diff --git a/Modules/_hashopenssl.c b/Modules/_hashopenssl.c index 395c719..5a86376 100644 --- a/Modules/_hashopenssl.c +++ b/Modules/_hashopenssl.c @@ -1022,8 +1022,11 @@ PyInit__hashlib(void) { 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(); +#endif /* TODO build EVP_functions openssl_* entries dynamically based * on what hashes are supported rather than listing many diff --git a/Modules/_ssl.c b/Modules/_ssl.c index 6b6f2b1..a21283a 100644 --- a/Modules/_ssl.c +++ b/Modules/_ssl.c @@ -5171,9 +5171,14 @@ PyInit__ssl(void) return NULL; PySocketModule = *socket_api; +#ifndef OPENSSL_VERSION_1_1 + /* Load all algorithms and initialize cpuid */ + OPENSSL_add_all_algorithms_noconf(); /* Init OpenSSL */ SSL_load_error_strings(); SSL_library_init(); +#endif + #ifdef WITH_THREAD #ifdef HAVE_OPENSSL_CRYPTO_LOCK /* note that this will start threading if not already started */ @@ -5185,7 +5190,6 @@ PyInit__ssl(void) _ssl_locks_count++; #endif #endif /* WITH_THREAD */ - OpenSSL_add_all_algorithms(); /* Add symbols to module dict */ sslerror_type_slots[0].pfunc = PyExc_OSError; |