Added
Link Here
|
1 |
From 138af6f7696e5450d11a6ef4cdca869a26fefe13 Mon Sep 17 00:00:00 2001 |
2 |
From: Yasuhiro Kimura <yasu@utahime.org> |
3 |
Date: Tue, 11 May 2021 05:47:21 +0900 |
4 |
Subject: [PATCH] Revert "[3.9] bpo-43799: OpenSSL 3.0.0: declare |
5 |
OPENSSL_API_COMPAT 1.1.1 (GH-25329) (GH-25382)" |
6 |
|
7 |
This reverts commit 7d9d5bf863bb0af26b74b0732ab89b2053d2fbec. |
8 |
--- |
9 |
Modules/_hashopenssl.c | 15 +++++---------- |
10 |
Modules/_ssl.c | 33 +++++++++++++++++++-------------- |
11 |
2 files changed, 24 insertions(+), 24 deletions(-) |
12 |
|
13 |
diff --git Modules/_hashopenssl.c Modules/_hashopenssl.c |
14 |
index 0dd1662101..adc8653773 100644 |
15 |
--- Modules/_hashopenssl.c |
16 |
+++ Modules/_hashopenssl.c |
17 |
@@ -11,26 +11,20 @@ |
18 |
* |
19 |
*/ |
20 |
|
21 |
-/* Don't warn about deprecated functions, */ |
22 |
-#ifndef OPENSSL_API_COMPAT |
23 |
- // 0x10101000L == 1.1.1, 30000 == 3.0.0 |
24 |
- #define OPENSSL_API_COMPAT 0x10101000L |
25 |
-#endif |
26 |
-#define OPENSSL_NO_DEPRECATED 1 |
27 |
- |
28 |
#define PY_SSIZE_T_CLEAN |
29 |
|
30 |
#include "Python.h" |
31 |
#include "hashlib.h" |
32 |
#include "pystrhex.h" |
33 |
|
34 |
+ |
35 |
/* EVP is the preferred interface to hashing in OpenSSL */ |
36 |
#include <openssl/evp.h> |
37 |
#include <openssl/hmac.h> |
38 |
#include <openssl/crypto.h> |
39 |
/* We use the object interface to discover what hashes OpenSSL supports. */ |
40 |
#include <openssl/objects.h> |
41 |
-#include <openssl/err.h> |
42 |
+#include "openssl/err.h" |
43 |
|
44 |
#include <openssl/crypto.h> // FIPS_mode() |
45 |
|
46 |
@@ -1817,11 +1811,12 @@ _hashlib_get_fips_mode_impl(PyObject *module) |
47 |
/*[clinic end generated code: output=87eece1bab4d3fa9 input=2db61538c41c6fef]*/ |
48 |
|
49 |
{ |
50 |
+ int result; |
51 |
#if OPENSSL_VERSION_NUMBER >= 0x30000000L |
52 |
- return EVP_default_properties_is_fips_enabled(NULL); |
53 |
+ result = EVP_default_properties_is_fips_enabled(NULL); |
54 |
#else |
55 |
ERR_clear_error(); |
56 |
- int result = FIPS_mode(); |
57 |
+ result = FIPS_mode(); |
58 |
if (result == 0) { |
59 |
// "If the library was built without support of the FIPS Object Module, |
60 |
// then the function will return 0 with an error code of |
61 |
diff --git Modules/_ssl.c Modules/_ssl.c |
62 |
index 97e314b21f..82069a5832 100644 |
63 |
--- Modules/_ssl.c |
64 |
+++ Modules/_ssl.c |
65 |
@@ -14,13 +14,6 @@ |
66 |
http://bugs.python.org/issue8108#msg102867 ? |
67 |
*/ |
68 |
|
69 |
-/* Don't warn about deprecated functions, */ |
70 |
-#ifndef OPENSSL_API_COMPAT |
71 |
- // 0x10101000L == 1.1.1, 30000 == 3.0.0 |
72 |
- #define OPENSSL_API_COMPAT 0x10101000L |
73 |
-#endif |
74 |
-#define OPENSSL_NO_DEPRECATED 1 |
75 |
- |
76 |
#define PY_SSIZE_T_CLEAN |
77 |
|
78 |
#include "Python.h" |
79 |
@@ -50,6 +43,14 @@ static PySocketModule_APIObject PySocketModule; |
80 |
#include <sys/poll.h> |
81 |
#endif |
82 |
|
83 |
+/* Don't warn about deprecated functions */ |
84 |
+#ifdef __GNUC__ |
85 |
+#pragma GCC diagnostic ignored "-Wdeprecated-declarations" |
86 |
+#endif |
87 |
+#ifdef __clang__ |
88 |
+#pragma clang diagnostic ignored "-Wdeprecated-declarations" |
89 |
+#endif |
90 |
+ |
91 |
/* Include OpenSSL header files */ |
92 |
#include "openssl/rsa.h" |
93 |
#include "openssl/crypto.h" |
94 |
@@ -147,20 +148,24 @@ static void _PySSLFixErrno(void) { |
95 |
# define PY_OPENSSL_1_1_API 1 |
96 |
#endif |
97 |
|
98 |
-/* OpenSSL API 1.1.0+ does not include version methods. Define the methods |
99 |
- * unless OpenSSL is compiled without the methods. It's the easiest way to |
100 |
- * make 1.0.2, 1.1.0, 1.1.1, and 3.0.0 happy without deprecation warnings. |
101 |
- */ |
102 |
+/* OpenSSL API compat */ |
103 |
+#ifdef OPENSSL_API_COMPAT |
104 |
+#if OPENSSL_API_COMPAT >= 0x10100000L |
105 |
+ |
106 |
+/* OpenSSL API 1.1.0+ does not include version methods */ |
107 |
#ifndef OPENSSL_NO_TLS1_METHOD |
108 |
-extern const SSL_METHOD *TLSv1_method(void); |
109 |
+#define OPENSSL_NO_TLS1_METHOD 1 |
110 |
#endif |
111 |
#ifndef OPENSSL_NO_TLS1_1_METHOD |
112 |
-extern const SSL_METHOD *TLSv1_1_method(void); |
113 |
+#define OPENSSL_NO_TLS1_1_METHOD 1 |
114 |
#endif |
115 |
#ifndef OPENSSL_NO_TLS1_2_METHOD |
116 |
-extern const SSL_METHOD *TLSv1_2_method(void); |
117 |
+#define OPENSSL_NO_TLS1_2_METHOD 1 |
118 |
#endif |
119 |
|
120 |
+#endif /* >= 1.1.0 compcat */ |
121 |
+#endif /* OPENSSL_API_COMPAT */ |
122 |
+ |
123 |
/* LibreSSL 2.7.0 provides necessary OpenSSL 1.1.0 APIs */ |
124 |
#if defined(LIBRESSL_VERSION_NUMBER) && LIBRESSL_VERSION_NUMBER >= 0x2070000fL |
125 |
# define PY_OPENSSL_1_1_API 1 |
126 |
-- |
127 |
2.31.1 |
128 |
|