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