Added
Link Here
|
1 |
From 9fa60bf7361d3244c19ed273fd4f1df7dd9698b0 Mon Sep 17 00:00:00 2001 |
2 |
From: Yasuhiro Kimura <yasu@utahime.org> |
3 |
Date: Tue, 11 May 2021 04:17:33 +0900 |
4 |
Subject: [PATCH] Revert "[3.8] bpo-43799: OpenSSL 3.0.0: declare |
5 |
OPENSSL_API_COMPAT 1.1.1 (GH-25329) (GH-25383)" |
6 |
|
7 |
This reverts commit b71aaa0df0f3a9640b034b4774651cd8c54d2fb9. |
8 |
--- |
9 |
Modules/_hashopenssl.c | 9 +-------- |
10 |
Modules/_ssl.c | 33 +++++++++++++++++++-------------- |
11 |
2 files changed, 20 insertions(+), 22 deletions(-) |
12 |
|
13 |
diff --git Modules/_hashopenssl.c Modules/_hashopenssl.c |
14 |
index 93bf25fee3..edadbcb393 100644 |
15 |
--- Modules/_hashopenssl.c |
16 |
+++ Modules/_hashopenssl.c |
17 |
@@ -11,13 +11,6 @@ |
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 |
@@ -31,7 +24,7 @@ |
32 |
#include <openssl/hmac.h> |
33 |
/* We use the object interface to discover what hashes OpenSSL supports. */ |
34 |
#include <openssl/objects.h> |
35 |
-#include <openssl/err.h> |
36 |
+#include "openssl/err.h" |
37 |
|
38 |
#ifndef OPENSSL_THREADS |
39 |
# error "OPENSSL_THREADS is not defined, Python requires thread-safe OpenSSL" |
40 |
diff --git Modules/_ssl.c Modules/_ssl.c |
41 |
index d6a2fb814a..5cbc2b65be 100644 |
42 |
--- Modules/_ssl.c |
43 |
+++ Modules/_ssl.c |
44 |
@@ -14,13 +14,6 @@ |
45 |
http://bugs.python.org/issue8108#msg102867 ? |
46 |
*/ |
47 |
|
48 |
-/* Don't warn about deprecated functions, */ |
49 |
-#ifndef OPENSSL_API_COMPAT |
50 |
- // 0x10101000L == 1.1.1, 30000 == 3.0.0 |
51 |
- #define OPENSSL_API_COMPAT 0x10101000L |
52 |
-#endif |
53 |
-#define OPENSSL_NO_DEPRECATED 1 |
54 |
- |
55 |
#define PY_SSIZE_T_CLEAN |
56 |
|
57 |
#include "Python.h" |
58 |
@@ -52,6 +45,14 @@ static PySocketModule_APIObject PySocketModule; |
59 |
#include <sys/poll.h> |
60 |
#endif |
61 |
|
62 |
+/* Don't warn about deprecated functions */ |
63 |
+#ifdef __GNUC__ |
64 |
+#pragma GCC diagnostic ignored "-Wdeprecated-declarations" |
65 |
+#endif |
66 |
+#ifdef __clang__ |
67 |
+#pragma clang diagnostic ignored "-Wdeprecated-declarations" |
68 |
+#endif |
69 |
+ |
70 |
/* Include OpenSSL header files */ |
71 |
#include "openssl/rsa.h" |
72 |
#include "openssl/crypto.h" |
73 |
@@ -149,20 +150,24 @@ static void _PySSLFixErrno(void) { |
74 |
# define PY_OPENSSL_1_1_API 1 |
75 |
#endif |
76 |
|
77 |
-/* OpenSSL API 1.1.0+ does not include version methods. Define the methods |
78 |
- * unless OpenSSL is compiled without the methods. It's the easiest way to |
79 |
- * make 1.0.2, 1.1.0, 1.1.1, and 3.0.0 happy without deprecation warnings. |
80 |
- */ |
81 |
+/* OpenSSL API compat */ |
82 |
+#ifdef OPENSSL_API_COMPAT |
83 |
+#if OPENSSL_API_COMPAT >= 0x10100000L |
84 |
+ |
85 |
+/* OpenSSL API 1.1.0+ does not include version methods */ |
86 |
#ifndef OPENSSL_NO_TLS1_METHOD |
87 |
-extern const SSL_METHOD *TLSv1_method(void); |
88 |
+#define OPENSSL_NO_TLS1_METHOD 1 |
89 |
#endif |
90 |
#ifndef OPENSSL_NO_TLS1_1_METHOD |
91 |
-extern const SSL_METHOD *TLSv1_1_method(void); |
92 |
+#define OPENSSL_NO_TLS1_1_METHOD 1 |
93 |
#endif |
94 |
#ifndef OPENSSL_NO_TLS1_2_METHOD |
95 |
-extern const SSL_METHOD *TLSv1_2_method(void); |
96 |
+#define OPENSSL_NO_TLS1_2_METHOD 1 |
97 |
#endif |
98 |
|
99 |
+#endif /* >= 1.1.0 compcat */ |
100 |
+#endif /* OPENSSL_API_COMPAT */ |
101 |
+ |
102 |
/* LibreSSL 2.7.0 provides necessary OpenSSL 1.1.0 APIs */ |
103 |
#if defined(LIBRESSL_VERSION_NUMBER) && LIBRESSL_VERSION_NUMBER >= 0x2070000fL |
104 |
# define PY_OPENSSL_1_1_API 1 |
105 |
-- |
106 |
2.31.1 |
107 |
|