Merge pull request #11353 from kvuorine/fwknop-fixes
[feed/packages.git] / lang / python / python-cryptography / patches / 030-Add-compatibility-for-deprecated-TLS-methods.patch
1 From 3f3b85a59d3c2cb021174ad92ad3a43d9eb73e62 Mon Sep 17 00:00:00 2001
2 From: Rosen Penev <rosenp@gmail.com>
3 Date: Fri, 7 Jun 2019 21:00:46 -0700
4 Subject: [PATCH] Add compatibility for deprecated TLS methods
5
6 ---
7 src/_cffi_src/openssl/ssl.py | 45 +++++++++++++++++--
8 .../hazmat/bindings/openssl/_conditional.py | 36 +++++++++++++++
9 2 files changed, 77 insertions(+), 4 deletions(-)
10
11 diff --git a/src/_cffi_src/openssl/ssl.py b/src/_cffi_src/openssl/ssl.py
12 index c38e309a..e726417d 100644
13 --- a/src/_cffi_src/openssl/ssl.py
14 +++ b/src/_cffi_src/openssl/ssl.py
15 @@ -15,8 +15,9 @@ static const long Cryptography_HAS_SSL_ST;
16 static const long Cryptography_HAS_TLS_ST;
17 static const long Cryptography_HAS_SSL2;
18 static const long Cryptography_HAS_SSL3_METHOD;
19 -static const long Cryptography_HAS_TLSv1_1;
20 -static const long Cryptography_HAS_TLSv1_2;
21 +static const long Cryptography_HAS_TLS1_METHOD;
22 +static const long Cryptography_HAS_TLS1_1_METHOD;
23 +static const long Cryptography_HAS_TLS1_2_METHOD;
24 static const long Cryptography_HAS_TLSv1_3;
25 static const long Cryptography_HAS_SECURE_RENEGOTIATION;
26 static const long Cryptography_HAS_TLSEXT_STATUS_REQ_CB;
27 @@ -24,6 +25,7 @@ static const long Cryptography_HAS_STATUS_REQ_OCSP_RESP;
28 static const long Cryptography_HAS_TLSEXT_STATUS_REQ_TYPE;
29 static const long Cryptography_HAS_SSL_CTX_CLEAR_OPTIONS;
30 static const long Cryptography_HAS_DTLS;
31 +static const long Cryptography_HAS_DTLS1_METHOD;
32 static const long Cryptography_HAS_SIGALGS;
33 static const long Cryptography_HAS_PSK;
34 static const long Cryptography_HAS_CIPHER_DETAILS;
35 @@ -596,8 +598,43 @@ static const long Cryptography_HAS_STATUS_REQ_OCSP_RESP = 1;
36 static const long Cryptography_HAS_TLSEXT_STATUS_REQ_TYPE = 1;
37 static const long Cryptography_HAS_RELEASE_BUFFERS = 1;
38 static const long Cryptography_HAS_OP_NO_COMPRESSION = 1;
39 -static const long Cryptography_HAS_TLSv1_1 = 1;
40 -static const long Cryptography_HAS_TLSv1_2 = 1;
41 +
42 +#if (OPENSSL_API_COMPAT >= 0x10100000L) && !CRYPTOGRAPHY_IS_LIBRESSL
43 +static const long Cryptography_HAS_TLS1_METHOD = 0;
44 +const SSL_METHOD* (*TLSv1_method)(void) = NULL;
45 +const SSL_METHOD* (*TLSv1_server_method)(void) = NULL;
46 +const SSL_METHOD* (*TLSv1_client_method)(void) = NULL;
47 +#else
48 +static const long Cryptography_HAS_TLS1_METHOD = 1;
49 +#endif
50 +
51 +#if (OPENSSL_API_COMPAT >= 0x10100000L) && !CRYPTOGRAPHY_IS_LIBRESSL
52 +static const long Cryptography_HAS_TLS1_1_METHOD = 0;
53 +const SSL_METHOD* (*TLSv1_1_method)(void) = NULL;
54 +const SSL_METHOD* (*TLSv1_1_server_method)(void) = NULL;
55 +const SSL_METHOD* (*TLSv1_1_client_method)(void) = NULL;
56 +#else
57 +static const long Cryptography_HAS_TLS1_1_METHOD = 1;
58 +#endif
59 +
60 +#if (OPENSSL_API_COMPAT >= 0x10100000L) && !CRYPTOGRAPHY_IS_LIBRESSL
61 +static const long Cryptography_HAS_TLS1_2_METHOD = 0;
62 +const SSL_METHOD* (*TLSv1_2_method)(void) = NULL;
63 +const SSL_METHOD* (*TLSv1_2_server_method)(void) = NULL;
64 +const SSL_METHOD* (*TLSv1_2_client_method)(void) = NULL;
65 +#else
66 +static const long Cryptography_HAS_TLS1_2_METHOD = 1;
67 +#endif
68 +
69 +#if (OPENSSL_API_COMPAT >= 0x10100000L) && !CRYPTOGRAPHY_IS_LIBRESSL
70 +static const long Cryptography_HAS_DTLS1_METHOD = 0;
71 +const SSL_METHOD* (*DTLSv1_method)(void) = NULL;
72 +const SSL_METHOD* (*DTLSv1_server_method)(void) = NULL;
73 +const SSL_METHOD* (*DTLSv1_client_method)(void) = NULL;
74 +#else
75 +static const long Cryptography_HAS_DTLS1_METHOD = 1;
76 +#endif
77 +
78 static const long Cryptography_HAS_SSL_OP_MSIE_SSLV2_RSA_PADDING = 1;
79 static const long Cryptography_HAS_SSL_OP_NO_TICKET = 1;
80 static const long Cryptography_HAS_SSL_SET_SSL_CTX = 1;
81 diff --git a/src/cryptography/hazmat/bindings/openssl/_conditional.py b/src/cryptography/hazmat/bindings/openssl/_conditional.py
82 index 23dc38a4..c0dca00a 100644
83 --- a/src/cryptography/hazmat/bindings/openssl/_conditional.py
84 +++ b/src/cryptography/hazmat/bindings/openssl/_conditional.py
85 @@ -33,6 +33,38 @@ def cryptography_has_ssl3_method():
86 ]
87
88
89 +def cryptography_has_tls1_method():
90 + return [
91 + "TLSv1_method",
92 + "TLSv1_client_method",
93 + "TLSv1_server_method",
94 + ]
95 +
96 +
97 +def cryptography_has_tls1_1_method():
98 + return [
99 + "TLSv1_1_method",
100 + "TLSv1_1_client_method",
101 + "TLSv1_1_server_method",
102 + ]
103 +
104 +
105 +def cryptography_has_tls1_2_method():
106 + return [
107 + "TLSv1_2_method",
108 + "TLSv1_2_client_method",
109 + "TLSv1_2_server_method",
110 + ]
111 +
112 +
113 +def cryptography_has_dtls1_method():
114 + return [
115 + "DTLSv1_method",
116 + "DTLSv1_client_method",
117 + "DTLSv1_server_method",
118 + ]
119 +
120 +
121 def cryptography_has_102_verification():
122 return [
123 "X509_V_ERR_SUITE_B_INVALID_VERSION",
124 @@ -303,6 +335,10 @@ CONDITIONAL_NAMES = {
125 "Cryptography_HAS_RSA_OAEP_MD": cryptography_has_rsa_oaep_md,
126 "Cryptography_HAS_RSA_OAEP_LABEL": cryptography_has_rsa_oaep_label,
127 "Cryptography_HAS_SSL3_METHOD": cryptography_has_ssl3_method,
128 + "Cryptography_HAS_TLS1_METHOD": cryptography_has_tls1_method,
129 + "Cryptography_HAS_TLS1_1_METHOD": cryptography_has_tls1_1_method,
130 + "Cryptography_HAS_TLS1_2_METHOD": cryptography_has_tls1_2_method,
131 + "Cryptography_HAS_DTLS1_METHOD": cryptography_has_dtls1_method,
132 "Cryptography_HAS_102_VERIFICATION": cryptography_has_102_verification,
133 "Cryptography_HAS_110_VERIFICATION_PARAMS": (
134 cryptography_has_110_verification_params
135 --
136 2.26.2
137