summaryrefslogtreecommitdiffstats
path: root/Modules/_hashopenssl.c
diff options
context:
space:
mode:
authorChristian Heimes <christian@python.org>2017-09-05 13:47:11 (GMT)
committerGitHub <noreply@github.com>2017-09-05 13:47:11 (GMT)
commitc941e6238ab2a8caad11fe17d4723a5d5e7a2d76 (patch)
tree018497c5095a9dace2f074c8f96e9084f91ec18c /Modules/_hashopenssl.c
parent52451fbaaf099e68044e67153c2c3eaa2d71e6e7 (diff)
downloadcpython-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/_hashopenssl.c')
-rw-r--r--Modules/_hashopenssl.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/Modules/_hashopenssl.c b/Modules/_hashopenssl.c
index 037fa4e..8ef8c54 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