1 /*[clinic input]
2 preserve
3 [clinic start generated code]*/
4 
5 PyDoc_STRVAR(_ssl__SSLSocket_do_handshake__doc__,
6 "do_handshake($self, /)\n"
7 "--\n"
8 "\n");
9 
10 #define _SSL__SSLSOCKET_DO_HANDSHAKE_METHODDEF    \
11     {"do_handshake", (PyCFunction)_ssl__SSLSocket_do_handshake, METH_NOARGS, _ssl__SSLSocket_do_handshake__doc__},
12 
13 static PyObject *
14 _ssl__SSLSocket_do_handshake_impl(PySSLSocket *self);
15 
16 static PyObject *
_ssl__SSLSocket_do_handshake(PySSLSocket * self,PyObject * Py_UNUSED (ignored))17 _ssl__SSLSocket_do_handshake(PySSLSocket *self, PyObject *Py_UNUSED(ignored))
18 {
19     return _ssl__SSLSocket_do_handshake_impl(self);
20 }
21 
22 PyDoc_STRVAR(_ssl__test_decode_cert__doc__,
23 "_test_decode_cert($module, path, /)\n"
24 "--\n"
25 "\n");
26 
27 #define _SSL__TEST_DECODE_CERT_METHODDEF    \
28     {"_test_decode_cert", (PyCFunction)_ssl__test_decode_cert, METH_O, _ssl__test_decode_cert__doc__},
29 
30 static PyObject *
31 _ssl__test_decode_cert_impl(PyObject *module, PyObject *path);
32 
33 static PyObject *
_ssl__test_decode_cert(PyObject * module,PyObject * arg)34 _ssl__test_decode_cert(PyObject *module, PyObject *arg)
35 {
36     PyObject *return_value = NULL;
37     PyObject *path;
38 
39     if (!PyArg_Parse(arg, "O&:_test_decode_cert", PyUnicode_FSConverter, &path)) {
40         goto exit;
41     }
42     return_value = _ssl__test_decode_cert_impl(module, path);
43 
44 exit:
45     return return_value;
46 }
47 
48 PyDoc_STRVAR(_ssl__SSLSocket_getpeercert__doc__,
49 "getpeercert($self, der=False, /)\n"
50 "--\n"
51 "\n"
52 "Returns the certificate for the peer.\n"
53 "\n"
54 "If no certificate was provided, returns None.  If a certificate was\n"
55 "provided, but not validated, returns an empty dictionary.  Otherwise\n"
56 "returns a dict containing information about the peer certificate.\n"
57 "\n"
58 "If the optional argument is True, returns a DER-encoded copy of the\n"
59 "peer certificate, or None if no certificate was provided.  This will\n"
60 "return the certificate even if it wasn\'t validated.");
61 
62 #define _SSL__SSLSOCKET_GETPEERCERT_METHODDEF    \
63     {"getpeercert", (PyCFunction)_ssl__SSLSocket_getpeercert, METH_FASTCALL, _ssl__SSLSocket_getpeercert__doc__},
64 
65 static PyObject *
66 _ssl__SSLSocket_getpeercert_impl(PySSLSocket *self, int binary_mode);
67 
68 static PyObject *
_ssl__SSLSocket_getpeercert(PySSLSocket * self,PyObject * const * args,Py_ssize_t nargs)69 _ssl__SSLSocket_getpeercert(PySSLSocket *self, PyObject *const *args, Py_ssize_t nargs)
70 {
71     PyObject *return_value = NULL;
72     int binary_mode = 0;
73 
74     if (!_PyArg_ParseStack(args, nargs, "|p:getpeercert",
75         &binary_mode)) {
76         goto exit;
77     }
78     return_value = _ssl__SSLSocket_getpeercert_impl(self, binary_mode);
79 
80 exit:
81     return return_value;
82 }
83 
84 PyDoc_STRVAR(_ssl__SSLSocket_shared_ciphers__doc__,
85 "shared_ciphers($self, /)\n"
86 "--\n"
87 "\n");
88 
89 #define _SSL__SSLSOCKET_SHARED_CIPHERS_METHODDEF    \
90     {"shared_ciphers", (PyCFunction)_ssl__SSLSocket_shared_ciphers, METH_NOARGS, _ssl__SSLSocket_shared_ciphers__doc__},
91 
92 static PyObject *
93 _ssl__SSLSocket_shared_ciphers_impl(PySSLSocket *self);
94 
95 static PyObject *
_ssl__SSLSocket_shared_ciphers(PySSLSocket * self,PyObject * Py_UNUSED (ignored))96 _ssl__SSLSocket_shared_ciphers(PySSLSocket *self, PyObject *Py_UNUSED(ignored))
97 {
98     return _ssl__SSLSocket_shared_ciphers_impl(self);
99 }
100 
101 PyDoc_STRVAR(_ssl__SSLSocket_cipher__doc__,
102 "cipher($self, /)\n"
103 "--\n"
104 "\n");
105 
106 #define _SSL__SSLSOCKET_CIPHER_METHODDEF    \
107     {"cipher", (PyCFunction)_ssl__SSLSocket_cipher, METH_NOARGS, _ssl__SSLSocket_cipher__doc__},
108 
109 static PyObject *
110 _ssl__SSLSocket_cipher_impl(PySSLSocket *self);
111 
112 static PyObject *
_ssl__SSLSocket_cipher(PySSLSocket * self,PyObject * Py_UNUSED (ignored))113 _ssl__SSLSocket_cipher(PySSLSocket *self, PyObject *Py_UNUSED(ignored))
114 {
115     return _ssl__SSLSocket_cipher_impl(self);
116 }
117 
118 PyDoc_STRVAR(_ssl__SSLSocket_version__doc__,
119 "version($self, /)\n"
120 "--\n"
121 "\n");
122 
123 #define _SSL__SSLSOCKET_VERSION_METHODDEF    \
124     {"version", (PyCFunction)_ssl__SSLSocket_version, METH_NOARGS, _ssl__SSLSocket_version__doc__},
125 
126 static PyObject *
127 _ssl__SSLSocket_version_impl(PySSLSocket *self);
128 
129 static PyObject *
_ssl__SSLSocket_version(PySSLSocket * self,PyObject * Py_UNUSED (ignored))130 _ssl__SSLSocket_version(PySSLSocket *self, PyObject *Py_UNUSED(ignored))
131 {
132     return _ssl__SSLSocket_version_impl(self);
133 }
134 
135 #if (HAVE_NPN)
136 
137 PyDoc_STRVAR(_ssl__SSLSocket_selected_npn_protocol__doc__,
138 "selected_npn_protocol($self, /)\n"
139 "--\n"
140 "\n");
141 
142 #define _SSL__SSLSOCKET_SELECTED_NPN_PROTOCOL_METHODDEF    \
143     {"selected_npn_protocol", (PyCFunction)_ssl__SSLSocket_selected_npn_protocol, METH_NOARGS, _ssl__SSLSocket_selected_npn_protocol__doc__},
144 
145 static PyObject *
146 _ssl__SSLSocket_selected_npn_protocol_impl(PySSLSocket *self);
147 
148 static PyObject *
_ssl__SSLSocket_selected_npn_protocol(PySSLSocket * self,PyObject * Py_UNUSED (ignored))149 _ssl__SSLSocket_selected_npn_protocol(PySSLSocket *self, PyObject *Py_UNUSED(ignored))
150 {
151     return _ssl__SSLSocket_selected_npn_protocol_impl(self);
152 }
153 
154 #endif /* (HAVE_NPN) */
155 
156 #if (HAVE_ALPN)
157 
158 PyDoc_STRVAR(_ssl__SSLSocket_selected_alpn_protocol__doc__,
159 "selected_alpn_protocol($self, /)\n"
160 "--\n"
161 "\n");
162 
163 #define _SSL__SSLSOCKET_SELECTED_ALPN_PROTOCOL_METHODDEF    \
164     {"selected_alpn_protocol", (PyCFunction)_ssl__SSLSocket_selected_alpn_protocol, METH_NOARGS, _ssl__SSLSocket_selected_alpn_protocol__doc__},
165 
166 static PyObject *
167 _ssl__SSLSocket_selected_alpn_protocol_impl(PySSLSocket *self);
168 
169 static PyObject *
_ssl__SSLSocket_selected_alpn_protocol(PySSLSocket * self,PyObject * Py_UNUSED (ignored))170 _ssl__SSLSocket_selected_alpn_protocol(PySSLSocket *self, PyObject *Py_UNUSED(ignored))
171 {
172     return _ssl__SSLSocket_selected_alpn_protocol_impl(self);
173 }
174 
175 #endif /* (HAVE_ALPN) */
176 
177 PyDoc_STRVAR(_ssl__SSLSocket_compression__doc__,
178 "compression($self, /)\n"
179 "--\n"
180 "\n");
181 
182 #define _SSL__SSLSOCKET_COMPRESSION_METHODDEF    \
183     {"compression", (PyCFunction)_ssl__SSLSocket_compression, METH_NOARGS, _ssl__SSLSocket_compression__doc__},
184 
185 static PyObject *
186 _ssl__SSLSocket_compression_impl(PySSLSocket *self);
187 
188 static PyObject *
_ssl__SSLSocket_compression(PySSLSocket * self,PyObject * Py_UNUSED (ignored))189 _ssl__SSLSocket_compression(PySSLSocket *self, PyObject *Py_UNUSED(ignored))
190 {
191     return _ssl__SSLSocket_compression_impl(self);
192 }
193 
194 PyDoc_STRVAR(_ssl__SSLSocket_write__doc__,
195 "write($self, b, /)\n"
196 "--\n"
197 "\n"
198 "Writes the bytes-like object b into the SSL object.\n"
199 "\n"
200 "Returns the number of bytes written.");
201 
202 #define _SSL__SSLSOCKET_WRITE_METHODDEF    \
203     {"write", (PyCFunction)_ssl__SSLSocket_write, METH_O, _ssl__SSLSocket_write__doc__},
204 
205 static PyObject *
206 _ssl__SSLSocket_write_impl(PySSLSocket *self, Py_buffer *b);
207 
208 static PyObject *
_ssl__SSLSocket_write(PySSLSocket * self,PyObject * arg)209 _ssl__SSLSocket_write(PySSLSocket *self, PyObject *arg)
210 {
211     PyObject *return_value = NULL;
212     Py_buffer b = {NULL, NULL};
213 
214     if (!PyArg_Parse(arg, "y*:write", &b)) {
215         goto exit;
216     }
217     return_value = _ssl__SSLSocket_write_impl(self, &b);
218 
219 exit:
220     /* Cleanup for b */
221     if (b.obj) {
222        PyBuffer_Release(&b);
223     }
224 
225     return return_value;
226 }
227 
228 PyDoc_STRVAR(_ssl__SSLSocket_pending__doc__,
229 "pending($self, /)\n"
230 "--\n"
231 "\n"
232 "Returns the number of already decrypted bytes available for read, pending on the connection.");
233 
234 #define _SSL__SSLSOCKET_PENDING_METHODDEF    \
235     {"pending", (PyCFunction)_ssl__SSLSocket_pending, METH_NOARGS, _ssl__SSLSocket_pending__doc__},
236 
237 static PyObject *
238 _ssl__SSLSocket_pending_impl(PySSLSocket *self);
239 
240 static PyObject *
_ssl__SSLSocket_pending(PySSLSocket * self,PyObject * Py_UNUSED (ignored))241 _ssl__SSLSocket_pending(PySSLSocket *self, PyObject *Py_UNUSED(ignored))
242 {
243     return _ssl__SSLSocket_pending_impl(self);
244 }
245 
246 PyDoc_STRVAR(_ssl__SSLSocket_read__doc__,
247 "read(size, [buffer])\n"
248 "Read up to size bytes from the SSL socket.");
249 
250 #define _SSL__SSLSOCKET_READ_METHODDEF    \
251     {"read", (PyCFunction)_ssl__SSLSocket_read, METH_VARARGS, _ssl__SSLSocket_read__doc__},
252 
253 static PyObject *
254 _ssl__SSLSocket_read_impl(PySSLSocket *self, int len, int group_right_1,
255                           Py_buffer *buffer);
256 
257 static PyObject *
_ssl__SSLSocket_read(PySSLSocket * self,PyObject * args)258 _ssl__SSLSocket_read(PySSLSocket *self, PyObject *args)
259 {
260     PyObject *return_value = NULL;
261     int len;
262     int group_right_1 = 0;
263     Py_buffer buffer = {NULL, NULL};
264 
265     switch (PyTuple_GET_SIZE(args)) {
266         case 1:
267             if (!PyArg_ParseTuple(args, "i:read", &len)) {
268                 goto exit;
269             }
270             break;
271         case 2:
272             if (!PyArg_ParseTuple(args, "iw*:read", &len, &buffer)) {
273                 goto exit;
274             }
275             group_right_1 = 1;
276             break;
277         default:
278             PyErr_SetString(PyExc_TypeError, "_ssl._SSLSocket.read requires 1 to 2 arguments");
279             goto exit;
280     }
281     return_value = _ssl__SSLSocket_read_impl(self, len, group_right_1, &buffer);
282 
283 exit:
284     /* Cleanup for buffer */
285     if (buffer.obj) {
286        PyBuffer_Release(&buffer);
287     }
288 
289     return return_value;
290 }
291 
292 PyDoc_STRVAR(_ssl__SSLSocket_shutdown__doc__,
293 "shutdown($self, /)\n"
294 "--\n"
295 "\n"
296 "Does the SSL shutdown handshake with the remote end.");
297 
298 #define _SSL__SSLSOCKET_SHUTDOWN_METHODDEF    \
299     {"shutdown", (PyCFunction)_ssl__SSLSocket_shutdown, METH_NOARGS, _ssl__SSLSocket_shutdown__doc__},
300 
301 static PyObject *
302 _ssl__SSLSocket_shutdown_impl(PySSLSocket *self);
303 
304 static PyObject *
_ssl__SSLSocket_shutdown(PySSLSocket * self,PyObject * Py_UNUSED (ignored))305 _ssl__SSLSocket_shutdown(PySSLSocket *self, PyObject *Py_UNUSED(ignored))
306 {
307     return _ssl__SSLSocket_shutdown_impl(self);
308 }
309 
310 PyDoc_STRVAR(_ssl__SSLSocket_get_channel_binding__doc__,
311 "get_channel_binding($self, /, cb_type=\'tls-unique\')\n"
312 "--\n"
313 "\n"
314 "Get channel binding data for current connection.\n"
315 "\n"
316 "Raise ValueError if the requested `cb_type` is not supported.  Return bytes\n"
317 "of the data or None if the data is not available (e.g. before the handshake).\n"
318 "Only \'tls-unique\' channel binding data from RFC 5929 is supported.");
319 
320 #define _SSL__SSLSOCKET_GET_CHANNEL_BINDING_METHODDEF    \
321     {"get_channel_binding", (PyCFunction)_ssl__SSLSocket_get_channel_binding, METH_FASTCALL|METH_KEYWORDS, _ssl__SSLSocket_get_channel_binding__doc__},
322 
323 static PyObject *
324 _ssl__SSLSocket_get_channel_binding_impl(PySSLSocket *self,
325                                          const char *cb_type);
326 
327 static PyObject *
_ssl__SSLSocket_get_channel_binding(PySSLSocket * self,PyObject * const * args,Py_ssize_t nargs,PyObject * kwnames)328 _ssl__SSLSocket_get_channel_binding(PySSLSocket *self, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
329 {
330     PyObject *return_value = NULL;
331     static const char * const _keywords[] = {"cb_type", NULL};
332     static _PyArg_Parser _parser = {"|s:get_channel_binding", _keywords, 0};
333     const char *cb_type = "tls-unique";
334 
335     if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
336         &cb_type)) {
337         goto exit;
338     }
339     return_value = _ssl__SSLSocket_get_channel_binding_impl(self, cb_type);
340 
341 exit:
342     return return_value;
343 }
344 
345 PyDoc_STRVAR(_ssl__SSLSocket_verify_client_post_handshake__doc__,
346 "verify_client_post_handshake($self, /)\n"
347 "--\n"
348 "\n"
349 "Initiate TLS 1.3 post-handshake authentication");
350 
351 #define _SSL__SSLSOCKET_VERIFY_CLIENT_POST_HANDSHAKE_METHODDEF    \
352     {"verify_client_post_handshake", (PyCFunction)_ssl__SSLSocket_verify_client_post_handshake, METH_NOARGS, _ssl__SSLSocket_verify_client_post_handshake__doc__},
353 
354 static PyObject *
355 _ssl__SSLSocket_verify_client_post_handshake_impl(PySSLSocket *self);
356 
357 static PyObject *
_ssl__SSLSocket_verify_client_post_handshake(PySSLSocket * self,PyObject * Py_UNUSED (ignored))358 _ssl__SSLSocket_verify_client_post_handshake(PySSLSocket *self, PyObject *Py_UNUSED(ignored))
359 {
360     return _ssl__SSLSocket_verify_client_post_handshake_impl(self);
361 }
362 
363 static PyObject *
364 _ssl__SSLContext_impl(PyTypeObject *type, int proto_version);
365 
366 static PyObject *
_ssl__SSLContext(PyTypeObject * type,PyObject * args,PyObject * kwargs)367 _ssl__SSLContext(PyTypeObject *type, PyObject *args, PyObject *kwargs)
368 {
369     PyObject *return_value = NULL;
370     int proto_version;
371 
372     if ((type == &PySSLContext_Type) &&
373         !_PyArg_NoKeywords("_SSLContext", kwargs)) {
374         goto exit;
375     }
376     if (!PyArg_ParseTuple(args, "i:_SSLContext",
377         &proto_version)) {
378         goto exit;
379     }
380     return_value = _ssl__SSLContext_impl(type, proto_version);
381 
382 exit:
383     return return_value;
384 }
385 
386 PyDoc_STRVAR(_ssl__SSLContext_set_ciphers__doc__,
387 "set_ciphers($self, cipherlist, /)\n"
388 "--\n"
389 "\n");
390 
391 #define _SSL__SSLCONTEXT_SET_CIPHERS_METHODDEF    \
392     {"set_ciphers", (PyCFunction)_ssl__SSLContext_set_ciphers, METH_O, _ssl__SSLContext_set_ciphers__doc__},
393 
394 static PyObject *
395 _ssl__SSLContext_set_ciphers_impl(PySSLContext *self, const char *cipherlist);
396 
397 static PyObject *
_ssl__SSLContext_set_ciphers(PySSLContext * self,PyObject * arg)398 _ssl__SSLContext_set_ciphers(PySSLContext *self, PyObject *arg)
399 {
400     PyObject *return_value = NULL;
401     const char *cipherlist;
402 
403     if (!PyArg_Parse(arg, "s:set_ciphers", &cipherlist)) {
404         goto exit;
405     }
406     return_value = _ssl__SSLContext_set_ciphers_impl(self, cipherlist);
407 
408 exit:
409     return return_value;
410 }
411 
412 #if (OPENSSL_VERSION_NUMBER >= 0x10002000UL)
413 
414 PyDoc_STRVAR(_ssl__SSLContext_get_ciphers__doc__,
415 "get_ciphers($self, /)\n"
416 "--\n"
417 "\n");
418 
419 #define _SSL__SSLCONTEXT_GET_CIPHERS_METHODDEF    \
420     {"get_ciphers", (PyCFunction)_ssl__SSLContext_get_ciphers, METH_NOARGS, _ssl__SSLContext_get_ciphers__doc__},
421 
422 static PyObject *
423 _ssl__SSLContext_get_ciphers_impl(PySSLContext *self);
424 
425 static PyObject *
_ssl__SSLContext_get_ciphers(PySSLContext * self,PyObject * Py_UNUSED (ignored))426 _ssl__SSLContext_get_ciphers(PySSLContext *self, PyObject *Py_UNUSED(ignored))
427 {
428     return _ssl__SSLContext_get_ciphers_impl(self);
429 }
430 
431 #endif /* (OPENSSL_VERSION_NUMBER >= 0x10002000UL) */
432 
433 PyDoc_STRVAR(_ssl__SSLContext__set_npn_protocols__doc__,
434 "_set_npn_protocols($self, protos, /)\n"
435 "--\n"
436 "\n");
437 
438 #define _SSL__SSLCONTEXT__SET_NPN_PROTOCOLS_METHODDEF    \
439     {"_set_npn_protocols", (PyCFunction)_ssl__SSLContext__set_npn_protocols, METH_O, _ssl__SSLContext__set_npn_protocols__doc__},
440 
441 static PyObject *
442 _ssl__SSLContext__set_npn_protocols_impl(PySSLContext *self,
443                                          Py_buffer *protos);
444 
445 static PyObject *
_ssl__SSLContext__set_npn_protocols(PySSLContext * self,PyObject * arg)446 _ssl__SSLContext__set_npn_protocols(PySSLContext *self, PyObject *arg)
447 {
448     PyObject *return_value = NULL;
449     Py_buffer protos = {NULL, NULL};
450 
451     if (!PyArg_Parse(arg, "y*:_set_npn_protocols", &protos)) {
452         goto exit;
453     }
454     return_value = _ssl__SSLContext__set_npn_protocols_impl(self, &protos);
455 
456 exit:
457     /* Cleanup for protos */
458     if (protos.obj) {
459        PyBuffer_Release(&protos);
460     }
461 
462     return return_value;
463 }
464 
465 PyDoc_STRVAR(_ssl__SSLContext__set_alpn_protocols__doc__,
466 "_set_alpn_protocols($self, protos, /)\n"
467 "--\n"
468 "\n");
469 
470 #define _SSL__SSLCONTEXT__SET_ALPN_PROTOCOLS_METHODDEF    \
471     {"_set_alpn_protocols", (PyCFunction)_ssl__SSLContext__set_alpn_protocols, METH_O, _ssl__SSLContext__set_alpn_protocols__doc__},
472 
473 static PyObject *
474 _ssl__SSLContext__set_alpn_protocols_impl(PySSLContext *self,
475                                           Py_buffer *protos);
476 
477 static PyObject *
_ssl__SSLContext__set_alpn_protocols(PySSLContext * self,PyObject * arg)478 _ssl__SSLContext__set_alpn_protocols(PySSLContext *self, PyObject *arg)
479 {
480     PyObject *return_value = NULL;
481     Py_buffer protos = {NULL, NULL};
482 
483     if (!PyArg_Parse(arg, "y*:_set_alpn_protocols", &protos)) {
484         goto exit;
485     }
486     return_value = _ssl__SSLContext__set_alpn_protocols_impl(self, &protos);
487 
488 exit:
489     /* Cleanup for protos */
490     if (protos.obj) {
491        PyBuffer_Release(&protos);
492     }
493 
494     return return_value;
495 }
496 
497 PyDoc_STRVAR(_ssl__SSLContext_load_cert_chain__doc__,
498 "load_cert_chain($self, /, certfile, keyfile=None, password=None)\n"
499 "--\n"
500 "\n");
501 
502 #define _SSL__SSLCONTEXT_LOAD_CERT_CHAIN_METHODDEF    \
503     {"load_cert_chain", (PyCFunction)_ssl__SSLContext_load_cert_chain, METH_FASTCALL|METH_KEYWORDS, _ssl__SSLContext_load_cert_chain__doc__},
504 
505 static PyObject *
506 _ssl__SSLContext_load_cert_chain_impl(PySSLContext *self, PyObject *certfile,
507                                       PyObject *keyfile, PyObject *password);
508 
509 static PyObject *
_ssl__SSLContext_load_cert_chain(PySSLContext * self,PyObject * const * args,Py_ssize_t nargs,PyObject * kwnames)510 _ssl__SSLContext_load_cert_chain(PySSLContext *self, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
511 {
512     PyObject *return_value = NULL;
513     static const char * const _keywords[] = {"certfile", "keyfile", "password", NULL};
514     static _PyArg_Parser _parser = {"O|OO:load_cert_chain", _keywords, 0};
515     PyObject *certfile;
516     PyObject *keyfile = NULL;
517     PyObject *password = NULL;
518 
519     if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
520         &certfile, &keyfile, &password)) {
521         goto exit;
522     }
523     return_value = _ssl__SSLContext_load_cert_chain_impl(self, certfile, keyfile, password);
524 
525 exit:
526     return return_value;
527 }
528 
529 PyDoc_STRVAR(_ssl__SSLContext_load_verify_locations__doc__,
530 "load_verify_locations($self, /, cafile=None, capath=None, cadata=None)\n"
531 "--\n"
532 "\n");
533 
534 #define _SSL__SSLCONTEXT_LOAD_VERIFY_LOCATIONS_METHODDEF    \
535     {"load_verify_locations", (PyCFunction)_ssl__SSLContext_load_verify_locations, METH_FASTCALL|METH_KEYWORDS, _ssl__SSLContext_load_verify_locations__doc__},
536 
537 static PyObject *
538 _ssl__SSLContext_load_verify_locations_impl(PySSLContext *self,
539                                             PyObject *cafile,
540                                             PyObject *capath,
541                                             PyObject *cadata);
542 
543 static PyObject *
_ssl__SSLContext_load_verify_locations(PySSLContext * self,PyObject * const * args,Py_ssize_t nargs,PyObject * kwnames)544 _ssl__SSLContext_load_verify_locations(PySSLContext *self, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
545 {
546     PyObject *return_value = NULL;
547     static const char * const _keywords[] = {"cafile", "capath", "cadata", NULL};
548     static _PyArg_Parser _parser = {"|OOO:load_verify_locations", _keywords, 0};
549     PyObject *cafile = NULL;
550     PyObject *capath = NULL;
551     PyObject *cadata = NULL;
552 
553     if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
554         &cafile, &capath, &cadata)) {
555         goto exit;
556     }
557     return_value = _ssl__SSLContext_load_verify_locations_impl(self, cafile, capath, cadata);
558 
559 exit:
560     return return_value;
561 }
562 
563 PyDoc_STRVAR(_ssl__SSLContext_load_dh_params__doc__,
564 "load_dh_params($self, path, /)\n"
565 "--\n"
566 "\n");
567 
568 #define _SSL__SSLCONTEXT_LOAD_DH_PARAMS_METHODDEF    \
569     {"load_dh_params", (PyCFunction)_ssl__SSLContext_load_dh_params, METH_O, _ssl__SSLContext_load_dh_params__doc__},
570 
571 PyDoc_STRVAR(_ssl__SSLContext__wrap_socket__doc__,
572 "_wrap_socket($self, /, sock, server_side, server_hostname=None, *,\n"
573 "             owner=None, session=None)\n"
574 "--\n"
575 "\n");
576 
577 #define _SSL__SSLCONTEXT__WRAP_SOCKET_METHODDEF    \
578     {"_wrap_socket", (PyCFunction)_ssl__SSLContext__wrap_socket, METH_FASTCALL|METH_KEYWORDS, _ssl__SSLContext__wrap_socket__doc__},
579 
580 static PyObject *
581 _ssl__SSLContext__wrap_socket_impl(PySSLContext *self, PyObject *sock,
582                                    int server_side, PyObject *hostname_obj,
583                                    PyObject *owner, PyObject *session);
584 
585 static PyObject *
_ssl__SSLContext__wrap_socket(PySSLContext * self,PyObject * const * args,Py_ssize_t nargs,PyObject * kwnames)586 _ssl__SSLContext__wrap_socket(PySSLContext *self, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
587 {
588     PyObject *return_value = NULL;
589     static const char * const _keywords[] = {"sock", "server_side", "server_hostname", "owner", "session", NULL};
590     static _PyArg_Parser _parser = {"O!i|O$OO:_wrap_socket", _keywords, 0};
591     PyObject *sock;
592     int server_side;
593     PyObject *hostname_obj = Py_None;
594     PyObject *owner = Py_None;
595     PyObject *session = Py_None;
596 
597     if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
598         PySocketModule.Sock_Type, &sock, &server_side, &hostname_obj, &owner, &session)) {
599         goto exit;
600     }
601     return_value = _ssl__SSLContext__wrap_socket_impl(self, sock, server_side, hostname_obj, owner, session);
602 
603 exit:
604     return return_value;
605 }
606 
607 PyDoc_STRVAR(_ssl__SSLContext__wrap_bio__doc__,
608 "_wrap_bio($self, /, incoming, outgoing, server_side,\n"
609 "          server_hostname=None, *, owner=None, session=None)\n"
610 "--\n"
611 "\n");
612 
613 #define _SSL__SSLCONTEXT__WRAP_BIO_METHODDEF    \
614     {"_wrap_bio", (PyCFunction)_ssl__SSLContext__wrap_bio, METH_FASTCALL|METH_KEYWORDS, _ssl__SSLContext__wrap_bio__doc__},
615 
616 static PyObject *
617 _ssl__SSLContext__wrap_bio_impl(PySSLContext *self, PySSLMemoryBIO *incoming,
618                                 PySSLMemoryBIO *outgoing, int server_side,
619                                 PyObject *hostname_obj, PyObject *owner,
620                                 PyObject *session);
621 
622 static PyObject *
_ssl__SSLContext__wrap_bio(PySSLContext * self,PyObject * const * args,Py_ssize_t nargs,PyObject * kwnames)623 _ssl__SSLContext__wrap_bio(PySSLContext *self, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
624 {
625     PyObject *return_value = NULL;
626     static const char * const _keywords[] = {"incoming", "outgoing", "server_side", "server_hostname", "owner", "session", NULL};
627     static _PyArg_Parser _parser = {"O!O!i|O$OO:_wrap_bio", _keywords, 0};
628     PySSLMemoryBIO *incoming;
629     PySSLMemoryBIO *outgoing;
630     int server_side;
631     PyObject *hostname_obj = Py_None;
632     PyObject *owner = Py_None;
633     PyObject *session = Py_None;
634 
635     if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
636         &PySSLMemoryBIO_Type, &incoming, &PySSLMemoryBIO_Type, &outgoing, &server_side, &hostname_obj, &owner, &session)) {
637         goto exit;
638     }
639     return_value = _ssl__SSLContext__wrap_bio_impl(self, incoming, outgoing, server_side, hostname_obj, owner, session);
640 
641 exit:
642     return return_value;
643 }
644 
645 PyDoc_STRVAR(_ssl__SSLContext_session_stats__doc__,
646 "session_stats($self, /)\n"
647 "--\n"
648 "\n");
649 
650 #define _SSL__SSLCONTEXT_SESSION_STATS_METHODDEF    \
651     {"session_stats", (PyCFunction)_ssl__SSLContext_session_stats, METH_NOARGS, _ssl__SSLContext_session_stats__doc__},
652 
653 static PyObject *
654 _ssl__SSLContext_session_stats_impl(PySSLContext *self);
655 
656 static PyObject *
_ssl__SSLContext_session_stats(PySSLContext * self,PyObject * Py_UNUSED (ignored))657 _ssl__SSLContext_session_stats(PySSLContext *self, PyObject *Py_UNUSED(ignored))
658 {
659     return _ssl__SSLContext_session_stats_impl(self);
660 }
661 
662 PyDoc_STRVAR(_ssl__SSLContext_set_default_verify_paths__doc__,
663 "set_default_verify_paths($self, /)\n"
664 "--\n"
665 "\n");
666 
667 #define _SSL__SSLCONTEXT_SET_DEFAULT_VERIFY_PATHS_METHODDEF    \
668     {"set_default_verify_paths", (PyCFunction)_ssl__SSLContext_set_default_verify_paths, METH_NOARGS, _ssl__SSLContext_set_default_verify_paths__doc__},
669 
670 static PyObject *
671 _ssl__SSLContext_set_default_verify_paths_impl(PySSLContext *self);
672 
673 static PyObject *
_ssl__SSLContext_set_default_verify_paths(PySSLContext * self,PyObject * Py_UNUSED (ignored))674 _ssl__SSLContext_set_default_verify_paths(PySSLContext *self, PyObject *Py_UNUSED(ignored))
675 {
676     return _ssl__SSLContext_set_default_verify_paths_impl(self);
677 }
678 
679 #if !defined(OPENSSL_NO_ECDH)
680 
681 PyDoc_STRVAR(_ssl__SSLContext_set_ecdh_curve__doc__,
682 "set_ecdh_curve($self, name, /)\n"
683 "--\n"
684 "\n");
685 
686 #define _SSL__SSLCONTEXT_SET_ECDH_CURVE_METHODDEF    \
687     {"set_ecdh_curve", (PyCFunction)_ssl__SSLContext_set_ecdh_curve, METH_O, _ssl__SSLContext_set_ecdh_curve__doc__},
688 
689 #endif /* !defined(OPENSSL_NO_ECDH) */
690 
691 PyDoc_STRVAR(_ssl__SSLContext_cert_store_stats__doc__,
692 "cert_store_stats($self, /)\n"
693 "--\n"
694 "\n"
695 "Returns quantities of loaded X.509 certificates.\n"
696 "\n"
697 "X.509 certificates with a CA extension and certificate revocation lists\n"
698 "inside the context\'s cert store.\n"
699 "\n"
700 "NOTE: Certificates in a capath directory aren\'t loaded unless they have\n"
701 "been used at least once.");
702 
703 #define _SSL__SSLCONTEXT_CERT_STORE_STATS_METHODDEF    \
704     {"cert_store_stats", (PyCFunction)_ssl__SSLContext_cert_store_stats, METH_NOARGS, _ssl__SSLContext_cert_store_stats__doc__},
705 
706 static PyObject *
707 _ssl__SSLContext_cert_store_stats_impl(PySSLContext *self);
708 
709 static PyObject *
_ssl__SSLContext_cert_store_stats(PySSLContext * self,PyObject * Py_UNUSED (ignored))710 _ssl__SSLContext_cert_store_stats(PySSLContext *self, PyObject *Py_UNUSED(ignored))
711 {
712     return _ssl__SSLContext_cert_store_stats_impl(self);
713 }
714 
715 PyDoc_STRVAR(_ssl__SSLContext_get_ca_certs__doc__,
716 "get_ca_certs($self, /, binary_form=False)\n"
717 "--\n"
718 "\n"
719 "Returns a list of dicts with information of loaded CA certs.\n"
720 "\n"
721 "If the optional argument is True, returns a DER-encoded copy of the CA\n"
722 "certificate.\n"
723 "\n"
724 "NOTE: Certificates in a capath directory aren\'t loaded unless they have\n"
725 "been used at least once.");
726 
727 #define _SSL__SSLCONTEXT_GET_CA_CERTS_METHODDEF    \
728     {"get_ca_certs", (PyCFunction)_ssl__SSLContext_get_ca_certs, METH_FASTCALL|METH_KEYWORDS, _ssl__SSLContext_get_ca_certs__doc__},
729 
730 static PyObject *
731 _ssl__SSLContext_get_ca_certs_impl(PySSLContext *self, int binary_form);
732 
733 static PyObject *
_ssl__SSLContext_get_ca_certs(PySSLContext * self,PyObject * const * args,Py_ssize_t nargs,PyObject * kwnames)734 _ssl__SSLContext_get_ca_certs(PySSLContext *self, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
735 {
736     PyObject *return_value = NULL;
737     static const char * const _keywords[] = {"binary_form", NULL};
738     static _PyArg_Parser _parser = {"|p:get_ca_certs", _keywords, 0};
739     int binary_form = 0;
740 
741     if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
742         &binary_form)) {
743         goto exit;
744     }
745     return_value = _ssl__SSLContext_get_ca_certs_impl(self, binary_form);
746 
747 exit:
748     return return_value;
749 }
750 
751 static PyObject *
752 _ssl_MemoryBIO_impl(PyTypeObject *type);
753 
754 static PyObject *
_ssl_MemoryBIO(PyTypeObject * type,PyObject * args,PyObject * kwargs)755 _ssl_MemoryBIO(PyTypeObject *type, PyObject *args, PyObject *kwargs)
756 {
757     PyObject *return_value = NULL;
758 
759     if ((type == &PySSLMemoryBIO_Type) &&
760         !_PyArg_NoPositional("MemoryBIO", args)) {
761         goto exit;
762     }
763     if ((type == &PySSLMemoryBIO_Type) &&
764         !_PyArg_NoKeywords("MemoryBIO", kwargs)) {
765         goto exit;
766     }
767     return_value = _ssl_MemoryBIO_impl(type);
768 
769 exit:
770     return return_value;
771 }
772 
773 PyDoc_STRVAR(_ssl_MemoryBIO_read__doc__,
774 "read($self, size=-1, /)\n"
775 "--\n"
776 "\n"
777 "Read up to size bytes from the memory BIO.\n"
778 "\n"
779 "If size is not specified, read the entire buffer.\n"
780 "If the return value is an empty bytes instance, this means either\n"
781 "EOF or that no data is available. Use the \"eof\" property to\n"
782 "distinguish between the two.");
783 
784 #define _SSL_MEMORYBIO_READ_METHODDEF    \
785     {"read", (PyCFunction)_ssl_MemoryBIO_read, METH_FASTCALL, _ssl_MemoryBIO_read__doc__},
786 
787 static PyObject *
788 _ssl_MemoryBIO_read_impl(PySSLMemoryBIO *self, int len);
789 
790 static PyObject *
_ssl_MemoryBIO_read(PySSLMemoryBIO * self,PyObject * const * args,Py_ssize_t nargs)791 _ssl_MemoryBIO_read(PySSLMemoryBIO *self, PyObject *const *args, Py_ssize_t nargs)
792 {
793     PyObject *return_value = NULL;
794     int len = -1;
795 
796     if (!_PyArg_ParseStack(args, nargs, "|i:read",
797         &len)) {
798         goto exit;
799     }
800     return_value = _ssl_MemoryBIO_read_impl(self, len);
801 
802 exit:
803     return return_value;
804 }
805 
806 PyDoc_STRVAR(_ssl_MemoryBIO_write__doc__,
807 "write($self, b, /)\n"
808 "--\n"
809 "\n"
810 "Writes the bytes b into the memory BIO.\n"
811 "\n"
812 "Returns the number of bytes written.");
813 
814 #define _SSL_MEMORYBIO_WRITE_METHODDEF    \
815     {"write", (PyCFunction)_ssl_MemoryBIO_write, METH_O, _ssl_MemoryBIO_write__doc__},
816 
817 static PyObject *
818 _ssl_MemoryBIO_write_impl(PySSLMemoryBIO *self, Py_buffer *b);
819 
820 static PyObject *
_ssl_MemoryBIO_write(PySSLMemoryBIO * self,PyObject * arg)821 _ssl_MemoryBIO_write(PySSLMemoryBIO *self, PyObject *arg)
822 {
823     PyObject *return_value = NULL;
824     Py_buffer b = {NULL, NULL};
825 
826     if (!PyArg_Parse(arg, "y*:write", &b)) {
827         goto exit;
828     }
829     return_value = _ssl_MemoryBIO_write_impl(self, &b);
830 
831 exit:
832     /* Cleanup for b */
833     if (b.obj) {
834        PyBuffer_Release(&b);
835     }
836 
837     return return_value;
838 }
839 
840 PyDoc_STRVAR(_ssl_MemoryBIO_write_eof__doc__,
841 "write_eof($self, /)\n"
842 "--\n"
843 "\n"
844 "Write an EOF marker to the memory BIO.\n"
845 "\n"
846 "When all data has been read, the \"eof\" property will be True.");
847 
848 #define _SSL_MEMORYBIO_WRITE_EOF_METHODDEF    \
849     {"write_eof", (PyCFunction)_ssl_MemoryBIO_write_eof, METH_NOARGS, _ssl_MemoryBIO_write_eof__doc__},
850 
851 static PyObject *
852 _ssl_MemoryBIO_write_eof_impl(PySSLMemoryBIO *self);
853 
854 static PyObject *
_ssl_MemoryBIO_write_eof(PySSLMemoryBIO * self,PyObject * Py_UNUSED (ignored))855 _ssl_MemoryBIO_write_eof(PySSLMemoryBIO *self, PyObject *Py_UNUSED(ignored))
856 {
857     return _ssl_MemoryBIO_write_eof_impl(self);
858 }
859 
860 PyDoc_STRVAR(_ssl_RAND_add__doc__,
861 "RAND_add($module, string, entropy, /)\n"
862 "--\n"
863 "\n"
864 "Mix string into the OpenSSL PRNG state.\n"
865 "\n"
866 "entropy (a float) is a lower bound on the entropy contained in\n"
867 "string.  See RFC 4086.");
868 
869 #define _SSL_RAND_ADD_METHODDEF    \
870     {"RAND_add", (PyCFunction)_ssl_RAND_add, METH_FASTCALL, _ssl_RAND_add__doc__},
871 
872 static PyObject *
873 _ssl_RAND_add_impl(PyObject *module, Py_buffer *view, double entropy);
874 
875 static PyObject *
_ssl_RAND_add(PyObject * module,PyObject * const * args,Py_ssize_t nargs)876 _ssl_RAND_add(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
877 {
878     PyObject *return_value = NULL;
879     Py_buffer view = {NULL, NULL};
880     double entropy;
881 
882     if (!_PyArg_ParseStack(args, nargs, "s*d:RAND_add",
883         &view, &entropy)) {
884         goto exit;
885     }
886     return_value = _ssl_RAND_add_impl(module, &view, entropy);
887 
888 exit:
889     /* Cleanup for view */
890     if (view.obj) {
891        PyBuffer_Release(&view);
892     }
893 
894     return return_value;
895 }
896 
897 PyDoc_STRVAR(_ssl_RAND_bytes__doc__,
898 "RAND_bytes($module, n, /)\n"
899 "--\n"
900 "\n"
901 "Generate n cryptographically strong pseudo-random bytes.");
902 
903 #define _SSL_RAND_BYTES_METHODDEF    \
904     {"RAND_bytes", (PyCFunction)_ssl_RAND_bytes, METH_O, _ssl_RAND_bytes__doc__},
905 
906 static PyObject *
907 _ssl_RAND_bytes_impl(PyObject *module, int n);
908 
909 static PyObject *
_ssl_RAND_bytes(PyObject * module,PyObject * arg)910 _ssl_RAND_bytes(PyObject *module, PyObject *arg)
911 {
912     PyObject *return_value = NULL;
913     int n;
914 
915     if (!PyArg_Parse(arg, "i:RAND_bytes", &n)) {
916         goto exit;
917     }
918     return_value = _ssl_RAND_bytes_impl(module, n);
919 
920 exit:
921     return return_value;
922 }
923 
924 PyDoc_STRVAR(_ssl_RAND_pseudo_bytes__doc__,
925 "RAND_pseudo_bytes($module, n, /)\n"
926 "--\n"
927 "\n"
928 "Generate n pseudo-random bytes.\n"
929 "\n"
930 "Return a pair (bytes, is_cryptographic).  is_cryptographic is True\n"
931 "if the bytes generated are cryptographically strong.");
932 
933 #define _SSL_RAND_PSEUDO_BYTES_METHODDEF    \
934     {"RAND_pseudo_bytes", (PyCFunction)_ssl_RAND_pseudo_bytes, METH_O, _ssl_RAND_pseudo_bytes__doc__},
935 
936 static PyObject *
937 _ssl_RAND_pseudo_bytes_impl(PyObject *module, int n);
938 
939 static PyObject *
_ssl_RAND_pseudo_bytes(PyObject * module,PyObject * arg)940 _ssl_RAND_pseudo_bytes(PyObject *module, PyObject *arg)
941 {
942     PyObject *return_value = NULL;
943     int n;
944 
945     if (!PyArg_Parse(arg, "i:RAND_pseudo_bytes", &n)) {
946         goto exit;
947     }
948     return_value = _ssl_RAND_pseudo_bytes_impl(module, n);
949 
950 exit:
951     return return_value;
952 }
953 
954 PyDoc_STRVAR(_ssl_RAND_status__doc__,
955 "RAND_status($module, /)\n"
956 "--\n"
957 "\n"
958 "Returns 1 if the OpenSSL PRNG has been seeded with enough data and 0 if not.\n"
959 "\n"
960 "It is necessary to seed the PRNG with RAND_add() on some platforms before\n"
961 "using the ssl() function.");
962 
963 #define _SSL_RAND_STATUS_METHODDEF    \
964     {"RAND_status", (PyCFunction)_ssl_RAND_status, METH_NOARGS, _ssl_RAND_status__doc__},
965 
966 static PyObject *
967 _ssl_RAND_status_impl(PyObject *module);
968 
969 static PyObject *
_ssl_RAND_status(PyObject * module,PyObject * Py_UNUSED (ignored))970 _ssl_RAND_status(PyObject *module, PyObject *Py_UNUSED(ignored))
971 {
972     return _ssl_RAND_status_impl(module);
973 }
974 
975 #if !defined(OPENSSL_NO_EGD)
976 
977 PyDoc_STRVAR(_ssl_RAND_egd__doc__,
978 "RAND_egd($module, path, /)\n"
979 "--\n"
980 "\n"
981 "Queries the entropy gather daemon (EGD) on the socket named by \'path\'.\n"
982 "\n"
983 "Returns number of bytes read.  Raises SSLError if connection to EGD\n"
984 "fails or if it does not provide enough data to seed PRNG.");
985 
986 #define _SSL_RAND_EGD_METHODDEF    \
987     {"RAND_egd", (PyCFunction)_ssl_RAND_egd, METH_O, _ssl_RAND_egd__doc__},
988 
989 static PyObject *
990 _ssl_RAND_egd_impl(PyObject *module, PyObject *path);
991 
992 static PyObject *
_ssl_RAND_egd(PyObject * module,PyObject * arg)993 _ssl_RAND_egd(PyObject *module, PyObject *arg)
994 {
995     PyObject *return_value = NULL;
996     PyObject *path;
997 
998     if (!PyArg_Parse(arg, "O&:RAND_egd", PyUnicode_FSConverter, &path)) {
999         goto exit;
1000     }
1001     return_value = _ssl_RAND_egd_impl(module, path);
1002 
1003 exit:
1004     return return_value;
1005 }
1006 
1007 #endif /* !defined(OPENSSL_NO_EGD) */
1008 
1009 PyDoc_STRVAR(_ssl_get_default_verify_paths__doc__,
1010 "get_default_verify_paths($module, /)\n"
1011 "--\n"
1012 "\n"
1013 "Return search paths and environment vars that are used by SSLContext\'s set_default_verify_paths() to load default CAs.\n"
1014 "\n"
1015 "The values are \'cert_file_env\', \'cert_file\', \'cert_dir_env\', \'cert_dir\'.");
1016 
1017 #define _SSL_GET_DEFAULT_VERIFY_PATHS_METHODDEF    \
1018     {"get_default_verify_paths", (PyCFunction)_ssl_get_default_verify_paths, METH_NOARGS, _ssl_get_default_verify_paths__doc__},
1019 
1020 static PyObject *
1021 _ssl_get_default_verify_paths_impl(PyObject *module);
1022 
1023 static PyObject *
_ssl_get_default_verify_paths(PyObject * module,PyObject * Py_UNUSED (ignored))1024 _ssl_get_default_verify_paths(PyObject *module, PyObject *Py_UNUSED(ignored))
1025 {
1026     return _ssl_get_default_verify_paths_impl(module);
1027 }
1028 
1029 PyDoc_STRVAR(_ssl_txt2obj__doc__,
1030 "txt2obj($module, /, txt, name=False)\n"
1031 "--\n"
1032 "\n"
1033 "Lookup NID, short name, long name and OID of an ASN1_OBJECT.\n"
1034 "\n"
1035 "By default objects are looked up by OID. With name=True short and\n"
1036 "long name are also matched.");
1037 
1038 #define _SSL_TXT2OBJ_METHODDEF    \
1039     {"txt2obj", (PyCFunction)_ssl_txt2obj, METH_FASTCALL|METH_KEYWORDS, _ssl_txt2obj__doc__},
1040 
1041 static PyObject *
1042 _ssl_txt2obj_impl(PyObject *module, const char *txt, int name);
1043 
1044 static PyObject *
_ssl_txt2obj(PyObject * module,PyObject * const * args,Py_ssize_t nargs,PyObject * kwnames)1045 _ssl_txt2obj(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
1046 {
1047     PyObject *return_value = NULL;
1048     static const char * const _keywords[] = {"txt", "name", NULL};
1049     static _PyArg_Parser _parser = {"s|p:txt2obj", _keywords, 0};
1050     const char *txt;
1051     int name = 0;
1052 
1053     if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
1054         &txt, &name)) {
1055         goto exit;
1056     }
1057     return_value = _ssl_txt2obj_impl(module, txt, name);
1058 
1059 exit:
1060     return return_value;
1061 }
1062 
1063 PyDoc_STRVAR(_ssl_nid2obj__doc__,
1064 "nid2obj($module, nid, /)\n"
1065 "--\n"
1066 "\n"
1067 "Lookup NID, short name, long name and OID of an ASN1_OBJECT by NID.");
1068 
1069 #define _SSL_NID2OBJ_METHODDEF    \
1070     {"nid2obj", (PyCFunction)_ssl_nid2obj, METH_O, _ssl_nid2obj__doc__},
1071 
1072 static PyObject *
1073 _ssl_nid2obj_impl(PyObject *module, int nid);
1074 
1075 static PyObject *
_ssl_nid2obj(PyObject * module,PyObject * arg)1076 _ssl_nid2obj(PyObject *module, PyObject *arg)
1077 {
1078     PyObject *return_value = NULL;
1079     int nid;
1080 
1081     if (!PyArg_Parse(arg, "i:nid2obj", &nid)) {
1082         goto exit;
1083     }
1084     return_value = _ssl_nid2obj_impl(module, nid);
1085 
1086 exit:
1087     return return_value;
1088 }
1089 
1090 #if defined(_MSC_VER)
1091 
1092 PyDoc_STRVAR(_ssl_enum_certificates__doc__,
1093 "enum_certificates($module, /, store_name)\n"
1094 "--\n"
1095 "\n"
1096 "Retrieve certificates from Windows\' cert store.\n"
1097 "\n"
1098 "store_name may be one of \'CA\', \'ROOT\' or \'MY\'.  The system may provide\n"
1099 "more cert storages, too.  The function returns a list of (bytes,\n"
1100 "encoding_type, trust) tuples.  The encoding_type flag can be interpreted\n"
1101 "with X509_ASN_ENCODING or PKCS_7_ASN_ENCODING. The trust setting is either\n"
1102 "a set of OIDs or the boolean True.");
1103 
1104 #define _SSL_ENUM_CERTIFICATES_METHODDEF    \
1105     {"enum_certificates", (PyCFunction)_ssl_enum_certificates, METH_FASTCALL|METH_KEYWORDS, _ssl_enum_certificates__doc__},
1106 
1107 static PyObject *
1108 _ssl_enum_certificates_impl(PyObject *module, const char *store_name);
1109 
1110 static PyObject *
_ssl_enum_certificates(PyObject * module,PyObject * const * args,Py_ssize_t nargs,PyObject * kwnames)1111 _ssl_enum_certificates(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
1112 {
1113     PyObject *return_value = NULL;
1114     static const char * const _keywords[] = {"store_name", NULL};
1115     static _PyArg_Parser _parser = {"s:enum_certificates", _keywords, 0};
1116     const char *store_name;
1117 
1118     if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
1119         &store_name)) {
1120         goto exit;
1121     }
1122     return_value = _ssl_enum_certificates_impl(module, store_name);
1123 
1124 exit:
1125     return return_value;
1126 }
1127 
1128 #endif /* defined(_MSC_VER) */
1129 
1130 #if defined(_MSC_VER)
1131 
1132 PyDoc_STRVAR(_ssl_enum_crls__doc__,
1133 "enum_crls($module, /, store_name)\n"
1134 "--\n"
1135 "\n"
1136 "Retrieve CRLs from Windows\' cert store.\n"
1137 "\n"
1138 "store_name may be one of \'CA\', \'ROOT\' or \'MY\'.  The system may provide\n"
1139 "more cert storages, too.  The function returns a list of (bytes,\n"
1140 "encoding_type) tuples.  The encoding_type flag can be interpreted with\n"
1141 "X509_ASN_ENCODING or PKCS_7_ASN_ENCODING.");
1142 
1143 #define _SSL_ENUM_CRLS_METHODDEF    \
1144     {"enum_crls", (PyCFunction)_ssl_enum_crls, METH_FASTCALL|METH_KEYWORDS, _ssl_enum_crls__doc__},
1145 
1146 static PyObject *
1147 _ssl_enum_crls_impl(PyObject *module, const char *store_name);
1148 
1149 static PyObject *
_ssl_enum_crls(PyObject * module,PyObject * const * args,Py_ssize_t nargs,PyObject * kwnames)1150 _ssl_enum_crls(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
1151 {
1152     PyObject *return_value = NULL;
1153     static const char * const _keywords[] = {"store_name", NULL};
1154     static _PyArg_Parser _parser = {"s:enum_crls", _keywords, 0};
1155     const char *store_name;
1156 
1157     if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
1158         &store_name)) {
1159         goto exit;
1160     }
1161     return_value = _ssl_enum_crls_impl(module, store_name);
1162 
1163 exit:
1164     return return_value;
1165 }
1166 
1167 #endif /* defined(_MSC_VER) */
1168 
1169 #ifndef _SSL__SSLSOCKET_SELECTED_NPN_PROTOCOL_METHODDEF
1170     #define _SSL__SSLSOCKET_SELECTED_NPN_PROTOCOL_METHODDEF
1171 #endif /* !defined(_SSL__SSLSOCKET_SELECTED_NPN_PROTOCOL_METHODDEF) */
1172 
1173 #ifndef _SSL__SSLSOCKET_SELECTED_ALPN_PROTOCOL_METHODDEF
1174     #define _SSL__SSLSOCKET_SELECTED_ALPN_PROTOCOL_METHODDEF
1175 #endif /* !defined(_SSL__SSLSOCKET_SELECTED_ALPN_PROTOCOL_METHODDEF) */
1176 
1177 #ifndef _SSL__SSLCONTEXT_GET_CIPHERS_METHODDEF
1178     #define _SSL__SSLCONTEXT_GET_CIPHERS_METHODDEF
1179 #endif /* !defined(_SSL__SSLCONTEXT_GET_CIPHERS_METHODDEF) */
1180 
1181 #ifndef _SSL__SSLCONTEXT_SET_ECDH_CURVE_METHODDEF
1182     #define _SSL__SSLCONTEXT_SET_ECDH_CURVE_METHODDEF
1183 #endif /* !defined(_SSL__SSLCONTEXT_SET_ECDH_CURVE_METHODDEF) */
1184 
1185 #ifndef _SSL_RAND_EGD_METHODDEF
1186     #define _SSL_RAND_EGD_METHODDEF
1187 #endif /* !defined(_SSL_RAND_EGD_METHODDEF) */
1188 
1189 #ifndef _SSL_ENUM_CERTIFICATES_METHODDEF
1190     #define _SSL_ENUM_CERTIFICATES_METHODDEF
1191 #endif /* !defined(_SSL_ENUM_CERTIFICATES_METHODDEF) */
1192 
1193 #ifndef _SSL_ENUM_CRLS_METHODDEF
1194     #define _SSL_ENUM_CRLS_METHODDEF
1195 #endif /* !defined(_SSL_ENUM_CRLS_METHODDEF) */
1196 /*[clinic end generated code: output=c4e73b70ac3618ba input=a9049054013a1b77]*/
1197