[3.6] bpo-30102: Call OPENSSL_add_all_algorithms_noconf (GH-3112) (#3… · python/cpython@2ddea0f · GitHub
Skip to content

Commit 2ddea0f

Browse files
authored
[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)
1 parent 02854da commit 2ddea0f

3 files changed

Lines changed: 13 additions & 2 deletions

File tree

Lines changed: 4 additions & 0 deletions

Modules/_hashopenssl.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1022,8 +1022,11 @@ PyInit__hashlib(void)
10221022
{
10231023
PyObject *m, *openssl_md_meth_names;
10241024

1025-
OpenSSL_add_all_digests();
1025+
#ifndef OPENSSL_VERSION_1_1
1026+
/* Load all digest algorithms and initialize cpuid */
1027+
OPENSSL_add_all_algorithms_noconf();
10261028
ERR_load_crypto_strings();
1029+
#endif
10271030

10281031
/* TODO build EVP_functions openssl_* entries dynamically based
10291032
* on what hashes are supported rather than listing many

Modules/_ssl.c

Lines changed: 5 additions & 1 deletion

0 commit comments

Comments
 (0)