diff options
author | Christian Heimes <christian@python.org> | 2017-09-05 13:47:11 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-09-05 13:47:11 (GMT) |
commit | c941e6238ab2a8caad11fe17d4723a5d5e7a2d76 (patch) | |
tree | 018497c5095a9dace2f074c8f96e9084f91ec18c /Modules/_ssl.c | |
parent | 52451fbaaf099e68044e67153c2c3eaa2d71e6e7 (diff) | |
download | cpython-c941e6238ab2a8caad11fe17d4723a5d5e7a2d76.zip cpython-c941e6238ab2a8caad11fe17d4723a5d5e7a2d76.tar.gz cpython-c941e6238ab2a8caad11fe17d4723a5d5e7a2d76.tar.bz2 |
bpo-30102: Call OPENSSL_add_all_algorithms_noconf (#3112)
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>
Diffstat (limited to 'Modules/_ssl.c')
-rw-r--r-- | Modules/_ssl.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/Modules/_ssl.c b/Modules/_ssl.c index 9ceaf5a..b001bca 100644 --- a/Modules/_ssl.c +++ b/Modules/_ssl.c @@ -5181,9 +5181,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 */ @@ -5195,7 +5200,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; |