@@ -139,124 +139,3 @@ index cd1cf24..53bcc4c 100644
139
139
140
140
# The _tkinter module.
141
141
#
142
- diff --git a/Modules/_ssl.c b/Modules/_ssl.c
143
- index f7fdbf4..204d501 100644
144
- --- a/Modules/_ssl.c
145
- +++ b/Modules/_ssl.c
146
- @@ -187,6 +187,11 @@ extern const SSL_METHOD *TLSv1_2_method(void);
147
- #endif
148
-
149
-
150
- + #if !defined(SSL_VERIFY_POST_HANDSHAKE) || !defined(TLS1_3_VERSION) || defined(OPENSSL_NO_TLS1_3)
151
- + #define PY_SSL_NO_POST_HS_AUTH
152
- + #endif
153
- +
154
- +
155
- enum py_ssl_error {
156
- /* these mirror ssl.h */
157
- PY_SSL_ERROR_NONE,
158
- @@ -231,7 +236,7 @@ enum py_proto_version {
159
- PY_PROTO_TLSv1 = TLS1_VERSION,
160
- PY_PROTO_TLSv1_1 = TLS1_1_VERSION,
161
- PY_PROTO_TLSv1_2 = TLS1_2_VERSION,
162
- - #ifdef TLS1_3_VERSION
163
- + #if defined(TLS1_3_VERSION)
164
- PY_PROTO_TLSv1_3 = TLS1_3_VERSION,
165
- #else
166
- PY_PROTO_TLSv1_3 = 0x304,
167
- @@ -293,7 +298,7 @@ typedef struct {
168
- */
169
- unsigned int hostflags;
170
- int protocol;
171
- - #ifdef TLS1_3_VERSION
172
- + #if !defined(PY_SSL_NO_POST_HS_AUTH)
173
- int post_handshake_auth;
174
- #endif
175
- PyObject *msg_cb;
176
- @@ -873,7 +878,7 @@ newPySSLSocket(PySSLContext *sslctx, PySocketSockObject *sock,
177
- SSL_set_mode(self->ssl,
178
- SSL_MODE_ACCEPT_MOVING_WRITE_BUFFER | SSL_MODE_AUTO_RETRY);
179
-
180
- - #ifdef TLS1_3_VERSION
181
- + #if !defined(PY_SSL_NO_POST_HS_AUTH)
182
- if (sslctx->post_handshake_auth == 1) {
183
- if (socket_type == PY_SSL_SERVER) {
184
- /* bpo-37428: OpenSSL does not ignore SSL_VERIFY_POST_HANDSHAKE.
185
- @@ -1016,6 +1021,7 @@ _ssl__SSLSocket_do_handshake_impl(PySSLSocket *self)
186
- } while (err.ssl == SSL_ERROR_WANT_READ ||
187
- err.ssl == SSL_ERROR_WANT_WRITE);
188
- Py_XDECREF(sock);
189
- +
190
- if (ret < 1)
191
- return PySSL_SetError(self, __FILE__, __LINE__);
192
- if (PySSL_ChainExceptions(self) < 0)
193
- @@ -2775,7 +2781,7 @@ static PyObject *
194
- _ssl__SSLSocket_verify_client_post_handshake_impl(PySSLSocket *self)
195
- /*[clinic end generated code: output=532147f3b1341425 input=6bfa874810a3d889]*/
196
- {
197
- - #ifdef TLS1_3_VERSION
198
- + #if !defined(PY_SSL_NO_POST_HS_AUTH)
199
- int err = SSL_verify_client_post_handshake(self->ssl);
200
- if (err == 0)
201
- return _setSSLError(get_state_sock(self), NULL, 0, __FILE__, __LINE__);
202
- @@ -3198,7 +3204,7 @@ _ssl__SSLContext_impl(PyTypeObject *type, int proto_version)
203
- X509_VERIFY_PARAM_set_flags(params, X509_V_FLAG_TRUSTED_FIRST);
204
- X509_VERIFY_PARAM_set_hostflags(params, self->hostflags);
205
-
206
- - #ifdef TLS1_3_VERSION
207
- + #if !defined(PY_SSL_NO_POST_HS_AUTH)
208
- self->post_handshake_auth = 0;
209
- SSL_CTX_set_post_handshake_auth(self->ctx, self->post_handshake_auth);
210
- #endif
211
- @@ -3576,7 +3582,7 @@ set_maximum_version(PySSLContext *self, PyObject *arg, void *c)
212
- return set_min_max_proto_version(self, arg, 1);
213
- }
214
-
215
- - #ifdef TLS1_3_VERSION
216
- + #if defined(TLS1_3_VERSION) && !defined(OPENSSL_NO_TLS1_3)
217
- static PyObject *
218
- get_num_tickets(PySSLContext *self, void *c)
219
- {
220
- @@ -3607,7 +3613,7 @@ set_num_tickets(PySSLContext *self, PyObject *arg, void *c)
221
-
222
- PyDoc_STRVAR(PySSLContext_num_tickets_doc,
223
- "Control the number of TLSv1.3 session tickets");
224
- - #endif /* TLS1_3_VERSION */
225
- + #endif /* defined(TLS1_3_VERSION) */
226
-
227
- static PyObject *
228
- get_security_level(PySSLContext *self, void *c)
229
- @@ -3710,14 +3716,14 @@ set_check_hostname(PySSLContext *self, PyObject *arg, void *c)
230
-
231
- static PyObject *
232
- get_post_handshake_auth(PySSLContext *self, void *c) {
233
- - #if TLS1_3_VERSION
234
- + #if !defined(PY_SSL_NO_POST_HS_AUTH)
235
- return PyBool_FromLong(self->post_handshake_auth);
236
- #else
237
- Py_RETURN_NONE;
238
- #endif
239
- }
240
-
241
- - #if TLS1_3_VERSION
242
- + #if !defined(PY_SSL_NO_POST_HS_AUTH)
243
- static int
244
- set_post_handshake_auth(PySSLContext *self, PyObject *arg, void *c) {
245
- if (arg == NULL) {
246
- @@ -4959,14 +4965,14 @@ static PyGetSetDef context_getsetlist[] = {
247
- (setter) _PySSLContext_set_msg_callback, NULL},
248
- {"sni_callback", (getter) get_sni_callback,
249
- (setter) set_sni_callback, PySSLContext_sni_callback_doc},
250
- - #ifdef TLS1_3_VERSION
251
- + #if defined(TLS1_3_VERSION) && !defined(OPENSSL_NO_TLS1_3)
252
- {"num_tickets", (getter) get_num_tickets,
253
- (setter) set_num_tickets, PySSLContext_num_tickets_doc},
254
- #endif
255
- {"options", (getter) get_options,
256
- (setter) set_options, NULL},
257
- {"post_handshake_auth", (getter) get_post_handshake_auth,
258
- - #ifdef TLS1_3_VERSION
259
- + #if !defined(PY_SSL_NO_POST_HS_AUTH)
260
- (setter) set_post_handshake_auth,
261
- #else
262
- NULL,
0 commit comments