|
14 | 14 | http://bugs.python.org/issue8108#msg102867 ? |
15 | 15 | */ |
16 | 16 |
|
| 17 | +/* Don't warn about deprecated functions, */ |
| 18 | +#ifndef OPENSSL_API_COMPAT |
| 19 | + // 0x10101000L == 1.1.1, 30000 == 3.0.0 |
| 20 | + #define OPENSSL_API_COMPAT 0x10101000L |
| 21 | +#endif |
| 22 | +#define OPENSSL_NO_DEPRECATED 1 |
| 23 | + |
17 | 24 | #define PY_SSIZE_T_CLEAN |
18 | 25 |
|
19 | 26 | #include "Python.h" |
@@ -43,14 +50,6 @@ static PySocketModule_APIObject PySocketModule; |
43 | 50 | #include <sys/poll.h> |
44 | 51 | #endif |
45 | 52 |
|
46 | | -/* Don't warn about deprecated functions */ |
47 | | -#ifdef __GNUC__ |
48 | | -#pragma GCC diagnostic ignored "-Wdeprecated-declarations" |
49 | | -#endif |
50 | | -#ifdef __clang__ |
51 | | -#pragma clang diagnostic ignored "-Wdeprecated-declarations" |
52 | | -#endif |
53 | | - |
54 | 53 | /* Include OpenSSL header files */ |
55 | 54 | #include "openssl/rsa.h" |
56 | 55 | #include "openssl/crypto.h" |
@@ -148,24 +147,20 @@ static void _PySSLFixErrno(void) { |
148 | 147 | # define PY_OPENSSL_1_1_API 1 |
149 | 148 | #endif |
150 | 149 |
|
151 | | -/* OpenSSL API compat */ |
152 | | -#ifdef OPENSSL_API_COMPAT |
153 | | -#if OPENSSL_API_COMPAT >= 0x10100000L |
154 | | - |
155 | | -/* OpenSSL API 1.1.0+ does not include version methods */ |
| 150 | +/* OpenSSL API 1.1.0+ does not include version methods. Define the methods |
| 151 | + * unless OpenSSL is compiled without the methods. It's the easiest way to |
| 152 | + * make 1.0.2, 1.1.0, 1.1.1, and 3.0.0 happy without deprecation warnings. |
| 153 | + */ |
156 | 154 | #ifndef OPENSSL_NO_TLS1_METHOD |
157 | | -#define OPENSSL_NO_TLS1_METHOD 1 |
| 155 | +extern const SSL_METHOD *TLSv1_method(void); |
158 | 156 | #endif |
159 | 157 | #ifndef OPENSSL_NO_TLS1_1_METHOD |
160 | | -#define OPENSSL_NO_TLS1_1_METHOD 1 |
| 158 | +extern const SSL_METHOD *TLSv1_1_method(void); |
161 | 159 | #endif |
162 | 160 | #ifndef OPENSSL_NO_TLS1_2_METHOD |
163 | | -#define OPENSSL_NO_TLS1_2_METHOD 1 |
| 161 | +extern const SSL_METHOD *TLSv1_2_method(void); |
164 | 162 | #endif |
165 | 163 |
|
166 | | -#endif /* >= 1.1.0 compcat */ |
167 | | -#endif /* OPENSSL_API_COMPAT */ |
168 | | - |
169 | 164 | /* LibreSSL 2.7.0 provides necessary OpenSSL 1.1.0 APIs */ |
170 | 165 | #if defined(LIBRESSL_VERSION_NUMBER) && LIBRESSL_VERSION_NUMBER >= 0x2070000fL |
171 | 166 | # define PY_OPENSSL_1_1_API 1 |
|
0 commit comments