summaryrefslogtreecommitdiffstats
path: root/Modules/_hashopenssl.c
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2021-04-13 06:40:52 (GMT)
committerGitHub <noreply@github.com>2021-04-13 06:40:52 (GMT)
commit7d9d5bf863bb0af26b74b0732ab89b2053d2fbec (patch)
tree2b1060434923fa8bb46ae0fa5f9be83c5266e8a6 /Modules/_hashopenssl.c
parent6379924ecd51e346b42b0293da0f4442a0f67707 (diff)
downloadcpython-7d9d5bf863bb0af26b74b0732ab89b2053d2fbec.zip
cpython-7d9d5bf863bb0af26b74b0732ab89b2053d2fbec.tar.gz
cpython-7d9d5bf863bb0af26b74b0732ab89b2053d2fbec.tar.bz2
[3.9] bpo-43799: OpenSSL 3.0.0: declare OPENSSL_API_COMPAT 1.1.1 (GH-25329) (GH-25382)
Signed-off-by: Christian Heimes <christian@python.org> (cherry picked from commit a4833883c9b81b6b272cc7c5b67fa1658b65304c) Co-authored-by: Christian Heimes <christian@python.org> Automerge-Triggered-By: GH:tiran
Diffstat (limited to 'Modules/_hashopenssl.c')
-rw-r--r--Modules/_hashopenssl.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/Modules/_hashopenssl.c b/Modules/_hashopenssl.c
index adc8653..0dd1662 100644
--- a/Modules/_hashopenssl.c
+++ b/Modules/_hashopenssl.c
@@ -11,20 +11,26 @@
*
*/
+/* Don't warn about deprecated functions, */
+#ifndef OPENSSL_API_COMPAT
+ // 0x10101000L == 1.1.1, 30000 == 3.0.0
+ #define OPENSSL_API_COMPAT 0x10101000L
+#endif
+#define OPENSSL_NO_DEPRECATED 1
+
#define PY_SSIZE_T_CLEAN
#include "Python.h"
#include "hashlib.h"
#include "pystrhex.h"
-
/* EVP is the preferred interface to hashing in OpenSSL */
#include <openssl/evp.h>
#include <openssl/hmac.h>
#include <openssl/crypto.h>
/* We use the object interface to discover what hashes OpenSSL supports. */
#include <openssl/objects.h>
-#include "openssl/err.h"
+#include <openssl/err.h>
#include <openssl/crypto.h> // FIPS_mode()
@@ -1811,12 +1817,11 @@ _hashlib_get_fips_mode_impl(PyObject *module)
/*[clinic end generated code: output=87eece1bab4d3fa9 input=2db61538c41c6fef]*/
{
- int result;
#if OPENSSL_VERSION_NUMBER >= 0x30000000L
- result = EVP_default_properties_is_fips_enabled(NULL);
+ return EVP_default_properties_is_fips_enabled(NULL);
#else
ERR_clear_error();
- result = FIPS_mode();
+ int result = FIPS_mode();
if (result == 0) {
// "If the library was built without support of the FIPS Object Module,
// then the function will return 0 with an error code of