| 1 |
/*[clinic input] |
| 2 |
preserve |
| 3 |
[clinic start generated code]*/ |
| 4 |
|
| 5 |
#if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE) |
| 6 |
# include "pycore_gc.h" // PyGC_Head |
| 7 |
# include "pycore_runtime.h" // _Py_ID() |
| 8 |
#endif |
| 9 |
#include "pycore_critical_section.h"// Py_BEGIN_CRITICAL_SECTION() |
| 10 |
#include "pycore_modsupport.h" // _PyArg_CheckPositional() |
| 11 |
|
| 12 |
PyDoc_STRVAR(_ssl__SSLSocket_do_handshake__doc__, |
| 13 |
"do_handshake($self, /)\n" |
| 14 |
"--\n" |
| 15 |
"\n"); |
| 16 |
|
| 17 |
#define _SSL__SSLSOCKET_DO_HANDSHAKE_METHODDEF \ |
| 18 |
{"do_handshake", (PyCFunction)_ssl__SSLSocket_do_handshake, METH_NOARGS, _ssl__SSLSocket_do_handshake__doc__}, |
| 19 |
|
| 20 |
static PyObject * |
| 21 |
_ssl__SSLSocket_do_handshake_impl(PySSLSocket *self); |
| 22 |
|
| 23 |
static PyObject * |
| 24 |
_ssl__SSLSocket_do_handshake(PyObject *self, PyObject *Py_UNUSED(ignored)) |
| 25 |
{ |
| 26 |
PyObject *return_value = NULL; |
| 27 |
|
| 28 |
Py_BEGIN_CRITICAL_SECTION(self); |
| 29 |
return_value = _ssl__SSLSocket_do_handshake_impl((PySSLSocket *)self); |
| 30 |
Py_END_CRITICAL_SECTION(); |
| 31 |
|
| 32 |
return return_value; |
| 33 |
} |
| 34 |
|
| 35 |
PyDoc_STRVAR(_ssl__test_decode_cert__doc__, |
| 36 |
"_test_decode_cert($module, path, /)\n" |
| 37 |
"--\n" |
| 38 |
"\n"); |
| 39 |
|
| 40 |
#define _SSL__TEST_DECODE_CERT_METHODDEF \ |
| 41 |
{"_test_decode_cert", (PyCFunction)_ssl__test_decode_cert, METH_O, _ssl__test_decode_cert__doc__}, |
| 42 |
|
| 43 |
static PyObject * |
| 44 |
_ssl__test_decode_cert_impl(PyObject *module, PyObject *path); |
| 45 |
|
| 46 |
static PyObject * |
| 47 |
_ssl__test_decode_cert(PyObject *module, PyObject *arg) |
| 48 |
{ |
| 49 |
PyObject *return_value = NULL; |
| 50 |
PyObject *path = NULL; |
| 51 |
|
| 52 |
if (!PyUnicode_FSConverter(arg, &path)) { |
| 53 |
goto exit; |
| 54 |
} |
| 55 |
return_value = _ssl__test_decode_cert_impl(module, path); |
| 56 |
|
| 57 |
exit: |
| 58 |
/* Cleanup for path */ |
| 59 |
Py_XDECREF(path); |
| 60 |
|
| 61 |
return return_value; |
| 62 |
} |
| 63 |
|
| 64 |
PyDoc_STRVAR(_ssl__SSLSocket_getpeercert__doc__, |
| 65 |
"getpeercert($self, der=False, /)\n" |
| 66 |
"--\n" |
| 67 |
"\n" |
| 68 |
"Returns the certificate for the peer.\n" |
| 69 |
"\n" |
| 70 |
"If no certificate was provided, returns None. If a certificate was\n" |
| 71 |
"provided, but not validated, returns an empty dictionary. Otherwise\n" |
| 72 |
"returns a dict containing information about the peer certificate.\n" |
| 73 |
"\n" |
| 74 |
"If the optional argument is True, returns a DER-encoded copy of the\n" |
| 75 |
"peer certificate, or None if no certificate was provided. This will\n" |
| 76 |
"return the certificate even if it wasn\'t validated."); |
| 77 |
|
| 78 |
#define _SSL__SSLSOCKET_GETPEERCERT_METHODDEF \ |
| 79 |
{"getpeercert", _PyCFunction_CAST(_ssl__SSLSocket_getpeercert), METH_FASTCALL, _ssl__SSLSocket_getpeercert__doc__}, |
| 80 |
|
| 81 |
static PyObject * |
| 82 |
_ssl__SSLSocket_getpeercert_impl(PySSLSocket *self, int binary_mode); |
| 83 |
|
| 84 |
static PyObject * |
| 85 |
_ssl__SSLSocket_getpeercert(PyObject *self, PyObject *const *args, Py_ssize_t nargs) |
| 86 |
{ |
| 87 |
PyObject *return_value = NULL; |
| 88 |
int binary_mode = 0; |
| 89 |
|
| 90 |
if (!_PyArg_CheckPositional("getpeercert", nargs, 0, 1)) { |
| 91 |
goto exit; |
| 92 |
} |
| 93 |
if (nargs < 1) { |
| 94 |
goto skip_optional; |
| 95 |
} |
| 96 |
binary_mode = PyObject_IsTrue(args[0]); |
| 97 |
if (binary_mode < 0) { |
| 98 |
goto exit; |
| 99 |
} |
| 100 |
skip_optional: |
| 101 |
Py_BEGIN_CRITICAL_SECTION(self); |
| 102 |
return_value = _ssl__SSLSocket_getpeercert_impl((PySSLSocket *)self, binary_mode); |
| 103 |
Py_END_CRITICAL_SECTION(); |
| 104 |
|
| 105 |
exit: |
| 106 |
return return_value; |
| 107 |
} |
| 108 |
|
| 109 |
PyDoc_STRVAR(_ssl__SSLSocket_get_verified_chain__doc__, |
| 110 |
"get_verified_chain($self, /)\n" |
| 111 |
"--\n" |
| 112 |
"\n"); |
| 113 |
|
| 114 |
#define _SSL__SSLSOCKET_GET_VERIFIED_CHAIN_METHODDEF \ |
| 115 |
{"get_verified_chain", (PyCFunction)_ssl__SSLSocket_get_verified_chain, METH_NOARGS, _ssl__SSLSocket_get_verified_chain__doc__}, |
| 116 |
|
| 117 |
static PyObject * |
| 118 |
_ssl__SSLSocket_get_verified_chain_impl(PySSLSocket *self); |
| 119 |
|
| 120 |
static PyObject * |
| 121 |
_ssl__SSLSocket_get_verified_chain(PyObject *self, PyObject *Py_UNUSED(ignored)) |
| 122 |
{ |
| 123 |
PyObject *return_value = NULL; |
| 124 |
|
| 125 |
Py_BEGIN_CRITICAL_SECTION(self); |
| 126 |
return_value = _ssl__SSLSocket_get_verified_chain_impl((PySSLSocket *)self); |
| 127 |
Py_END_CRITICAL_SECTION(); |
| 128 |
|
| 129 |
return return_value; |
| 130 |
} |
| 131 |
|
| 132 |
PyDoc_STRVAR(_ssl__SSLSocket_get_unverified_chain__doc__, |
| 133 |
"get_unverified_chain($self, /)\n" |
| 134 |
"--\n" |
| 135 |
"\n"); |
| 136 |
|
| 137 |
#define _SSL__SSLSOCKET_GET_UNVERIFIED_CHAIN_METHODDEF \ |
| 138 |
{"get_unverified_chain", (PyCFunction)_ssl__SSLSocket_get_unverified_chain, METH_NOARGS, _ssl__SSLSocket_get_unverified_chain__doc__}, |
| 139 |
|
| 140 |
static PyObject * |
| 141 |
_ssl__SSLSocket_get_unverified_chain_impl(PySSLSocket *self); |
| 142 |
|
| 143 |
static PyObject * |
| 144 |
_ssl__SSLSocket_get_unverified_chain(PyObject *self, PyObject *Py_UNUSED(ignored)) |
| 145 |
{ |
| 146 |
PyObject *return_value = NULL; |
| 147 |
|
| 148 |
Py_BEGIN_CRITICAL_SECTION(self); |
| 149 |
return_value = _ssl__SSLSocket_get_unverified_chain_impl((PySSLSocket *)self); |
| 150 |
Py_END_CRITICAL_SECTION(); |
| 151 |
|
| 152 |
return return_value; |
| 153 |
} |
| 154 |
|
| 155 |
PyDoc_STRVAR(_ssl__SSLSocket_shared_ciphers__doc__, |
| 156 |
"shared_ciphers($self, /)\n" |
| 157 |
"--\n" |
| 158 |
"\n"); |
| 159 |
|
| 160 |
#define _SSL__SSLSOCKET_SHARED_CIPHERS_METHODDEF \ |
| 161 |
{"shared_ciphers", (PyCFunction)_ssl__SSLSocket_shared_ciphers, METH_NOARGS, _ssl__SSLSocket_shared_ciphers__doc__}, |
| 162 |
|
| 163 |
static PyObject * |
| 164 |
_ssl__SSLSocket_shared_ciphers_impl(PySSLSocket *self); |
| 165 |
|
| 166 |
static PyObject * |
| 167 |
_ssl__SSLSocket_shared_ciphers(PyObject *self, PyObject *Py_UNUSED(ignored)) |
| 168 |
{ |
| 169 |
PyObject *return_value = NULL; |
| 170 |
|
| 171 |
Py_BEGIN_CRITICAL_SECTION(self); |
| 172 |
return_value = _ssl__SSLSocket_shared_ciphers_impl((PySSLSocket *)self); |
| 173 |
Py_END_CRITICAL_SECTION(); |
| 174 |
|
| 175 |
return return_value; |
| 176 |
} |
| 177 |
|
| 178 |
PyDoc_STRVAR(_ssl__SSLSocket_cipher__doc__, |
| 179 |
"cipher($self, /)\n" |
| 180 |
"--\n" |
| 181 |
"\n"); |
| 182 |
|
| 183 |
#define _SSL__SSLSOCKET_CIPHER_METHODDEF \ |
| 184 |
{"cipher", (PyCFunction)_ssl__SSLSocket_cipher, METH_NOARGS, _ssl__SSLSocket_cipher__doc__}, |
| 185 |
|
| 186 |
static PyObject * |
| 187 |
_ssl__SSLSocket_cipher_impl(PySSLSocket *self); |
| 188 |
|
| 189 |
static PyObject * |
| 190 |
_ssl__SSLSocket_cipher(PyObject *self, PyObject *Py_UNUSED(ignored)) |
| 191 |
{ |
| 192 |
PyObject *return_value = NULL; |
| 193 |
|
| 194 |
Py_BEGIN_CRITICAL_SECTION(self); |
| 195 |
return_value = _ssl__SSLSocket_cipher_impl((PySSLSocket *)self); |
| 196 |
Py_END_CRITICAL_SECTION(); |
| 197 |
|
| 198 |
return return_value; |
| 199 |
} |
| 200 |
|
| 201 |
PyDoc_STRVAR(_ssl__SSLSocket_version__doc__, |
| 202 |
"version($self, /)\n" |
| 203 |
"--\n" |
| 204 |
"\n"); |
| 205 |
|
| 206 |
#define _SSL__SSLSOCKET_VERSION_METHODDEF \ |
| 207 |
{"version", (PyCFunction)_ssl__SSLSocket_version, METH_NOARGS, _ssl__SSLSocket_version__doc__}, |
| 208 |
|
| 209 |
static PyObject * |
| 210 |
_ssl__SSLSocket_version_impl(PySSLSocket *self); |
| 211 |
|
| 212 |
static PyObject * |
| 213 |
_ssl__SSLSocket_version(PyObject *self, PyObject *Py_UNUSED(ignored)) |
| 214 |
{ |
| 215 |
PyObject *return_value = NULL; |
| 216 |
|
| 217 |
Py_BEGIN_CRITICAL_SECTION(self); |
| 218 |
return_value = _ssl__SSLSocket_version_impl((PySSLSocket *)self); |
| 219 |
Py_END_CRITICAL_SECTION(); |
| 220 |
|
| 221 |
return return_value; |
| 222 |
} |
| 223 |
|
| 224 |
PyDoc_STRVAR(_ssl__SSLSocket_selected_alpn_protocol__doc__, |
| 225 |
"selected_alpn_protocol($self, /)\n" |
| 226 |
"--\n" |
| 227 |
"\n"); |
| 228 |
|
| 229 |
#define _SSL__SSLSOCKET_SELECTED_ALPN_PROTOCOL_METHODDEF \ |
| 230 |
{"selected_alpn_protocol", (PyCFunction)_ssl__SSLSocket_selected_alpn_protocol, METH_NOARGS, _ssl__SSLSocket_selected_alpn_protocol__doc__}, |
| 231 |
|
| 232 |
static PyObject * |
| 233 |
_ssl__SSLSocket_selected_alpn_protocol_impl(PySSLSocket *self); |
| 234 |
|
| 235 |
static PyObject * |
| 236 |
_ssl__SSLSocket_selected_alpn_protocol(PyObject *self, PyObject *Py_UNUSED(ignored)) |
| 237 |
{ |
| 238 |
PyObject *return_value = NULL; |
| 239 |
|
| 240 |
Py_BEGIN_CRITICAL_SECTION(self); |
| 241 |
return_value = _ssl__SSLSocket_selected_alpn_protocol_impl((PySSLSocket *)self); |
| 242 |
Py_END_CRITICAL_SECTION(); |
| 243 |
|
| 244 |
return return_value; |
| 245 |
} |
| 246 |
|
| 247 |
PyDoc_STRVAR(_ssl__SSLSocket_compression__doc__, |
| 248 |
"compression($self, /)\n" |
| 249 |
"--\n" |
| 250 |
"\n"); |
| 251 |
|
| 252 |
#define _SSL__SSLSOCKET_COMPRESSION_METHODDEF \ |
| 253 |
{"compression", (PyCFunction)_ssl__SSLSocket_compression, METH_NOARGS, _ssl__SSLSocket_compression__doc__}, |
| 254 |
|
| 255 |
static PyObject * |
| 256 |
_ssl__SSLSocket_compression_impl(PySSLSocket *self); |
| 257 |
|
| 258 |
static PyObject * |
| 259 |
_ssl__SSLSocket_compression(PyObject *self, PyObject *Py_UNUSED(ignored)) |
| 260 |
{ |
| 261 |
return _ssl__SSLSocket_compression_impl((PySSLSocket *)self); |
| 262 |
} |
| 263 |
|
| 264 |
PyDoc_STRVAR(_ssl__SSLSocket_context__doc__, |
| 265 |
"This changes the context associated with the SSLSocket.\n" |
| 266 |
"\n" |
| 267 |
"This is typically used from within a callback function set by the\n" |
| 268 |
"sni_callback on the SSLContext to change the certificate information\n" |
| 269 |
"associated with the SSLSocket before the cryptographic exchange\n" |
| 270 |
"handshake messages."); |
| 271 |
#if defined(_ssl__SSLSocket_context_DOCSTR) |
| 272 |
# undef _ssl__SSLSocket_context_DOCSTR |
| 273 |
#endif |
| 274 |
#define _ssl__SSLSocket_context_DOCSTR _ssl__SSLSocket_context__doc__ |
| 275 |
|
| 276 |
#if !defined(_ssl__SSLSocket_context_DOCSTR) |
| 277 |
# define _ssl__SSLSocket_context_DOCSTR NULL |
| 278 |
#endif |
| 279 |
#if defined(_SSL__SSLSOCKET_CONTEXT_GETSETDEF) |
| 280 |
# undef _SSL__SSLSOCKET_CONTEXT_GETSETDEF |
| 281 |
# define _SSL__SSLSOCKET_CONTEXT_GETSETDEF {"context", (getter)_ssl__SSLSocket_context_get, (setter)_ssl__SSLSocket_context_set, _ssl__SSLSocket_context_DOCSTR}, |
| 282 |
#else |
| 283 |
# define _SSL__SSLSOCKET_CONTEXT_GETSETDEF {"context", (getter)_ssl__SSLSocket_context_get, NULL, _ssl__SSLSocket_context_DOCSTR}, |
| 284 |
#endif |
| 285 |
|
| 286 |
static PyObject * |
| 287 |
_ssl__SSLSocket_context_get_impl(PySSLSocket *self); |
| 288 |
|
| 289 |
static PyObject * |
| 290 |
_ssl__SSLSocket_context_get(PyObject *self, void *Py_UNUSED(context)) |
| 291 |
{ |
| 292 |
PyObject *return_value = NULL; |
| 293 |
|
| 294 |
Py_BEGIN_CRITICAL_SECTION(self); |
| 295 |
return_value = _ssl__SSLSocket_context_get_impl((PySSLSocket *)self); |
| 296 |
Py_END_CRITICAL_SECTION(); |
| 297 |
|
| 298 |
return return_value; |
| 299 |
} |
| 300 |
|
| 301 |
#if !defined(_ssl__SSLSocket_context_DOCSTR) |
| 302 |
# define _ssl__SSLSocket_context_DOCSTR NULL |
| 303 |
#endif |
| 304 |
#if defined(_SSL__SSLSOCKET_CONTEXT_GETSETDEF) |
| 305 |
# undef _SSL__SSLSOCKET_CONTEXT_GETSETDEF |
| 306 |
# define _SSL__SSLSOCKET_CONTEXT_GETSETDEF {"context", (getter)_ssl__SSLSocket_context_get, (setter)_ssl__SSLSocket_context_set, _ssl__SSLSocket_context_DOCSTR}, |
| 307 |
#else |
| 308 |
# define _SSL__SSLSOCKET_CONTEXT_GETSETDEF {"context", NULL, (setter)_ssl__SSLSocket_context_set, NULL}, |
| 309 |
#endif |
| 310 |
|
| 311 |
static int |
| 312 |
_ssl__SSLSocket_context_set_impl(PySSLSocket *self, PyObject *value); |
| 313 |
|
| 314 |
static int |
| 315 |
_ssl__SSLSocket_context_set(PyObject *self, PyObject *value, void *Py_UNUSED(context)) |
| 316 |
{ |
| 317 |
int return_value; |
| 318 |
|
| 319 |
Py_BEGIN_CRITICAL_SECTION(self); |
| 320 |
return_value = _ssl__SSLSocket_context_set_impl((PySSLSocket *)self, value); |
| 321 |
Py_END_CRITICAL_SECTION(); |
| 322 |
|
| 323 |
return return_value; |
| 324 |
} |
| 325 |
|
| 326 |
PyDoc_STRVAR(_ssl__SSLSocket_server_side__doc__, |
| 327 |
"Whether this is a server-side socket."); |
| 328 |
#if defined(_ssl__SSLSocket_server_side_DOCSTR) |
| 329 |
# undef _ssl__SSLSocket_server_side_DOCSTR |
| 330 |
#endif |
| 331 |
#define _ssl__SSLSocket_server_side_DOCSTR _ssl__SSLSocket_server_side__doc__ |
| 332 |
|
| 333 |
#if !defined(_ssl__SSLSocket_server_side_DOCSTR) |
| 334 |
# define _ssl__SSLSocket_server_side_DOCSTR NULL |
| 335 |
#endif |
| 336 |
#if defined(_SSL__SSLSOCKET_SERVER_SIDE_GETSETDEF) |
| 337 |
# undef _SSL__SSLSOCKET_SERVER_SIDE_GETSETDEF |
| 338 |
# define _SSL__SSLSOCKET_SERVER_SIDE_GETSETDEF {"server_side", (getter)_ssl__SSLSocket_server_side_get, (setter)_ssl__SSLSocket_server_side_set, _ssl__SSLSocket_server_side_DOCSTR}, |
| 339 |
#else |
| 340 |
# define _SSL__SSLSOCKET_SERVER_SIDE_GETSETDEF {"server_side", (getter)_ssl__SSLSocket_server_side_get, NULL, _ssl__SSLSocket_server_side_DOCSTR}, |
| 341 |
#endif |
| 342 |
|
| 343 |
static PyObject * |
| 344 |
_ssl__SSLSocket_server_side_get_impl(PySSLSocket *self); |
| 345 |
|
| 346 |
static PyObject * |
| 347 |
_ssl__SSLSocket_server_side_get(PyObject *self, void *Py_UNUSED(context)) |
| 348 |
{ |
| 349 |
PyObject *return_value = NULL; |
| 350 |
|
| 351 |
Py_BEGIN_CRITICAL_SECTION(self); |
| 352 |
return_value = _ssl__SSLSocket_server_side_get_impl((PySSLSocket *)self); |
| 353 |
Py_END_CRITICAL_SECTION(); |
| 354 |
|
| 355 |
return return_value; |
| 356 |
} |
| 357 |
|
| 358 |
PyDoc_STRVAR(_ssl__SSLSocket_server_hostname__doc__, |
| 359 |
"The currently set server hostname (for SNI)."); |
| 360 |
#if defined(_ssl__SSLSocket_server_hostname_DOCSTR) |
| 361 |
# undef _ssl__SSLSocket_server_hostname_DOCSTR |
| 362 |
#endif |
| 363 |
#define _ssl__SSLSocket_server_hostname_DOCSTR _ssl__SSLSocket_server_hostname__doc__ |
| 364 |
|
| 365 |
#if !defined(_ssl__SSLSocket_server_hostname_DOCSTR) |
| 366 |
# define _ssl__SSLSocket_server_hostname_DOCSTR NULL |
| 367 |
#endif |
| 368 |
#if defined(_SSL__SSLSOCKET_SERVER_HOSTNAME_GETSETDEF) |
| 369 |
# undef _SSL__SSLSOCKET_SERVER_HOSTNAME_GETSETDEF |
| 370 |
# define _SSL__SSLSOCKET_SERVER_HOSTNAME_GETSETDEF {"server_hostname", (getter)_ssl__SSLSocket_server_hostname_get, (setter)_ssl__SSLSocket_server_hostname_set, _ssl__SSLSocket_server_hostname_DOCSTR}, |
| 371 |
#else |
| 372 |
# define _SSL__SSLSOCKET_SERVER_HOSTNAME_GETSETDEF {"server_hostname", (getter)_ssl__SSLSocket_server_hostname_get, NULL, _ssl__SSLSocket_server_hostname_DOCSTR}, |
| 373 |
#endif |
| 374 |
|
| 375 |
static PyObject * |
| 376 |
_ssl__SSLSocket_server_hostname_get_impl(PySSLSocket *self); |
| 377 |
|
| 378 |
static PyObject * |
| 379 |
_ssl__SSLSocket_server_hostname_get(PyObject *self, void *Py_UNUSED(context)) |
| 380 |
{ |
| 381 |
PyObject *return_value = NULL; |
| 382 |
|
| 383 |
Py_BEGIN_CRITICAL_SECTION(self); |
| 384 |
return_value = _ssl__SSLSocket_server_hostname_get_impl((PySSLSocket *)self); |
| 385 |
Py_END_CRITICAL_SECTION(); |
| 386 |
|
| 387 |
return return_value; |
| 388 |
} |
| 389 |
|
| 390 |
PyDoc_STRVAR(_ssl__SSLSocket_owner__doc__, |
| 391 |
"The Python-level owner of this object.\n" |
| 392 |
"\n" |
| 393 |
"Passed as \"self\" in servername callback."); |
| 394 |
#if defined(_ssl__SSLSocket_owner_DOCSTR) |
| 395 |
# undef _ssl__SSLSocket_owner_DOCSTR |
| 396 |
#endif |
| 397 |
#define _ssl__SSLSocket_owner_DOCSTR _ssl__SSLSocket_owner__doc__ |
| 398 |
|
| 399 |
#if !defined(_ssl__SSLSocket_owner_DOCSTR) |
| 400 |
# define _ssl__SSLSocket_owner_DOCSTR NULL |
| 401 |
#endif |
| 402 |
#if defined(_SSL__SSLSOCKET_OWNER_GETSETDEF) |
| 403 |
# undef _SSL__SSLSOCKET_OWNER_GETSETDEF |
| 404 |
# define _SSL__SSLSOCKET_OWNER_GETSETDEF {"owner", (getter)_ssl__SSLSocket_owner_get, (setter)_ssl__SSLSocket_owner_set, _ssl__SSLSocket_owner_DOCSTR}, |
| 405 |
#else |
| 406 |
# define _SSL__SSLSOCKET_OWNER_GETSETDEF {"owner", (getter)_ssl__SSLSocket_owner_get, NULL, _ssl__SSLSocket_owner_DOCSTR}, |
| 407 |
#endif |
| 408 |
|
| 409 |
static PyObject * |
| 410 |
_ssl__SSLSocket_owner_get_impl(PySSLSocket *self); |
| 411 |
|
| 412 |
static PyObject * |
| 413 |
_ssl__SSLSocket_owner_get(PyObject *self, void *Py_UNUSED(context)) |
| 414 |
{ |
| 415 |
PyObject *return_value = NULL; |
| 416 |
|
| 417 |
Py_BEGIN_CRITICAL_SECTION(self); |
| 418 |
return_value = _ssl__SSLSocket_owner_get_impl((PySSLSocket *)self); |
| 419 |
Py_END_CRITICAL_SECTION(); |
| 420 |
|
| 421 |
return return_value; |
| 422 |
} |
| 423 |
|
| 424 |
#if !defined(_ssl__SSLSocket_owner_DOCSTR) |
| 425 |
# define _ssl__SSLSocket_owner_DOCSTR NULL |
| 426 |
#endif |
| 427 |
#if defined(_SSL__SSLSOCKET_OWNER_GETSETDEF) |
| 428 |
# undef _SSL__SSLSOCKET_OWNER_GETSETDEF |
| 429 |
# define _SSL__SSLSOCKET_OWNER_GETSETDEF {"owner", (getter)_ssl__SSLSocket_owner_get, (setter)_ssl__SSLSocket_owner_set, _ssl__SSLSocket_owner_DOCSTR}, |
| 430 |
#else |
| 431 |
# define _SSL__SSLSOCKET_OWNER_GETSETDEF {"owner", NULL, (setter)_ssl__SSLSocket_owner_set, NULL}, |
| 432 |
#endif |
| 433 |
|
| 434 |
static int |
| 435 |
_ssl__SSLSocket_owner_set_impl(PySSLSocket *self, PyObject *value); |
| 436 |
|
| 437 |
static int |
| 438 |
_ssl__SSLSocket_owner_set(PyObject *self, PyObject *value, void *Py_UNUSED(context)) |
| 439 |
{ |
| 440 |
int return_value; |
| 441 |
|
| 442 |
Py_BEGIN_CRITICAL_SECTION(self); |
| 443 |
return_value = _ssl__SSLSocket_owner_set_impl((PySSLSocket *)self, value); |
| 444 |
Py_END_CRITICAL_SECTION(); |
| 445 |
|
| 446 |
return return_value; |
| 447 |
} |
| 448 |
|
| 449 |
PyDoc_STRVAR(_ssl__SSLSocket_write__doc__, |
| 450 |
"write($self, b, /)\n" |
| 451 |
"--\n" |
| 452 |
"\n" |
| 453 |
"Writes the bytes-like object b into the SSL object.\n" |
| 454 |
"\n" |
| 455 |
"Returns the number of bytes written."); |
| 456 |
|
| 457 |
#define _SSL__SSLSOCKET_WRITE_METHODDEF \ |
| 458 |
{"write", (PyCFunction)_ssl__SSLSocket_write, METH_O, _ssl__SSLSocket_write__doc__}, |
| 459 |
|
| 460 |
static PyObject * |
| 461 |
_ssl__SSLSocket_write_impl(PySSLSocket *self, Py_buffer *b); |
| 462 |
|
| 463 |
static PyObject * |
| 464 |
_ssl__SSLSocket_write(PyObject *self, PyObject *arg) |
| 465 |
{ |
| 466 |
PyObject *return_value = NULL; |
| 467 |
Py_buffer b = {NULL, NULL}; |
| 468 |
|
| 469 |
if (PyObject_GetBuffer(arg, &b, PyBUF_SIMPLE) != 0) { |
| 470 |
goto exit; |
| 471 |
} |
| 472 |
Py_BEGIN_CRITICAL_SECTION(self); |
| 473 |
return_value = _ssl__SSLSocket_write_impl((PySSLSocket *)self, &b); |
| 474 |
Py_END_CRITICAL_SECTION(); |
| 475 |
|
| 476 |
exit: |
| 477 |
/* Cleanup for b */ |
| 478 |
if (b.obj) { |
| 479 |
PyBuffer_Release(&b); |
| 480 |
} |
| 481 |
|
| 482 |
return return_value; |
| 483 |
} |
| 484 |
|
| 485 |
PyDoc_STRVAR(_ssl__SSLSocket_pending__doc__, |
| 486 |
"pending($self, /)\n" |
| 487 |
"--\n" |
| 488 |
"\n" |
| 489 |
"Returns the number of already decrypted bytes available for read, pending on the connection."); |
| 490 |
|
| 491 |
#define _SSL__SSLSOCKET_PENDING_METHODDEF \ |
| 492 |
{"pending", (PyCFunction)_ssl__SSLSocket_pending, METH_NOARGS, _ssl__SSLSocket_pending__doc__}, |
| 493 |
|
| 494 |
static PyObject * |
| 495 |
_ssl__SSLSocket_pending_impl(PySSLSocket *self); |
| 496 |
|
| 497 |
static PyObject * |
| 498 |
_ssl__SSLSocket_pending(PyObject *self, PyObject *Py_UNUSED(ignored)) |
| 499 |
{ |
| 500 |
PyObject *return_value = NULL; |
| 501 |
|
| 502 |
Py_BEGIN_CRITICAL_SECTION(self); |
| 503 |
return_value = _ssl__SSLSocket_pending_impl((PySSLSocket *)self); |
| 504 |
Py_END_CRITICAL_SECTION(); |
| 505 |
|
| 506 |
return return_value; |
| 507 |
} |
| 508 |
|
| 509 |
PyDoc_STRVAR(_ssl__SSLSocket_read__doc__, |
| 510 |
"read(size, [buffer])\n" |
| 511 |
"Read up to size bytes from the SSL socket."); |
| 512 |
|
| 513 |
#define _SSL__SSLSOCKET_READ_METHODDEF \ |
| 514 |
{"read", (PyCFunction)_ssl__SSLSocket_read, METH_VARARGS, _ssl__SSLSocket_read__doc__}, |
| 515 |
|
| 516 |
static PyObject * |
| 517 |
_ssl__SSLSocket_read_impl(PySSLSocket *self, Py_ssize_t len, |
| 518 |
int group_right_1, Py_buffer *buffer); |
| 519 |
|
| 520 |
static PyObject * |
| 521 |
_ssl__SSLSocket_read(PyObject *self, PyObject *args) |
| 522 |
{ |
| 523 |
PyObject *return_value = NULL; |
| 524 |
Py_ssize_t len; |
| 525 |
int group_right_1 = 0; |
| 526 |
Py_buffer buffer = {NULL, NULL}; |
| 527 |
|
| 528 |
switch (PyTuple_GET_SIZE(args)) { |
| 529 |
case 1: |
| 530 |
if (!PyArg_ParseTuple(args, "n:read", &len)) { |
| 531 |
goto exit; |
| 532 |
} |
| 533 |
break; |
| 534 |
case 2: |
| 535 |
if (!PyArg_ParseTuple(args, "nw*:read", &len, &buffer)) { |
| 536 |
goto exit; |
| 537 |
} |
| 538 |
group_right_1 = 1; |
| 539 |
break; |
| 540 |
default: |
| 541 |
PyErr_SetString(PyExc_TypeError, "_ssl._SSLSocket.read requires 1 to 2 arguments"); |
| 542 |
goto exit; |
| 543 |
} |
| 544 |
Py_BEGIN_CRITICAL_SECTION(self); |
| 545 |
return_value = _ssl__SSLSocket_read_impl((PySSLSocket *)self, len, group_right_1, &buffer); |
| 546 |
Py_END_CRITICAL_SECTION(); |
| 547 |
|
| 548 |
exit: |
| 549 |
/* Cleanup for buffer */ |
| 550 |
if (buffer.obj) { |
| 551 |
PyBuffer_Release(&buffer); |
| 552 |
} |
| 553 |
|
| 554 |
return return_value; |
| 555 |
} |
| 556 |
|
| 557 |
PyDoc_STRVAR(_ssl__SSLSocket_shutdown__doc__, |
| 558 |
"shutdown($self, /)\n" |
| 559 |
"--\n" |
| 560 |
"\n" |
| 561 |
"Does the SSL shutdown handshake with the remote end."); |
| 562 |
|
| 563 |
#define _SSL__SSLSOCKET_SHUTDOWN_METHODDEF \ |
| 564 |
{"shutdown", (PyCFunction)_ssl__SSLSocket_shutdown, METH_NOARGS, _ssl__SSLSocket_shutdown__doc__}, |
| 565 |
|
| 566 |
static PyObject * |
| 567 |
_ssl__SSLSocket_shutdown_impl(PySSLSocket *self); |
| 568 |
|
| 569 |
static PyObject * |
| 570 |
_ssl__SSLSocket_shutdown(PyObject *self, PyObject *Py_UNUSED(ignored)) |
| 571 |
{ |
| 572 |
PyObject *return_value = NULL; |
| 573 |
|
| 574 |
Py_BEGIN_CRITICAL_SECTION(self); |
| 575 |
return_value = _ssl__SSLSocket_shutdown_impl((PySSLSocket *)self); |
| 576 |
Py_END_CRITICAL_SECTION(); |
| 577 |
|
| 578 |
return return_value; |
| 579 |
} |
| 580 |
|
| 581 |
PyDoc_STRVAR(_ssl__SSLSocket_get_channel_binding__doc__, |
| 582 |
"get_channel_binding($self, /, cb_type=\'tls-unique\')\n" |
| 583 |
"--\n" |
| 584 |
"\n" |
| 585 |
"Get channel binding data for current connection.\n" |
| 586 |
"\n" |
| 587 |
"Raise ValueError if the requested `cb_type` is not supported.\n" |
| 588 |
"Return bytes of the data or None if the data is not available (e.g.\n" |
| 589 |
"before the handshake).\n" |
| 590 |
"Only \'tls-unique\' channel binding data from RFC 5929 is supported."); |
| 591 |
|
| 592 |
#define _SSL__SSLSOCKET_GET_CHANNEL_BINDING_METHODDEF \ |
| 593 |
{"get_channel_binding", _PyCFunction_CAST(_ssl__SSLSocket_get_channel_binding), METH_FASTCALL|METH_KEYWORDS, _ssl__SSLSocket_get_channel_binding__doc__}, |
| 594 |
|
| 595 |
static PyObject * |
| 596 |
_ssl__SSLSocket_get_channel_binding_impl(PySSLSocket *self, |
| 597 |
const char *cb_type); |
| 598 |
|
| 599 |
static PyObject * |
| 600 |
_ssl__SSLSocket_get_channel_binding(PyObject *self, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames) |
| 601 |
{ |
| 602 |
PyObject *return_value = NULL; |
| 603 |
#if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE) |
| 604 |
|
| 605 |
#define NUM_KEYWORDS 1 |
| 606 |
static struct { |
| 607 |
PyGC_Head _this_is_not_used; |
| 608 |
PyObject_VAR_HEAD |
| 609 |
Py_hash_t ob_hash; |
| 610 |
PyObject *ob_item[NUM_KEYWORDS]; |
| 611 |
} _kwtuple = { |
| 612 |
.ob_base = PyVarObject_HEAD_INIT(&PyTuple_Type, NUM_KEYWORDS) |
| 613 |
.ob_hash = -1, |
| 614 |
.ob_item = { &_Py_ID(cb_type), }, |
| 615 |
}; |
| 616 |
#undef NUM_KEYWORDS |
| 617 |
#define KWTUPLE (&_kwtuple.ob_base.ob_base) |
| 618 |
|
| 619 |
#else // !Py_BUILD_CORE |
| 620 |
# define KWTUPLE NULL |
| 621 |
#endif // !Py_BUILD_CORE |
| 622 |
|
| 623 |
static const char * const _keywords[] = {"cb_type", NULL}; |
| 624 |
static _PyArg_Parser _parser = { |
| 625 |
.keywords = _keywords, |
| 626 |
.fname = "get_channel_binding", |
| 627 |
.kwtuple = KWTUPLE, |
| 628 |
}; |
| 629 |
#undef KWTUPLE |
| 630 |
PyObject *argsbuf[1]; |
| 631 |
Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 0; |
| 632 |
const char *cb_type = "tls-unique"; |
| 633 |
|
| 634 |
args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, |
| 635 |
/*minpos*/ 0, /*maxpos*/ 1, /*minkw*/ 0, /*varpos*/ 0, argsbuf); |
| 636 |
if (!args) { |
| 637 |
goto exit; |
| 638 |
} |
| 639 |
if (!noptargs) { |
| 640 |
goto skip_optional_pos; |
| 641 |
} |
| 642 |
if (!PyUnicode_Check(args[0])) { |
| 643 |
_PyArg_BadArgument("get_channel_binding", "argument 'cb_type'", "str", args[0]); |
| 644 |
goto exit; |
| 645 |
} |
| 646 |
Py_ssize_t cb_type_length; |
| 647 |
cb_type = PyUnicode_AsUTF8AndSize(args[0], &cb_type_length); |
| 648 |
if (cb_type == NULL) { |
| 649 |
goto exit; |
| 650 |
} |
| 651 |
if (strlen(cb_type) != (size_t)cb_type_length) { |
| 652 |
PyErr_SetString(PyExc_ValueError, "embedded null character"); |
| 653 |
goto exit; |
| 654 |
} |
| 655 |
skip_optional_pos: |
| 656 |
Py_BEGIN_CRITICAL_SECTION(self); |
| 657 |
return_value = _ssl__SSLSocket_get_channel_binding_impl((PySSLSocket *)self, cb_type); |
| 658 |
Py_END_CRITICAL_SECTION(); |
| 659 |
|
| 660 |
exit: |
| 661 |
return return_value; |
| 662 |
} |
| 663 |
|
| 664 |
PyDoc_STRVAR(_ssl__SSLSocket_verify_client_post_handshake__doc__, |
| 665 |
"verify_client_post_handshake($self, /)\n" |
| 666 |
"--\n" |
| 667 |
"\n" |
| 668 |
"Initiate TLS 1.3 post-handshake authentication"); |
| 669 |
|
| 670 |
#define _SSL__SSLSOCKET_VERIFY_CLIENT_POST_HANDSHAKE_METHODDEF \ |
| 671 |
{"verify_client_post_handshake", (PyCFunction)_ssl__SSLSocket_verify_client_post_handshake, METH_NOARGS, _ssl__SSLSocket_verify_client_post_handshake__doc__}, |
| 672 |
|
| 673 |
static PyObject * |
| 674 |
_ssl__SSLSocket_verify_client_post_handshake_impl(PySSLSocket *self); |
| 675 |
|
| 676 |
static PyObject * |
| 677 |
_ssl__SSLSocket_verify_client_post_handshake(PyObject *self, PyObject *Py_UNUSED(ignored)) |
| 678 |
{ |
| 679 |
PyObject *return_value = NULL; |
| 680 |
|
| 681 |
Py_BEGIN_CRITICAL_SECTION(self); |
| 682 |
return_value = _ssl__SSLSocket_verify_client_post_handshake_impl((PySSLSocket *)self); |
| 683 |
Py_END_CRITICAL_SECTION(); |
| 684 |
|
| 685 |
return return_value; |
| 686 |
} |
| 687 |
|
| 688 |
PyDoc_STRVAR(_ssl__SSLSocket_session__doc__, |
| 689 |
"The underlying SSLSession object."); |
| 690 |
#if defined(_ssl__SSLSocket_session_DOCSTR) |
| 691 |
# undef _ssl__SSLSocket_session_DOCSTR |
| 692 |
#endif |
| 693 |
#define _ssl__SSLSocket_session_DOCSTR _ssl__SSLSocket_session__doc__ |
| 694 |
|
| 695 |
#if !defined(_ssl__SSLSocket_session_DOCSTR) |
| 696 |
# define _ssl__SSLSocket_session_DOCSTR NULL |
| 697 |
#endif |
| 698 |
#if defined(_SSL__SSLSOCKET_SESSION_GETSETDEF) |
| 699 |
# undef _SSL__SSLSOCKET_SESSION_GETSETDEF |
| 700 |
# define _SSL__SSLSOCKET_SESSION_GETSETDEF {"session", (getter)_ssl__SSLSocket_session_get, (setter)_ssl__SSLSocket_session_set, _ssl__SSLSocket_session_DOCSTR}, |
| 701 |
#else |
| 702 |
# define _SSL__SSLSOCKET_SESSION_GETSETDEF {"session", (getter)_ssl__SSLSocket_session_get, NULL, _ssl__SSLSocket_session_DOCSTR}, |
| 703 |
#endif |
| 704 |
|
| 705 |
static PyObject * |
| 706 |
_ssl__SSLSocket_session_get_impl(PySSLSocket *self); |
| 707 |
|
| 708 |
static PyObject * |
| 709 |
_ssl__SSLSocket_session_get(PyObject *self, void *Py_UNUSED(context)) |
| 710 |
{ |
| 711 |
PyObject *return_value = NULL; |
| 712 |
|
| 713 |
Py_BEGIN_CRITICAL_SECTION(self); |
| 714 |
return_value = _ssl__SSLSocket_session_get_impl((PySSLSocket *)self); |
| 715 |
Py_END_CRITICAL_SECTION(); |
| 716 |
|
| 717 |
return return_value; |
| 718 |
} |
| 719 |
|
| 720 |
#if !defined(_ssl__SSLSocket_session_DOCSTR) |
| 721 |
# define _ssl__SSLSocket_session_DOCSTR NULL |
| 722 |
#endif |
| 723 |
#if defined(_SSL__SSLSOCKET_SESSION_GETSETDEF) |
| 724 |
# undef _SSL__SSLSOCKET_SESSION_GETSETDEF |
| 725 |
# define _SSL__SSLSOCKET_SESSION_GETSETDEF {"session", (getter)_ssl__SSLSocket_session_get, (setter)_ssl__SSLSocket_session_set, _ssl__SSLSocket_session_DOCSTR}, |
| 726 |
#else |
| 727 |
# define _SSL__SSLSOCKET_SESSION_GETSETDEF {"session", NULL, (setter)_ssl__SSLSocket_session_set, NULL}, |
| 728 |
#endif |
| 729 |
|
| 730 |
static int |
| 731 |
_ssl__SSLSocket_session_set_impl(PySSLSocket *self, PyObject *value); |
| 732 |
|
| 733 |
static int |
| 734 |
_ssl__SSLSocket_session_set(PyObject *self, PyObject *value, void *Py_UNUSED(context)) |
| 735 |
{ |
| 736 |
int return_value; |
| 737 |
|
| 738 |
Py_BEGIN_CRITICAL_SECTION(self); |
| 739 |
return_value = _ssl__SSLSocket_session_set_impl((PySSLSocket *)self, value); |
| 740 |
Py_END_CRITICAL_SECTION(); |
| 741 |
|
| 742 |
return return_value; |
| 743 |
} |
| 744 |
|
| 745 |
PyDoc_STRVAR(_ssl__SSLSocket_session_reused__doc__, |
| 746 |
"Was the client session reused during handshake?"); |
| 747 |
#if defined(_ssl__SSLSocket_session_reused_DOCSTR) |
| 748 |
# undef _ssl__SSLSocket_session_reused_DOCSTR |
| 749 |
#endif |
| 750 |
#define _ssl__SSLSocket_session_reused_DOCSTR _ssl__SSLSocket_session_reused__doc__ |
| 751 |
|
| 752 |
#if !defined(_ssl__SSLSocket_session_reused_DOCSTR) |
| 753 |
# define _ssl__SSLSocket_session_reused_DOCSTR NULL |
| 754 |
#endif |
| 755 |
#if defined(_SSL__SSLSOCKET_SESSION_REUSED_GETSETDEF) |
| 756 |
# undef _SSL__SSLSOCKET_SESSION_REUSED_GETSETDEF |
| 757 |
# define _SSL__SSLSOCKET_SESSION_REUSED_GETSETDEF {"session_reused", (getter)_ssl__SSLSocket_session_reused_get, (setter)_ssl__SSLSocket_session_reused_set, _ssl__SSLSocket_session_reused_DOCSTR}, |
| 758 |
#else |
| 759 |
# define _SSL__SSLSOCKET_SESSION_REUSED_GETSETDEF {"session_reused", (getter)_ssl__SSLSocket_session_reused_get, NULL, _ssl__SSLSocket_session_reused_DOCSTR}, |
| 760 |
#endif |
| 761 |
|
| 762 |
static PyObject * |
| 763 |
_ssl__SSLSocket_session_reused_get_impl(PySSLSocket *self); |
| 764 |
|
| 765 |
static PyObject * |
| 766 |
_ssl__SSLSocket_session_reused_get(PyObject *self, void *Py_UNUSED(context)) |
| 767 |
{ |
| 768 |
PyObject *return_value = NULL; |
| 769 |
|
| 770 |
Py_BEGIN_CRITICAL_SECTION(self); |
| 771 |
return_value = _ssl__SSLSocket_session_reused_get_impl((PySSLSocket *)self); |
| 772 |
Py_END_CRITICAL_SECTION(); |
| 773 |
|
| 774 |
return return_value; |
| 775 |
} |
| 776 |
|
| 777 |
static PyObject * |
| 778 |
_ssl__SSLContext_impl(PyTypeObject *type, int proto_version); |
| 779 |
|
| 780 |
static PyObject * |
| 781 |
_ssl__SSLContext(PyTypeObject *type, PyObject *args, PyObject *kwargs) |
| 782 |
{ |
| 783 |
PyObject *return_value = NULL; |
| 784 |
PyTypeObject *base_tp = get_state_type(type)->PySSLContext_Type; |
| 785 |
int proto_version; |
| 786 |
|
| 787 |
if ((type == base_tp || type->tp_init == base_tp->tp_init) && |
| 788 |
!_PyArg_NoKeywords("_SSLContext", kwargs)) { |
| 789 |
goto exit; |
| 790 |
} |
| 791 |
if (!_PyArg_CheckPositional("_SSLContext", PyTuple_GET_SIZE(args), 1, 1)) { |
| 792 |
goto exit; |
| 793 |
} |
| 794 |
proto_version = PyLong_AsInt(PyTuple_GET_ITEM(args, 0)); |
| 795 |
if (proto_version == -1 && PyErr_Occurred()) { |
| 796 |
goto exit; |
| 797 |
} |
| 798 |
Py_BEGIN_CRITICAL_SECTION(type); |
| 799 |
return_value = _ssl__SSLContext_impl(type, proto_version); |
| 800 |
Py_END_CRITICAL_SECTION(); |
| 801 |
|
| 802 |
exit: |
| 803 |
return return_value; |
| 804 |
} |
| 805 |
|
| 806 |
PyDoc_STRVAR(_ssl__SSLContext_set_ciphers__doc__, |
| 807 |
"set_ciphers($self, cipherlist, /)\n" |
| 808 |
"--\n" |
| 809 |
"\n"); |
| 810 |
|
| 811 |
#define _SSL__SSLCONTEXT_SET_CIPHERS_METHODDEF \ |
| 812 |
{"set_ciphers", (PyCFunction)_ssl__SSLContext_set_ciphers, METH_O, _ssl__SSLContext_set_ciphers__doc__}, |
| 813 |
|
| 814 |
static PyObject * |
| 815 |
_ssl__SSLContext_set_ciphers_impl(PySSLContext *self, const char *cipherlist); |
| 816 |
|
| 817 |
static PyObject * |
| 818 |
_ssl__SSLContext_set_ciphers(PyObject *self, PyObject *arg) |
| 819 |
{ |
| 820 |
PyObject *return_value = NULL; |
| 821 |
const char *cipherlist; |
| 822 |
|
| 823 |
if (!PyUnicode_Check(arg)) { |
| 824 |
_PyArg_BadArgument("set_ciphers", "argument", "str", arg); |
| 825 |
goto exit; |
| 826 |
} |
| 827 |
Py_ssize_t cipherlist_length; |
| 828 |
cipherlist = PyUnicode_AsUTF8AndSize(arg, &cipherlist_length); |
| 829 |
if (cipherlist == NULL) { |
| 830 |
goto exit; |
| 831 |
} |
| 832 |
if (strlen(cipherlist) != (size_t)cipherlist_length) { |
| 833 |
PyErr_SetString(PyExc_ValueError, "embedded null character"); |
| 834 |
goto exit; |
| 835 |
} |
| 836 |
Py_BEGIN_CRITICAL_SECTION(self); |
| 837 |
return_value = _ssl__SSLContext_set_ciphers_impl((PySSLContext *)self, cipherlist); |
| 838 |
Py_END_CRITICAL_SECTION(); |
| 839 |
|
| 840 |
exit: |
| 841 |
return return_value; |
| 842 |
} |
| 843 |
|
| 844 |
PyDoc_STRVAR(_ssl__SSLContext_get_ciphers__doc__, |
| 845 |
"get_ciphers($self, /)\n" |
| 846 |
"--\n" |
| 847 |
"\n"); |
| 848 |
|
| 849 |
#define _SSL__SSLCONTEXT_GET_CIPHERS_METHODDEF \ |
| 850 |
{"get_ciphers", (PyCFunction)_ssl__SSLContext_get_ciphers, METH_NOARGS, _ssl__SSLContext_get_ciphers__doc__}, |
| 851 |
|
| 852 |
static PyObject * |
| 853 |
_ssl__SSLContext_get_ciphers_impl(PySSLContext *self); |
| 854 |
|
| 855 |
static PyObject * |
| 856 |
_ssl__SSLContext_get_ciphers(PyObject *self, PyObject *Py_UNUSED(ignored)) |
| 857 |
{ |
| 858 |
PyObject *return_value = NULL; |
| 859 |
|
| 860 |
Py_BEGIN_CRITICAL_SECTION(self); |
| 861 |
return_value = _ssl__SSLContext_get_ciphers_impl((PySSLContext *)self); |
| 862 |
Py_END_CRITICAL_SECTION(); |
| 863 |
|
| 864 |
return return_value; |
| 865 |
} |
| 866 |
|
| 867 |
PyDoc_STRVAR(_ssl__SSLContext__set_alpn_protocols__doc__, |
| 868 |
"_set_alpn_protocols($self, protos, /)\n" |
| 869 |
"--\n" |
| 870 |
"\n"); |
| 871 |
|
| 872 |
#define _SSL__SSLCONTEXT__SET_ALPN_PROTOCOLS_METHODDEF \ |
| 873 |
{"_set_alpn_protocols", (PyCFunction)_ssl__SSLContext__set_alpn_protocols, METH_O, _ssl__SSLContext__set_alpn_protocols__doc__}, |
| 874 |
|
| 875 |
static PyObject * |
| 876 |
_ssl__SSLContext__set_alpn_protocols_impl(PySSLContext *self, |
| 877 |
Py_buffer *protos); |
| 878 |
|
| 879 |
static PyObject * |
| 880 |
_ssl__SSLContext__set_alpn_protocols(PyObject *self, PyObject *arg) |
| 881 |
{ |
| 882 |
PyObject *return_value = NULL; |
| 883 |
Py_buffer protos = {NULL, NULL}; |
| 884 |
|
| 885 |
if (PyObject_GetBuffer(arg, &protos, PyBUF_SIMPLE) != 0) { |
| 886 |
goto exit; |
| 887 |
} |
| 888 |
Py_BEGIN_CRITICAL_SECTION(self); |
| 889 |
return_value = _ssl__SSLContext__set_alpn_protocols_impl((PySSLContext *)self, &protos); |
| 890 |
Py_END_CRITICAL_SECTION(); |
| 891 |
|
| 892 |
exit: |
| 893 |
/* Cleanup for protos */ |
| 894 |
if (protos.obj) { |
| 895 |
PyBuffer_Release(&protos); |
| 896 |
} |
| 897 |
|
| 898 |
return return_value; |
| 899 |
} |
| 900 |
|
| 901 |
#if !defined(_ssl__SSLContext_verify_mode_DOCSTR) |
| 902 |
# define _ssl__SSLContext_verify_mode_DOCSTR NULL |
| 903 |
#endif |
| 904 |
#if defined(_SSL__SSLCONTEXT_VERIFY_MODE_GETSETDEF) |
| 905 |
# undef _SSL__SSLCONTEXT_VERIFY_MODE_GETSETDEF |
| 906 |
# define _SSL__SSLCONTEXT_VERIFY_MODE_GETSETDEF {"verify_mode", (getter)_ssl__SSLContext_verify_mode_get, (setter)_ssl__SSLContext_verify_mode_set, _ssl__SSLContext_verify_mode_DOCSTR}, |
| 907 |
#else |
| 908 |
# define _SSL__SSLCONTEXT_VERIFY_MODE_GETSETDEF {"verify_mode", (getter)_ssl__SSLContext_verify_mode_get, NULL, _ssl__SSLContext_verify_mode_DOCSTR}, |
| 909 |
#endif |
| 910 |
|
| 911 |
static PyObject * |
| 912 |
_ssl__SSLContext_verify_mode_get_impl(PySSLContext *self); |
| 913 |
|
| 914 |
static PyObject * |
| 915 |
_ssl__SSLContext_verify_mode_get(PyObject *self, void *Py_UNUSED(context)) |
| 916 |
{ |
| 917 |
PyObject *return_value = NULL; |
| 918 |
|
| 919 |
Py_BEGIN_CRITICAL_SECTION(self); |
| 920 |
return_value = _ssl__SSLContext_verify_mode_get_impl((PySSLContext *)self); |
| 921 |
Py_END_CRITICAL_SECTION(); |
| 922 |
|
| 923 |
return return_value; |
| 924 |
} |
| 925 |
|
| 926 |
#if !defined(_ssl__SSLContext_verify_mode_DOCSTR) |
| 927 |
# define _ssl__SSLContext_verify_mode_DOCSTR NULL |
| 928 |
#endif |
| 929 |
#if defined(_SSL__SSLCONTEXT_VERIFY_MODE_GETSETDEF) |
| 930 |
# undef _SSL__SSLCONTEXT_VERIFY_MODE_GETSETDEF |
| 931 |
# define _SSL__SSLCONTEXT_VERIFY_MODE_GETSETDEF {"verify_mode", (getter)_ssl__SSLContext_verify_mode_get, (setter)_ssl__SSLContext_verify_mode_set, _ssl__SSLContext_verify_mode_DOCSTR}, |
| 932 |
#else |
| 933 |
# define _SSL__SSLCONTEXT_VERIFY_MODE_GETSETDEF {"verify_mode", NULL, (setter)_ssl__SSLContext_verify_mode_set, NULL}, |
| 934 |
#endif |
| 935 |
|
| 936 |
static int |
| 937 |
_ssl__SSLContext_verify_mode_set_impl(PySSLContext *self, PyObject *value); |
| 938 |
|
| 939 |
static int |
| 940 |
_ssl__SSLContext_verify_mode_set(PyObject *self, PyObject *value, void *Py_UNUSED(context)) |
| 941 |
{ |
| 942 |
int return_value; |
| 943 |
|
| 944 |
Py_BEGIN_CRITICAL_SECTION(self); |
| 945 |
return_value = _ssl__SSLContext_verify_mode_set_impl((PySSLContext *)self, value); |
| 946 |
Py_END_CRITICAL_SECTION(); |
| 947 |
|
| 948 |
return return_value; |
| 949 |
} |
| 950 |
|
| 951 |
#if !defined(_ssl__SSLContext_verify_flags_DOCSTR) |
| 952 |
# define _ssl__SSLContext_verify_flags_DOCSTR NULL |
| 953 |
#endif |
| 954 |
#if defined(_SSL__SSLCONTEXT_VERIFY_FLAGS_GETSETDEF) |
| 955 |
# undef _SSL__SSLCONTEXT_VERIFY_FLAGS_GETSETDEF |
| 956 |
# define _SSL__SSLCONTEXT_VERIFY_FLAGS_GETSETDEF {"verify_flags", (getter)_ssl__SSLContext_verify_flags_get, (setter)_ssl__SSLContext_verify_flags_set, _ssl__SSLContext_verify_flags_DOCSTR}, |
| 957 |
#else |
| 958 |
# define _SSL__SSLCONTEXT_VERIFY_FLAGS_GETSETDEF {"verify_flags", (getter)_ssl__SSLContext_verify_flags_get, NULL, _ssl__SSLContext_verify_flags_DOCSTR}, |
| 959 |
#endif |
| 960 |
|
| 961 |
static PyObject * |
| 962 |
_ssl__SSLContext_verify_flags_get_impl(PySSLContext *self); |
| 963 |
|
| 964 |
static PyObject * |
| 965 |
_ssl__SSLContext_verify_flags_get(PyObject *self, void *Py_UNUSED(context)) |
| 966 |
{ |
| 967 |
PyObject *return_value = NULL; |
| 968 |
|
| 969 |
Py_BEGIN_CRITICAL_SECTION(self); |
| 970 |
return_value = _ssl__SSLContext_verify_flags_get_impl((PySSLContext *)self); |
| 971 |
Py_END_CRITICAL_SECTION(); |
| 972 |
|
| 973 |
return return_value; |
| 974 |
} |
| 975 |
|
| 976 |
#if !defined(_ssl__SSLContext_verify_flags_DOCSTR) |
| 977 |
# define _ssl__SSLContext_verify_flags_DOCSTR NULL |
| 978 |
#endif |
| 979 |
#if defined(_SSL__SSLCONTEXT_VERIFY_FLAGS_GETSETDEF) |
| 980 |
# undef _SSL__SSLCONTEXT_VERIFY_FLAGS_GETSETDEF |
| 981 |
# define _SSL__SSLCONTEXT_VERIFY_FLAGS_GETSETDEF {"verify_flags", (getter)_ssl__SSLContext_verify_flags_get, (setter)_ssl__SSLContext_verify_flags_set, _ssl__SSLContext_verify_flags_DOCSTR}, |
| 982 |
#else |
| 983 |
# define _SSL__SSLCONTEXT_VERIFY_FLAGS_GETSETDEF {"verify_flags", NULL, (setter)_ssl__SSLContext_verify_flags_set, NULL}, |
| 984 |
#endif |
| 985 |
|
| 986 |
static int |
| 987 |
_ssl__SSLContext_verify_flags_set_impl(PySSLContext *self, PyObject *value); |
| 988 |
|
| 989 |
static int |
| 990 |
_ssl__SSLContext_verify_flags_set(PyObject *self, PyObject *value, void *Py_UNUSED(context)) |
| 991 |
{ |
| 992 |
int return_value; |
| 993 |
|
| 994 |
Py_BEGIN_CRITICAL_SECTION(self); |
| 995 |
return_value = _ssl__SSLContext_verify_flags_set_impl((PySSLContext *)self, value); |
| 996 |
Py_END_CRITICAL_SECTION(); |
| 997 |
|
| 998 |
return return_value; |
| 999 |
} |
| 1000 |
|
| 1001 |
#if !defined(_ssl__SSLContext_minimum_version_DOCSTR) |
| 1002 |
# define _ssl__SSLContext_minimum_version_DOCSTR NULL |
| 1003 |
#endif |
| 1004 |
#if defined(_SSL__SSLCONTEXT_MINIMUM_VERSION_GETSETDEF) |
| 1005 |
# undef _SSL__SSLCONTEXT_MINIMUM_VERSION_GETSETDEF |
| 1006 |
# define _SSL__SSLCONTEXT_MINIMUM_VERSION_GETSETDEF {"minimum_version", (getter)_ssl__SSLContext_minimum_version_get, (setter)_ssl__SSLContext_minimum_version_set, _ssl__SSLContext_minimum_version_DOCSTR}, |
| 1007 |
#else |
| 1008 |
# define _SSL__SSLCONTEXT_MINIMUM_VERSION_GETSETDEF {"minimum_version", (getter)_ssl__SSLContext_minimum_version_get, NULL, _ssl__SSLContext_minimum_version_DOCSTR}, |
| 1009 |
#endif |
| 1010 |
|
| 1011 |
static PyObject * |
| 1012 |
_ssl__SSLContext_minimum_version_get_impl(PySSLContext *self); |
| 1013 |
|
| 1014 |
static PyObject * |
| 1015 |
_ssl__SSLContext_minimum_version_get(PyObject *self, void *Py_UNUSED(context)) |
| 1016 |
{ |
| 1017 |
PyObject *return_value = NULL; |
| 1018 |
|
| 1019 |
Py_BEGIN_CRITICAL_SECTION(self); |
| 1020 |
return_value = _ssl__SSLContext_minimum_version_get_impl((PySSLContext *)self); |
| 1021 |
Py_END_CRITICAL_SECTION(); |
| 1022 |
|
| 1023 |
return return_value; |
| 1024 |
} |
| 1025 |
|
| 1026 |
#if !defined(_ssl__SSLContext_minimum_version_DOCSTR) |
| 1027 |
# define _ssl__SSLContext_minimum_version_DOCSTR NULL |
| 1028 |
#endif |
| 1029 |
#if defined(_SSL__SSLCONTEXT_MINIMUM_VERSION_GETSETDEF) |
| 1030 |
# undef _SSL__SSLCONTEXT_MINIMUM_VERSION_GETSETDEF |
| 1031 |
# define _SSL__SSLCONTEXT_MINIMUM_VERSION_GETSETDEF {"minimum_version", (getter)_ssl__SSLContext_minimum_version_get, (setter)_ssl__SSLContext_minimum_version_set, _ssl__SSLContext_minimum_version_DOCSTR}, |
| 1032 |
#else |
| 1033 |
# define _SSL__SSLCONTEXT_MINIMUM_VERSION_GETSETDEF {"minimum_version", NULL, (setter)_ssl__SSLContext_minimum_version_set, NULL}, |
| 1034 |
#endif |
| 1035 |
|
| 1036 |
static int |
| 1037 |
_ssl__SSLContext_minimum_version_set_impl(PySSLContext *self, |
| 1038 |
PyObject *value); |
| 1039 |
|
| 1040 |
static int |
| 1041 |
_ssl__SSLContext_minimum_version_set(PyObject *self, PyObject *value, void *Py_UNUSED(context)) |
| 1042 |
{ |
| 1043 |
int return_value; |
| 1044 |
|
| 1045 |
Py_BEGIN_CRITICAL_SECTION(self); |
| 1046 |
return_value = _ssl__SSLContext_minimum_version_set_impl((PySSLContext *)self, value); |
| 1047 |
Py_END_CRITICAL_SECTION(); |
| 1048 |
|
| 1049 |
return return_value; |
| 1050 |
} |
| 1051 |
|
| 1052 |
#if !defined(_ssl__SSLContext_maximum_version_DOCSTR) |
| 1053 |
# define _ssl__SSLContext_maximum_version_DOCSTR NULL |
| 1054 |
#endif |
| 1055 |
#if defined(_SSL__SSLCONTEXT_MAXIMUM_VERSION_GETSETDEF) |
| 1056 |
# undef _SSL__SSLCONTEXT_MAXIMUM_VERSION_GETSETDEF |
| 1057 |
# define _SSL__SSLCONTEXT_MAXIMUM_VERSION_GETSETDEF {"maximum_version", (getter)_ssl__SSLContext_maximum_version_get, (setter)_ssl__SSLContext_maximum_version_set, _ssl__SSLContext_maximum_version_DOCSTR}, |
| 1058 |
#else |
| 1059 |
# define _SSL__SSLCONTEXT_MAXIMUM_VERSION_GETSETDEF {"maximum_version", (getter)_ssl__SSLContext_maximum_version_get, NULL, _ssl__SSLContext_maximum_version_DOCSTR}, |
| 1060 |
#endif |
| 1061 |
|
| 1062 |
static PyObject * |
| 1063 |
_ssl__SSLContext_maximum_version_get_impl(PySSLContext *self); |
| 1064 |
|
| 1065 |
static PyObject * |
| 1066 |
_ssl__SSLContext_maximum_version_get(PyObject *self, void *Py_UNUSED(context)) |
| 1067 |
{ |
| 1068 |
PyObject *return_value = NULL; |
| 1069 |
|
| 1070 |
Py_BEGIN_CRITICAL_SECTION(self); |
| 1071 |
return_value = _ssl__SSLContext_maximum_version_get_impl((PySSLContext *)self); |
| 1072 |
Py_END_CRITICAL_SECTION(); |
| 1073 |
|
| 1074 |
return return_value; |
| 1075 |
} |
| 1076 |
|
| 1077 |
#if !defined(_ssl__SSLContext_maximum_version_DOCSTR) |
| 1078 |
# define _ssl__SSLContext_maximum_version_DOCSTR NULL |
| 1079 |
#endif |
| 1080 |
#if defined(_SSL__SSLCONTEXT_MAXIMUM_VERSION_GETSETDEF) |
| 1081 |
# undef _SSL__SSLCONTEXT_MAXIMUM_VERSION_GETSETDEF |
| 1082 |
# define _SSL__SSLCONTEXT_MAXIMUM_VERSION_GETSETDEF {"maximum_version", (getter)_ssl__SSLContext_maximum_version_get, (setter)_ssl__SSLContext_maximum_version_set, _ssl__SSLContext_maximum_version_DOCSTR}, |
| 1083 |
#else |
| 1084 |
# define _SSL__SSLCONTEXT_MAXIMUM_VERSION_GETSETDEF {"maximum_version", NULL, (setter)_ssl__SSLContext_maximum_version_set, NULL}, |
| 1085 |
#endif |
| 1086 |
|
| 1087 |
static int |
| 1088 |
_ssl__SSLContext_maximum_version_set_impl(PySSLContext *self, |
| 1089 |
PyObject *value); |
| 1090 |
|
| 1091 |
static int |
| 1092 |
_ssl__SSLContext_maximum_version_set(PyObject *self, PyObject *value, void *Py_UNUSED(context)) |
| 1093 |
{ |
| 1094 |
int return_value; |
| 1095 |
|
| 1096 |
Py_BEGIN_CRITICAL_SECTION(self); |
| 1097 |
return_value = _ssl__SSLContext_maximum_version_set_impl((PySSLContext *)self, value); |
| 1098 |
Py_END_CRITICAL_SECTION(); |
| 1099 |
|
| 1100 |
return return_value; |
| 1101 |
} |
| 1102 |
|
| 1103 |
PyDoc_STRVAR(_ssl__SSLContext_num_tickets__doc__, |
| 1104 |
"Control the number of TLSv1.3 session tickets."); |
| 1105 |
#if defined(_ssl__SSLContext_num_tickets_DOCSTR) |
| 1106 |
# undef _ssl__SSLContext_num_tickets_DOCSTR |
| 1107 |
#endif |
| 1108 |
#define _ssl__SSLContext_num_tickets_DOCSTR _ssl__SSLContext_num_tickets__doc__ |
| 1109 |
|
| 1110 |
#if !defined(_ssl__SSLContext_num_tickets_DOCSTR) |
| 1111 |
# define _ssl__SSLContext_num_tickets_DOCSTR NULL |
| 1112 |
#endif |
| 1113 |
#if defined(_SSL__SSLCONTEXT_NUM_TICKETS_GETSETDEF) |
| 1114 |
# undef _SSL__SSLCONTEXT_NUM_TICKETS_GETSETDEF |
| 1115 |
# define _SSL__SSLCONTEXT_NUM_TICKETS_GETSETDEF {"num_tickets", (getter)_ssl__SSLContext_num_tickets_get, (setter)_ssl__SSLContext_num_tickets_set, _ssl__SSLContext_num_tickets_DOCSTR}, |
| 1116 |
#else |
| 1117 |
# define _SSL__SSLCONTEXT_NUM_TICKETS_GETSETDEF {"num_tickets", (getter)_ssl__SSLContext_num_tickets_get, NULL, _ssl__SSLContext_num_tickets_DOCSTR}, |
| 1118 |
#endif |
| 1119 |
|
| 1120 |
static PyObject * |
| 1121 |
_ssl__SSLContext_num_tickets_get_impl(PySSLContext *self); |
| 1122 |
|
| 1123 |
static PyObject * |
| 1124 |
_ssl__SSLContext_num_tickets_get(PyObject *self, void *Py_UNUSED(context)) |
| 1125 |
{ |
| 1126 |
PyObject *return_value = NULL; |
| 1127 |
|
| 1128 |
Py_BEGIN_CRITICAL_SECTION(self); |
| 1129 |
return_value = _ssl__SSLContext_num_tickets_get_impl((PySSLContext *)self); |
| 1130 |
Py_END_CRITICAL_SECTION(); |
| 1131 |
|
| 1132 |
return return_value; |
| 1133 |
} |
| 1134 |
|
| 1135 |
#if !defined(_ssl__SSLContext_num_tickets_DOCSTR) |
| 1136 |
# define _ssl__SSLContext_num_tickets_DOCSTR NULL |
| 1137 |
#endif |
| 1138 |
#if defined(_SSL__SSLCONTEXT_NUM_TICKETS_GETSETDEF) |
| 1139 |
# undef _SSL__SSLCONTEXT_NUM_TICKETS_GETSETDEF |
| 1140 |
# define _SSL__SSLCONTEXT_NUM_TICKETS_GETSETDEF {"num_tickets", (getter)_ssl__SSLContext_num_tickets_get, (setter)_ssl__SSLContext_num_tickets_set, _ssl__SSLContext_num_tickets_DOCSTR}, |
| 1141 |
#else |
| 1142 |
# define _SSL__SSLCONTEXT_NUM_TICKETS_GETSETDEF {"num_tickets", NULL, (setter)_ssl__SSLContext_num_tickets_set, NULL}, |
| 1143 |
#endif |
| 1144 |
|
| 1145 |
static int |
| 1146 |
_ssl__SSLContext_num_tickets_set_impl(PySSLContext *self, PyObject *value); |
| 1147 |
|
| 1148 |
static int |
| 1149 |
_ssl__SSLContext_num_tickets_set(PyObject *self, PyObject *value, void *Py_UNUSED(context)) |
| 1150 |
{ |
| 1151 |
int return_value; |
| 1152 |
|
| 1153 |
Py_BEGIN_CRITICAL_SECTION(self); |
| 1154 |
return_value = _ssl__SSLContext_num_tickets_set_impl((PySSLContext *)self, value); |
| 1155 |
Py_END_CRITICAL_SECTION(); |
| 1156 |
|
| 1157 |
return return_value; |
| 1158 |
} |
| 1159 |
|
| 1160 |
PyDoc_STRVAR(_ssl__SSLContext_security_level__doc__, |
| 1161 |
"The current security level."); |
| 1162 |
#if defined(_ssl__SSLContext_security_level_DOCSTR) |
| 1163 |
# undef _ssl__SSLContext_security_level_DOCSTR |
| 1164 |
#endif |
| 1165 |
#define _ssl__SSLContext_security_level_DOCSTR _ssl__SSLContext_security_level__doc__ |
| 1166 |
|
| 1167 |
#if !defined(_ssl__SSLContext_security_level_DOCSTR) |
| 1168 |
# define _ssl__SSLContext_security_level_DOCSTR NULL |
| 1169 |
#endif |
| 1170 |
#if defined(_SSL__SSLCONTEXT_SECURITY_LEVEL_GETSETDEF) |
| 1171 |
# undef _SSL__SSLCONTEXT_SECURITY_LEVEL_GETSETDEF |
| 1172 |
# define _SSL__SSLCONTEXT_SECURITY_LEVEL_GETSETDEF {"security_level", (getter)_ssl__SSLContext_security_level_get, (setter)_ssl__SSLContext_security_level_set, _ssl__SSLContext_security_level_DOCSTR}, |
| 1173 |
#else |
| 1174 |
# define _SSL__SSLCONTEXT_SECURITY_LEVEL_GETSETDEF {"security_level", (getter)_ssl__SSLContext_security_level_get, NULL, _ssl__SSLContext_security_level_DOCSTR}, |
| 1175 |
#endif |
| 1176 |
|
| 1177 |
static PyObject * |
| 1178 |
_ssl__SSLContext_security_level_get_impl(PySSLContext *self); |
| 1179 |
|
| 1180 |
static PyObject * |
| 1181 |
_ssl__SSLContext_security_level_get(PyObject *self, void *Py_UNUSED(context)) |
| 1182 |
{ |
| 1183 |
PyObject *return_value = NULL; |
| 1184 |
|
| 1185 |
Py_BEGIN_CRITICAL_SECTION(self); |
| 1186 |
return_value = _ssl__SSLContext_security_level_get_impl((PySSLContext *)self); |
| 1187 |
Py_END_CRITICAL_SECTION(); |
| 1188 |
|
| 1189 |
return return_value; |
| 1190 |
} |
| 1191 |
|
| 1192 |
#if !defined(_ssl__SSLContext_options_DOCSTR) |
| 1193 |
# define _ssl__SSLContext_options_DOCSTR NULL |
| 1194 |
#endif |
| 1195 |
#if defined(_SSL__SSLCONTEXT_OPTIONS_GETSETDEF) |
| 1196 |
# undef _SSL__SSLCONTEXT_OPTIONS_GETSETDEF |
| 1197 |
# define _SSL__SSLCONTEXT_OPTIONS_GETSETDEF {"options", (getter)_ssl__SSLContext_options_get, (setter)_ssl__SSLContext_options_set, _ssl__SSLContext_options_DOCSTR}, |
| 1198 |
#else |
| 1199 |
# define _SSL__SSLCONTEXT_OPTIONS_GETSETDEF {"options", (getter)_ssl__SSLContext_options_get, NULL, _ssl__SSLContext_options_DOCSTR}, |
| 1200 |
#endif |
| 1201 |
|
| 1202 |
static PyObject * |
| 1203 |
_ssl__SSLContext_options_get_impl(PySSLContext *self); |
| 1204 |
|
| 1205 |
static PyObject * |
| 1206 |
_ssl__SSLContext_options_get(PyObject *self, void *Py_UNUSED(context)) |
| 1207 |
{ |
| 1208 |
PyObject *return_value = NULL; |
| 1209 |
|
| 1210 |
Py_BEGIN_CRITICAL_SECTION(self); |
| 1211 |
return_value = _ssl__SSLContext_options_get_impl((PySSLContext *)self); |
| 1212 |
Py_END_CRITICAL_SECTION(); |
| 1213 |
|
| 1214 |
return return_value; |
| 1215 |
} |
| 1216 |
|
| 1217 |
#if !defined(_ssl__SSLContext_options_DOCSTR) |
| 1218 |
# define _ssl__SSLContext_options_DOCSTR NULL |
| 1219 |
#endif |
| 1220 |
#if defined(_SSL__SSLCONTEXT_OPTIONS_GETSETDEF) |
| 1221 |
# undef _SSL__SSLCONTEXT_OPTIONS_GETSETDEF |
| 1222 |
# define _SSL__SSLCONTEXT_OPTIONS_GETSETDEF {"options", (getter)_ssl__SSLContext_options_get, (setter)_ssl__SSLContext_options_set, _ssl__SSLContext_options_DOCSTR}, |
| 1223 |
#else |
| 1224 |
# define _SSL__SSLCONTEXT_OPTIONS_GETSETDEF {"options", NULL, (setter)_ssl__SSLContext_options_set, NULL}, |
| 1225 |
#endif |
| 1226 |
|
| 1227 |
static int |
| 1228 |
_ssl__SSLContext_options_set_impl(PySSLContext *self, PyObject *value); |
| 1229 |
|
| 1230 |
static int |
| 1231 |
_ssl__SSLContext_options_set(PyObject *self, PyObject *value, void *Py_UNUSED(context)) |
| 1232 |
{ |
| 1233 |
int return_value; |
| 1234 |
|
| 1235 |
Py_BEGIN_CRITICAL_SECTION(self); |
| 1236 |
return_value = _ssl__SSLContext_options_set_impl((PySSLContext *)self, value); |
| 1237 |
Py_END_CRITICAL_SECTION(); |
| 1238 |
|
| 1239 |
return return_value; |
| 1240 |
} |
| 1241 |
|
| 1242 |
#if !defined(_ssl__SSLContext__host_flags_DOCSTR) |
| 1243 |
# define _ssl__SSLContext__host_flags_DOCSTR NULL |
| 1244 |
#endif |
| 1245 |
#if defined(_SSL__SSLCONTEXT__HOST_FLAGS_GETSETDEF) |
| 1246 |
# undef _SSL__SSLCONTEXT__HOST_FLAGS_GETSETDEF |
| 1247 |
# define _SSL__SSLCONTEXT__HOST_FLAGS_GETSETDEF {"_host_flags", (getter)_ssl__SSLContext__host_flags_get, (setter)_ssl__SSLContext__host_flags_set, _ssl__SSLContext__host_flags_DOCSTR}, |
| 1248 |
#else |
| 1249 |
# define _SSL__SSLCONTEXT__HOST_FLAGS_GETSETDEF {"_host_flags", (getter)_ssl__SSLContext__host_flags_get, NULL, _ssl__SSLContext__host_flags_DOCSTR}, |
| 1250 |
#endif |
| 1251 |
|
| 1252 |
static PyObject * |
| 1253 |
_ssl__SSLContext__host_flags_get_impl(PySSLContext *self); |
| 1254 |
|
| 1255 |
static PyObject * |
| 1256 |
_ssl__SSLContext__host_flags_get(PyObject *self, void *Py_UNUSED(context)) |
| 1257 |
{ |
| 1258 |
PyObject *return_value = NULL; |
| 1259 |
|
| 1260 |
Py_BEGIN_CRITICAL_SECTION(self); |
| 1261 |
return_value = _ssl__SSLContext__host_flags_get_impl((PySSLContext *)self); |
| 1262 |
Py_END_CRITICAL_SECTION(); |
| 1263 |
|
| 1264 |
return return_value; |
| 1265 |
} |
| 1266 |
|
| 1267 |
#if !defined(_ssl__SSLContext__host_flags_DOCSTR) |
| 1268 |
# define _ssl__SSLContext__host_flags_DOCSTR NULL |
| 1269 |
#endif |
| 1270 |
#if defined(_SSL__SSLCONTEXT__HOST_FLAGS_GETSETDEF) |
| 1271 |
# undef _SSL__SSLCONTEXT__HOST_FLAGS_GETSETDEF |
| 1272 |
# define _SSL__SSLCONTEXT__HOST_FLAGS_GETSETDEF {"_host_flags", (getter)_ssl__SSLContext__host_flags_get, (setter)_ssl__SSLContext__host_flags_set, _ssl__SSLContext__host_flags_DOCSTR}, |
| 1273 |
#else |
| 1274 |
# define _SSL__SSLCONTEXT__HOST_FLAGS_GETSETDEF {"_host_flags", NULL, (setter)_ssl__SSLContext__host_flags_set, NULL}, |
| 1275 |
#endif |
| 1276 |
|
| 1277 |
static int |
| 1278 |
_ssl__SSLContext__host_flags_set_impl(PySSLContext *self, PyObject *value); |
| 1279 |
|
| 1280 |
static int |
| 1281 |
_ssl__SSLContext__host_flags_set(PyObject *self, PyObject *value, void *Py_UNUSED(context)) |
| 1282 |
{ |
| 1283 |
int return_value; |
| 1284 |
|
| 1285 |
Py_BEGIN_CRITICAL_SECTION(self); |
| 1286 |
return_value = _ssl__SSLContext__host_flags_set_impl((PySSLContext *)self, value); |
| 1287 |
Py_END_CRITICAL_SECTION(); |
| 1288 |
|
| 1289 |
return return_value; |
| 1290 |
} |
| 1291 |
|
| 1292 |
#if !defined(_ssl__SSLContext_check_hostname_DOCSTR) |
| 1293 |
# define _ssl__SSLContext_check_hostname_DOCSTR NULL |
| 1294 |
#endif |
| 1295 |
#if defined(_SSL__SSLCONTEXT_CHECK_HOSTNAME_GETSETDEF) |
| 1296 |
# undef _SSL__SSLCONTEXT_CHECK_HOSTNAME_GETSETDEF |
| 1297 |
# define _SSL__SSLCONTEXT_CHECK_HOSTNAME_GETSETDEF {"check_hostname", (getter)_ssl__SSLContext_check_hostname_get, (setter)_ssl__SSLContext_check_hostname_set, _ssl__SSLContext_check_hostname_DOCSTR}, |
| 1298 |
#else |
| 1299 |
# define _SSL__SSLCONTEXT_CHECK_HOSTNAME_GETSETDEF {"check_hostname", (getter)_ssl__SSLContext_check_hostname_get, NULL, _ssl__SSLContext_check_hostname_DOCSTR}, |
| 1300 |
#endif |
| 1301 |
|
| 1302 |
static PyObject * |
| 1303 |
_ssl__SSLContext_check_hostname_get_impl(PySSLContext *self); |
| 1304 |
|
| 1305 |
static PyObject * |
| 1306 |
_ssl__SSLContext_check_hostname_get(PyObject *self, void *Py_UNUSED(context)) |
| 1307 |
{ |
| 1308 |
PyObject *return_value = NULL; |
| 1309 |
|
| 1310 |
Py_BEGIN_CRITICAL_SECTION(self); |
| 1311 |
return_value = _ssl__SSLContext_check_hostname_get_impl((PySSLContext *)self); |
| 1312 |
Py_END_CRITICAL_SECTION(); |
| 1313 |
|
| 1314 |
return return_value; |
| 1315 |
} |
| 1316 |
|
| 1317 |
#if !defined(_ssl__SSLContext_check_hostname_DOCSTR) |
| 1318 |
# define _ssl__SSLContext_check_hostname_DOCSTR NULL |
| 1319 |
#endif |
| 1320 |
#if defined(_SSL__SSLCONTEXT_CHECK_HOSTNAME_GETSETDEF) |
| 1321 |
# undef _SSL__SSLCONTEXT_CHECK_HOSTNAME_GETSETDEF |
| 1322 |
# define _SSL__SSLCONTEXT_CHECK_HOSTNAME_GETSETDEF {"check_hostname", (getter)_ssl__SSLContext_check_hostname_get, (setter)_ssl__SSLContext_check_hostname_set, _ssl__SSLContext_check_hostname_DOCSTR}, |
| 1323 |
#else |
| 1324 |
# define _SSL__SSLCONTEXT_CHECK_HOSTNAME_GETSETDEF {"check_hostname", NULL, (setter)_ssl__SSLContext_check_hostname_set, NULL}, |
| 1325 |
#endif |
| 1326 |
|
| 1327 |
static int |
| 1328 |
_ssl__SSLContext_check_hostname_set_impl(PySSLContext *self, PyObject *value); |
| 1329 |
|
| 1330 |
static int |
| 1331 |
_ssl__SSLContext_check_hostname_set(PyObject *self, PyObject *value, void *Py_UNUSED(context)) |
| 1332 |
{ |
| 1333 |
int return_value; |
| 1334 |
|
| 1335 |
Py_BEGIN_CRITICAL_SECTION(self); |
| 1336 |
return_value = _ssl__SSLContext_check_hostname_set_impl((PySSLContext *)self, value); |
| 1337 |
Py_END_CRITICAL_SECTION(); |
| 1338 |
|
| 1339 |
return return_value; |
| 1340 |
} |
| 1341 |
|
| 1342 |
#if !defined(_ssl__SSLContext_protocol_DOCSTR) |
| 1343 |
# define _ssl__SSLContext_protocol_DOCSTR NULL |
| 1344 |
#endif |
| 1345 |
#if defined(_SSL__SSLCONTEXT_PROTOCOL_GETSETDEF) |
| 1346 |
# undef _SSL__SSLCONTEXT_PROTOCOL_GETSETDEF |
| 1347 |
# define _SSL__SSLCONTEXT_PROTOCOL_GETSETDEF {"protocol", (getter)_ssl__SSLContext_protocol_get, (setter)_ssl__SSLContext_protocol_set, _ssl__SSLContext_protocol_DOCSTR}, |
| 1348 |
#else |
| 1349 |
# define _SSL__SSLCONTEXT_PROTOCOL_GETSETDEF {"protocol", (getter)_ssl__SSLContext_protocol_get, NULL, _ssl__SSLContext_protocol_DOCSTR}, |
| 1350 |
#endif |
| 1351 |
|
| 1352 |
static PyObject * |
| 1353 |
_ssl__SSLContext_protocol_get_impl(PySSLContext *self); |
| 1354 |
|
| 1355 |
static PyObject * |
| 1356 |
_ssl__SSLContext_protocol_get(PyObject *self, void *Py_UNUSED(context)) |
| 1357 |
{ |
| 1358 |
PyObject *return_value = NULL; |
| 1359 |
|
| 1360 |
Py_BEGIN_CRITICAL_SECTION(self); |
| 1361 |
return_value = _ssl__SSLContext_protocol_get_impl((PySSLContext *)self); |
| 1362 |
Py_END_CRITICAL_SECTION(); |
| 1363 |
|
| 1364 |
return return_value; |
| 1365 |
} |
| 1366 |
|
| 1367 |
PyDoc_STRVAR(_ssl__SSLContext_load_cert_chain__doc__, |
| 1368 |
"load_cert_chain($self, /, certfile, keyfile=None, password=None)\n" |
| 1369 |
"--\n" |
| 1370 |
"\n"); |
| 1371 |
|
| 1372 |
#define _SSL__SSLCONTEXT_LOAD_CERT_CHAIN_METHODDEF \ |
| 1373 |
{"load_cert_chain", _PyCFunction_CAST(_ssl__SSLContext_load_cert_chain), METH_FASTCALL|METH_KEYWORDS, _ssl__SSLContext_load_cert_chain__doc__}, |
| 1374 |
|
| 1375 |
static PyObject * |
| 1376 |
_ssl__SSLContext_load_cert_chain_impl(PySSLContext *self, PyObject *certfile, |
| 1377 |
PyObject *keyfile, PyObject *password); |
| 1378 |
|
| 1379 |
static PyObject * |
| 1380 |
_ssl__SSLContext_load_cert_chain(PyObject *self, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames) |
| 1381 |
{ |
| 1382 |
PyObject *return_value = NULL; |
| 1383 |
#if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE) |
| 1384 |
|
| 1385 |
#define NUM_KEYWORDS 3 |
| 1386 |
static struct { |
| 1387 |
PyGC_Head _this_is_not_used; |
| 1388 |
PyObject_VAR_HEAD |
| 1389 |
Py_hash_t ob_hash; |
| 1390 |
PyObject *ob_item[NUM_KEYWORDS]; |
| 1391 |
} _kwtuple = { |
| 1392 |
.ob_base = PyVarObject_HEAD_INIT(&PyTuple_Type, NUM_KEYWORDS) |
| 1393 |
.ob_hash = -1, |
| 1394 |
.ob_item = { &_Py_ID(certfile), &_Py_ID(keyfile), &_Py_ID(password), }, |
| 1395 |
}; |
| 1396 |
#undef NUM_KEYWORDS |
| 1397 |
#define KWTUPLE (&_kwtuple.ob_base.ob_base) |
| 1398 |
|
| 1399 |
#else // !Py_BUILD_CORE |
| 1400 |
# define KWTUPLE NULL |
| 1401 |
#endif // !Py_BUILD_CORE |
| 1402 |
|
| 1403 |
static const char * const _keywords[] = {"certfile", "keyfile", "password", NULL}; |
| 1404 |
static _PyArg_Parser _parser = { |
| 1405 |
.keywords = _keywords, |
| 1406 |
.fname = "load_cert_chain", |
| 1407 |
.kwtuple = KWTUPLE, |
| 1408 |
}; |
| 1409 |
#undef KWTUPLE |
| 1410 |
PyObject *argsbuf[3]; |
| 1411 |
Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 1; |
| 1412 |
PyObject *certfile; |
| 1413 |
PyObject *keyfile = Py_None; |
| 1414 |
PyObject *password = Py_None; |
| 1415 |
|
| 1416 |
args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, |
| 1417 |
/*minpos*/ 1, /*maxpos*/ 3, /*minkw*/ 0, /*varpos*/ 0, argsbuf); |
| 1418 |
if (!args) { |
| 1419 |
goto exit; |
| 1420 |
} |
| 1421 |
certfile = args[0]; |
| 1422 |
if (!noptargs) { |
| 1423 |
goto skip_optional_pos; |
| 1424 |
} |
| 1425 |
if (args[1]) { |
| 1426 |
keyfile = args[1]; |
| 1427 |
if (!--noptargs) { |
| 1428 |
goto skip_optional_pos; |
| 1429 |
} |
| 1430 |
} |
| 1431 |
password = args[2]; |
| 1432 |
skip_optional_pos: |
| 1433 |
Py_BEGIN_CRITICAL_SECTION(self); |
| 1434 |
return_value = _ssl__SSLContext_load_cert_chain_impl((PySSLContext *)self, certfile, keyfile, password); |
| 1435 |
Py_END_CRITICAL_SECTION(); |
| 1436 |
|
| 1437 |
exit: |
| 1438 |
return return_value; |
| 1439 |
} |
| 1440 |
|
| 1441 |
PyDoc_STRVAR(_ssl__SSLContext_load_verify_locations__doc__, |
| 1442 |
"load_verify_locations($self, /, cafile=None, capath=None, cadata=None)\n" |
| 1443 |
"--\n" |
| 1444 |
"\n"); |
| 1445 |
|
| 1446 |
#define _SSL__SSLCONTEXT_LOAD_VERIFY_LOCATIONS_METHODDEF \ |
| 1447 |
{"load_verify_locations", _PyCFunction_CAST(_ssl__SSLContext_load_verify_locations), METH_FASTCALL|METH_KEYWORDS, _ssl__SSLContext_load_verify_locations__doc__}, |
| 1448 |
|
| 1449 |
static PyObject * |
| 1450 |
_ssl__SSLContext_load_verify_locations_impl(PySSLContext *self, |
| 1451 |
PyObject *cafile, |
| 1452 |
PyObject *capath, |
| 1453 |
PyObject *cadata); |
| 1454 |
|
| 1455 |
static PyObject * |
| 1456 |
_ssl__SSLContext_load_verify_locations(PyObject *self, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames) |
| 1457 |
{ |
| 1458 |
PyObject *return_value = NULL; |
| 1459 |
#if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE) |
| 1460 |
|
| 1461 |
#define NUM_KEYWORDS 3 |
| 1462 |
static struct { |
| 1463 |
PyGC_Head _this_is_not_used; |
| 1464 |
PyObject_VAR_HEAD |
| 1465 |
Py_hash_t ob_hash; |
| 1466 |
PyObject *ob_item[NUM_KEYWORDS]; |
| 1467 |
} _kwtuple = { |
| 1468 |
.ob_base = PyVarObject_HEAD_INIT(&PyTuple_Type, NUM_KEYWORDS) |
| 1469 |
.ob_hash = -1, |
| 1470 |
.ob_item = { &_Py_ID(cafile), &_Py_ID(capath), &_Py_ID(cadata), }, |
| 1471 |
}; |
| 1472 |
#undef NUM_KEYWORDS |
| 1473 |
#define KWTUPLE (&_kwtuple.ob_base.ob_base) |
| 1474 |
|
| 1475 |
#else // !Py_BUILD_CORE |
| 1476 |
# define KWTUPLE NULL |
| 1477 |
#endif // !Py_BUILD_CORE |
| 1478 |
|
| 1479 |
static const char * const _keywords[] = {"cafile", "capath", "cadata", NULL}; |
| 1480 |
static _PyArg_Parser _parser = { |
| 1481 |
.keywords = _keywords, |
| 1482 |
.fname = "load_verify_locations", |
| 1483 |
.kwtuple = KWTUPLE, |
| 1484 |
}; |
| 1485 |
#undef KWTUPLE |
| 1486 |
PyObject *argsbuf[3]; |
| 1487 |
Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 0; |
| 1488 |
PyObject *cafile = Py_None; |
| 1489 |
PyObject *capath = Py_None; |
| 1490 |
PyObject *cadata = Py_None; |
| 1491 |
|
| 1492 |
args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, |
| 1493 |
/*minpos*/ 0, /*maxpos*/ 3, /*minkw*/ 0, /*varpos*/ 0, argsbuf); |
| 1494 |
if (!args) { |
| 1495 |
goto exit; |
| 1496 |
} |
| 1497 |
if (!noptargs) { |
| 1498 |
goto skip_optional_pos; |
| 1499 |
} |
| 1500 |
if (args[0]) { |
| 1501 |
cafile = args[0]; |
| 1502 |
if (!--noptargs) { |
| 1503 |
goto skip_optional_pos; |
| 1504 |
} |
| 1505 |
} |
| 1506 |
if (args[1]) { |
| 1507 |
capath = args[1]; |
| 1508 |
if (!--noptargs) { |
| 1509 |
goto skip_optional_pos; |
| 1510 |
} |
| 1511 |
} |
| 1512 |
cadata = args[2]; |
| 1513 |
skip_optional_pos: |
| 1514 |
Py_BEGIN_CRITICAL_SECTION(self); |
| 1515 |
return_value = _ssl__SSLContext_load_verify_locations_impl((PySSLContext *)self, cafile, capath, cadata); |
| 1516 |
Py_END_CRITICAL_SECTION(); |
| 1517 |
|
| 1518 |
exit: |
| 1519 |
return return_value; |
| 1520 |
} |
| 1521 |
|
| 1522 |
PyDoc_STRVAR(_ssl__SSLContext_load_dh_params__doc__, |
| 1523 |
"load_dh_params($self, path, /)\n" |
| 1524 |
"--\n" |
| 1525 |
"\n"); |
| 1526 |
|
| 1527 |
#define _SSL__SSLCONTEXT_LOAD_DH_PARAMS_METHODDEF \ |
| 1528 |
{"load_dh_params", (PyCFunction)_ssl__SSLContext_load_dh_params, METH_O, _ssl__SSLContext_load_dh_params__doc__}, |
| 1529 |
|
| 1530 |
static PyObject * |
| 1531 |
_ssl__SSLContext_load_dh_params_impl(PySSLContext *self, PyObject *filepath); |
| 1532 |
|
| 1533 |
static PyObject * |
| 1534 |
_ssl__SSLContext_load_dh_params(PyObject *self, PyObject *filepath) |
| 1535 |
{ |
| 1536 |
PyObject *return_value = NULL; |
| 1537 |
|
| 1538 |
Py_BEGIN_CRITICAL_SECTION(self); |
| 1539 |
return_value = _ssl__SSLContext_load_dh_params_impl((PySSLContext *)self, filepath); |
| 1540 |
Py_END_CRITICAL_SECTION(); |
| 1541 |
|
| 1542 |
return return_value; |
| 1543 |
} |
| 1544 |
|
| 1545 |
PyDoc_STRVAR(_ssl__SSLContext__wrap_socket__doc__, |
| 1546 |
"_wrap_socket($self, /, sock, server_side, server_hostname=None, *,\n" |
| 1547 |
" owner=None, session=None)\n" |
| 1548 |
"--\n" |
| 1549 |
"\n"); |
| 1550 |
|
| 1551 |
#define _SSL__SSLCONTEXT__WRAP_SOCKET_METHODDEF \ |
| 1552 |
{"_wrap_socket", _PyCFunction_CAST(_ssl__SSLContext__wrap_socket), METH_FASTCALL|METH_KEYWORDS, _ssl__SSLContext__wrap_socket__doc__}, |
| 1553 |
|
| 1554 |
static PyObject * |
| 1555 |
_ssl__SSLContext__wrap_socket_impl(PySSLContext *self, PyObject *sock, |
| 1556 |
int server_side, PyObject *hostname_obj, |
| 1557 |
PyObject *owner, PyObject *session); |
| 1558 |
|
| 1559 |
static PyObject * |
| 1560 |
_ssl__SSLContext__wrap_socket(PyObject *self, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames) |
| 1561 |
{ |
| 1562 |
PyObject *return_value = NULL; |
| 1563 |
#if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE) |
| 1564 |
|
| 1565 |
#define NUM_KEYWORDS 5 |
| 1566 |
static struct { |
| 1567 |
PyGC_Head _this_is_not_used; |
| 1568 |
PyObject_VAR_HEAD |
| 1569 |
Py_hash_t ob_hash; |
| 1570 |
PyObject *ob_item[NUM_KEYWORDS]; |
| 1571 |
} _kwtuple = { |
| 1572 |
.ob_base = PyVarObject_HEAD_INIT(&PyTuple_Type, NUM_KEYWORDS) |
| 1573 |
.ob_hash = -1, |
| 1574 |
.ob_item = { &_Py_ID(sock), &_Py_ID(server_side), &_Py_ID(server_hostname), &_Py_ID(owner), &_Py_ID(session), }, |
| 1575 |
}; |
| 1576 |
#undef NUM_KEYWORDS |
| 1577 |
#define KWTUPLE (&_kwtuple.ob_base.ob_base) |
| 1578 |
|
| 1579 |
#else // !Py_BUILD_CORE |
| 1580 |
# define KWTUPLE NULL |
| 1581 |
#endif // !Py_BUILD_CORE |
| 1582 |
|
| 1583 |
static const char * const _keywords[] = {"sock", "server_side", "server_hostname", "owner", "session", NULL}; |
| 1584 |
static _PyArg_Parser _parser = { |
| 1585 |
.keywords = _keywords, |
| 1586 |
.fname = "_wrap_socket", |
| 1587 |
.kwtuple = KWTUPLE, |
| 1588 |
}; |
| 1589 |
#undef KWTUPLE |
| 1590 |
PyObject *argsbuf[5]; |
| 1591 |
Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 2; |
| 1592 |
PyObject *sock; |
| 1593 |
int server_side; |
| 1594 |
PyObject *hostname_obj = Py_None; |
| 1595 |
PyObject *owner = Py_None; |
| 1596 |
PyObject *session = Py_None; |
| 1597 |
|
| 1598 |
args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, |
| 1599 |
/*minpos*/ 2, /*maxpos*/ 3, /*minkw*/ 0, /*varpos*/ 0, argsbuf); |
| 1600 |
if (!args) { |
| 1601 |
goto exit; |
| 1602 |
} |
| 1603 |
if (!PyObject_TypeCheck(args[0], get_state_ctx(self)->Sock_Type)) { |
| 1604 |
_PyArg_BadArgument("_wrap_socket", "argument 'sock'", (get_state_ctx(self)->Sock_Type)->tp_name, args[0]); |
| 1605 |
goto exit; |
| 1606 |
} |
| 1607 |
sock = args[0]; |
| 1608 |
server_side = PyObject_IsTrue(args[1]); |
| 1609 |
if (server_side < 0) { |
| 1610 |
goto exit; |
| 1611 |
} |
| 1612 |
if (!noptargs) { |
| 1613 |
goto skip_optional_pos; |
| 1614 |
} |
| 1615 |
if (args[2]) { |
| 1616 |
hostname_obj = args[2]; |
| 1617 |
if (!--noptargs) { |
| 1618 |
goto skip_optional_pos; |
| 1619 |
} |
| 1620 |
} |
| 1621 |
skip_optional_pos: |
| 1622 |
if (!noptargs) { |
| 1623 |
goto skip_optional_kwonly; |
| 1624 |
} |
| 1625 |
if (args[3]) { |
| 1626 |
owner = args[3]; |
| 1627 |
if (!--noptargs) { |
| 1628 |
goto skip_optional_kwonly; |
| 1629 |
} |
| 1630 |
} |
| 1631 |
session = args[4]; |
| 1632 |
skip_optional_kwonly: |
| 1633 |
Py_BEGIN_CRITICAL_SECTION(self); |
| 1634 |
return_value = _ssl__SSLContext__wrap_socket_impl((PySSLContext *)self, sock, server_side, hostname_obj, owner, session); |
| 1635 |
Py_END_CRITICAL_SECTION(); |
| 1636 |
|
| 1637 |
exit: |
| 1638 |
return return_value; |
| 1639 |
} |
| 1640 |
|
| 1641 |
PyDoc_STRVAR(_ssl__SSLContext__wrap_bio__doc__, |
| 1642 |
"_wrap_bio($self, /, incoming, outgoing, server_side,\n" |
| 1643 |
" server_hostname=None, *, owner=None, session=None)\n" |
| 1644 |
"--\n" |
| 1645 |
"\n"); |
| 1646 |
|
| 1647 |
#define _SSL__SSLCONTEXT__WRAP_BIO_METHODDEF \ |
| 1648 |
{"_wrap_bio", _PyCFunction_CAST(_ssl__SSLContext__wrap_bio), METH_FASTCALL|METH_KEYWORDS, _ssl__SSLContext__wrap_bio__doc__}, |
| 1649 |
|
| 1650 |
static PyObject * |
| 1651 |
_ssl__SSLContext__wrap_bio_impl(PySSLContext *self, PySSLMemoryBIO *incoming, |
| 1652 |
PySSLMemoryBIO *outgoing, int server_side, |
| 1653 |
PyObject *hostname_obj, PyObject *owner, |
| 1654 |
PyObject *session); |
| 1655 |
|
| 1656 |
static PyObject * |
| 1657 |
_ssl__SSLContext__wrap_bio(PyObject *self, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames) |
| 1658 |
{ |
| 1659 |
PyObject *return_value = NULL; |
| 1660 |
#if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE) |
| 1661 |
|
| 1662 |
#define NUM_KEYWORDS 6 |
| 1663 |
static struct { |
| 1664 |
PyGC_Head _this_is_not_used; |
| 1665 |
PyObject_VAR_HEAD |
| 1666 |
Py_hash_t ob_hash; |
| 1667 |
PyObject *ob_item[NUM_KEYWORDS]; |
| 1668 |
} _kwtuple = { |
| 1669 |
.ob_base = PyVarObject_HEAD_INIT(&PyTuple_Type, NUM_KEYWORDS) |
| 1670 |
.ob_hash = -1, |
| 1671 |
.ob_item = { &_Py_ID(incoming), &_Py_ID(outgoing), &_Py_ID(server_side), &_Py_ID(server_hostname), &_Py_ID(owner), &_Py_ID(session), }, |
| 1672 |
}; |
| 1673 |
#undef NUM_KEYWORDS |
| 1674 |
#define KWTUPLE (&_kwtuple.ob_base.ob_base) |
| 1675 |
|
| 1676 |
#else // !Py_BUILD_CORE |
| 1677 |
# define KWTUPLE NULL |
| 1678 |
#endif // !Py_BUILD_CORE |
| 1679 |
|
| 1680 |
static const char * const _keywords[] = {"incoming", "outgoing", "server_side", "server_hostname", "owner", "session", NULL}; |
| 1681 |
static _PyArg_Parser _parser = { |
| 1682 |
.keywords = _keywords, |
| 1683 |
.fname = "_wrap_bio", |
| 1684 |
.kwtuple = KWTUPLE, |
| 1685 |
}; |
| 1686 |
#undef KWTUPLE |
| 1687 |
PyObject *argsbuf[6]; |
| 1688 |
Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 3; |
| 1689 |
PySSLMemoryBIO *incoming; |
| 1690 |
PySSLMemoryBIO *outgoing; |
| 1691 |
int server_side; |
| 1692 |
PyObject *hostname_obj = Py_None; |
| 1693 |
PyObject *owner = Py_None; |
| 1694 |
PyObject *session = Py_None; |
| 1695 |
|
| 1696 |
args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, |
| 1697 |
/*minpos*/ 3, /*maxpos*/ 4, /*minkw*/ 0, /*varpos*/ 0, argsbuf); |
| 1698 |
if (!args) { |
| 1699 |
goto exit; |
| 1700 |
} |
| 1701 |
if (!PyObject_TypeCheck(args[0], get_state_ctx(self)->PySSLMemoryBIO_Type)) { |
| 1702 |
_PyArg_BadArgument("_wrap_bio", "argument 'incoming'", (get_state_ctx(self)->PySSLMemoryBIO_Type)->tp_name, args[0]); |
| 1703 |
goto exit; |
| 1704 |
} |
| 1705 |
incoming = (PySSLMemoryBIO *)args[0]; |
| 1706 |
if (!PyObject_TypeCheck(args[1], get_state_ctx(self)->PySSLMemoryBIO_Type)) { |
| 1707 |
_PyArg_BadArgument("_wrap_bio", "argument 'outgoing'", (get_state_ctx(self)->PySSLMemoryBIO_Type)->tp_name, args[1]); |
| 1708 |
goto exit; |
| 1709 |
} |
| 1710 |
outgoing = (PySSLMemoryBIO *)args[1]; |
| 1711 |
server_side = PyObject_IsTrue(args[2]); |
| 1712 |
if (server_side < 0) { |
| 1713 |
goto exit; |
| 1714 |
} |
| 1715 |
if (!noptargs) { |
| 1716 |
goto skip_optional_pos; |
| 1717 |
} |
| 1718 |
if (args[3]) { |
| 1719 |
hostname_obj = args[3]; |
| 1720 |
if (!--noptargs) { |
| 1721 |
goto skip_optional_pos; |
| 1722 |
} |
| 1723 |
} |
| 1724 |
skip_optional_pos: |
| 1725 |
if (!noptargs) { |
| 1726 |
goto skip_optional_kwonly; |
| 1727 |
} |
| 1728 |
if (args[4]) { |
| 1729 |
owner = args[4]; |
| 1730 |
if (!--noptargs) { |
| 1731 |
goto skip_optional_kwonly; |
| 1732 |
} |
| 1733 |
} |
| 1734 |
session = args[5]; |
| 1735 |
skip_optional_kwonly: |
| 1736 |
Py_BEGIN_CRITICAL_SECTION(self); |
| 1737 |
return_value = _ssl__SSLContext__wrap_bio_impl((PySSLContext *)self, incoming, outgoing, server_side, hostname_obj, owner, session); |
| 1738 |
Py_END_CRITICAL_SECTION(); |
| 1739 |
|
| 1740 |
exit: |
| 1741 |
return return_value; |
| 1742 |
} |
| 1743 |
|
| 1744 |
PyDoc_STRVAR(_ssl__SSLContext_session_stats__doc__, |
| 1745 |
"session_stats($self, /)\n" |
| 1746 |
"--\n" |
| 1747 |
"\n"); |
| 1748 |
|
| 1749 |
#define _SSL__SSLCONTEXT_SESSION_STATS_METHODDEF \ |
| 1750 |
{"session_stats", (PyCFunction)_ssl__SSLContext_session_stats, METH_NOARGS, _ssl__SSLContext_session_stats__doc__}, |
| 1751 |
|
| 1752 |
static PyObject * |
| 1753 |
_ssl__SSLContext_session_stats_impl(PySSLContext *self); |
| 1754 |
|
| 1755 |
static PyObject * |
| 1756 |
_ssl__SSLContext_session_stats(PyObject *self, PyObject *Py_UNUSED(ignored)) |
| 1757 |
{ |
| 1758 |
PyObject *return_value = NULL; |
| 1759 |
|
| 1760 |
Py_BEGIN_CRITICAL_SECTION(self); |
| 1761 |
return_value = _ssl__SSLContext_session_stats_impl((PySSLContext *)self); |
| 1762 |
Py_END_CRITICAL_SECTION(); |
| 1763 |
|
| 1764 |
return return_value; |
| 1765 |
} |
| 1766 |
|
| 1767 |
PyDoc_STRVAR(_ssl__SSLContext_set_default_verify_paths__doc__, |
| 1768 |
"set_default_verify_paths($self, /)\n" |
| 1769 |
"--\n" |
| 1770 |
"\n"); |
| 1771 |
|
| 1772 |
#define _SSL__SSLCONTEXT_SET_DEFAULT_VERIFY_PATHS_METHODDEF \ |
| 1773 |
{"set_default_verify_paths", (PyCFunction)_ssl__SSLContext_set_default_verify_paths, METH_NOARGS, _ssl__SSLContext_set_default_verify_paths__doc__}, |
| 1774 |
|
| 1775 |
static PyObject * |
| 1776 |
_ssl__SSLContext_set_default_verify_paths_impl(PySSLContext *self); |
| 1777 |
|
| 1778 |
static PyObject * |
| 1779 |
_ssl__SSLContext_set_default_verify_paths(PyObject *self, PyObject *Py_UNUSED(ignored)) |
| 1780 |
{ |
| 1781 |
PyObject *return_value = NULL; |
| 1782 |
|
| 1783 |
Py_BEGIN_CRITICAL_SECTION(self); |
| 1784 |
return_value = _ssl__SSLContext_set_default_verify_paths_impl((PySSLContext *)self); |
| 1785 |
Py_END_CRITICAL_SECTION(); |
| 1786 |
|
| 1787 |
return return_value; |
| 1788 |
} |
| 1789 |
|
| 1790 |
PyDoc_STRVAR(_ssl__SSLContext_set_ecdh_curve__doc__, |
| 1791 |
"set_ecdh_curve($self, name, /)\n" |
| 1792 |
"--\n" |
| 1793 |
"\n"); |
| 1794 |
|
| 1795 |
#define _SSL__SSLCONTEXT_SET_ECDH_CURVE_METHODDEF \ |
| 1796 |
{"set_ecdh_curve", (PyCFunction)_ssl__SSLContext_set_ecdh_curve, METH_O, _ssl__SSLContext_set_ecdh_curve__doc__}, |
| 1797 |
|
| 1798 |
static PyObject * |
| 1799 |
_ssl__SSLContext_set_ecdh_curve_impl(PySSLContext *self, PyObject *name); |
| 1800 |
|
| 1801 |
static PyObject * |
| 1802 |
_ssl__SSLContext_set_ecdh_curve(PyObject *self, PyObject *name) |
| 1803 |
{ |
| 1804 |
PyObject *return_value = NULL; |
| 1805 |
|
| 1806 |
Py_BEGIN_CRITICAL_SECTION(self); |
| 1807 |
return_value = _ssl__SSLContext_set_ecdh_curve_impl((PySSLContext *)self, name); |
| 1808 |
Py_END_CRITICAL_SECTION(); |
| 1809 |
|
| 1810 |
return return_value; |
| 1811 |
} |
| 1812 |
|
| 1813 |
PyDoc_STRVAR(_ssl__SSLContext_sni_callback__doc__, |
| 1814 |
"Set a callback that will be called when a server name is provided by the SSL/TLS client in the SNI extension.\n" |
| 1815 |
"\n" |
| 1816 |
"If the argument is None then the callback is disabled. The method\n" |
| 1817 |
"is called with the SSLSocket, the server name as a string, and the\n" |
| 1818 |
"SSLContext object.\n" |
| 1819 |
"\n" |
| 1820 |
"See RFC 6066 for details of the SNI extension."); |
| 1821 |
#if defined(_ssl__SSLContext_sni_callback_DOCSTR) |
| 1822 |
# undef _ssl__SSLContext_sni_callback_DOCSTR |
| 1823 |
#endif |
| 1824 |
#define _ssl__SSLContext_sni_callback_DOCSTR _ssl__SSLContext_sni_callback__doc__ |
| 1825 |
|
| 1826 |
#if !defined(_ssl__SSLContext_sni_callback_DOCSTR) |
| 1827 |
# define _ssl__SSLContext_sni_callback_DOCSTR NULL |
| 1828 |
#endif |
| 1829 |
#if defined(_SSL__SSLCONTEXT_SNI_CALLBACK_GETSETDEF) |
| 1830 |
# undef _SSL__SSLCONTEXT_SNI_CALLBACK_GETSETDEF |
| 1831 |
# define _SSL__SSLCONTEXT_SNI_CALLBACK_GETSETDEF {"sni_callback", (getter)_ssl__SSLContext_sni_callback_get, (setter)_ssl__SSLContext_sni_callback_set, _ssl__SSLContext_sni_callback_DOCSTR}, |
| 1832 |
#else |
| 1833 |
# define _SSL__SSLCONTEXT_SNI_CALLBACK_GETSETDEF {"sni_callback", (getter)_ssl__SSLContext_sni_callback_get, NULL, _ssl__SSLContext_sni_callback_DOCSTR}, |
| 1834 |
#endif |
| 1835 |
|
| 1836 |
static PyObject * |
| 1837 |
_ssl__SSLContext_sni_callback_get_impl(PySSLContext *self); |
| 1838 |
|
| 1839 |
static PyObject * |
| 1840 |
_ssl__SSLContext_sni_callback_get(PyObject *self, void *Py_UNUSED(context)) |
| 1841 |
{ |
| 1842 |
PyObject *return_value = NULL; |
| 1843 |
|
| 1844 |
Py_BEGIN_CRITICAL_SECTION(self); |
| 1845 |
return_value = _ssl__SSLContext_sni_callback_get_impl((PySSLContext *)self); |
| 1846 |
Py_END_CRITICAL_SECTION(); |
| 1847 |
|
| 1848 |
return return_value; |
| 1849 |
} |
| 1850 |
|
| 1851 |
#if !defined(_ssl__SSLContext_sni_callback_DOCSTR) |
| 1852 |
# define _ssl__SSLContext_sni_callback_DOCSTR NULL |
| 1853 |
#endif |
| 1854 |
#if defined(_SSL__SSLCONTEXT_SNI_CALLBACK_GETSETDEF) |
| 1855 |
# undef _SSL__SSLCONTEXT_SNI_CALLBACK_GETSETDEF |
| 1856 |
# define _SSL__SSLCONTEXT_SNI_CALLBACK_GETSETDEF {"sni_callback", (getter)_ssl__SSLContext_sni_callback_get, (setter)_ssl__SSLContext_sni_callback_set, _ssl__SSLContext_sni_callback_DOCSTR}, |
| 1857 |
#else |
| 1858 |
# define _SSL__SSLCONTEXT_SNI_CALLBACK_GETSETDEF {"sni_callback", NULL, (setter)_ssl__SSLContext_sni_callback_set, NULL}, |
| 1859 |
#endif |
| 1860 |
|
| 1861 |
static int |
| 1862 |
_ssl__SSLContext_sni_callback_set_impl(PySSLContext *self, PyObject *value); |
| 1863 |
|
| 1864 |
static int |
| 1865 |
_ssl__SSLContext_sni_callback_set(PyObject *self, PyObject *value, void *Py_UNUSED(context)) |
| 1866 |
{ |
| 1867 |
int return_value; |
| 1868 |
|
| 1869 |
Py_BEGIN_CRITICAL_SECTION(self); |
| 1870 |
return_value = _ssl__SSLContext_sni_callback_set_impl((PySSLContext *)self, value); |
| 1871 |
Py_END_CRITICAL_SECTION(); |
| 1872 |
|
| 1873 |
return return_value; |
| 1874 |
} |
| 1875 |
|
| 1876 |
PyDoc_STRVAR(_ssl__SSLContext_cert_store_stats__doc__, |
| 1877 |
"cert_store_stats($self, /)\n" |
| 1878 |
"--\n" |
| 1879 |
"\n" |
| 1880 |
"Returns quantities of loaded X.509 certificates.\n" |
| 1881 |
"\n" |
| 1882 |
"X.509 certificates with a CA extension and certificate revocation\n" |
| 1883 |
"lists inside the context\'s cert store.\n" |
| 1884 |
"\n" |
| 1885 |
"NOTE: Certificates in a capath directory aren\'t loaded unless they\n" |
| 1886 |
"have been used at least once."); |
| 1887 |
|
| 1888 |
#define _SSL__SSLCONTEXT_CERT_STORE_STATS_METHODDEF \ |
| 1889 |
{"cert_store_stats", (PyCFunction)_ssl__SSLContext_cert_store_stats, METH_NOARGS, _ssl__SSLContext_cert_store_stats__doc__}, |
| 1890 |
|
| 1891 |
static PyObject * |
| 1892 |
_ssl__SSLContext_cert_store_stats_impl(PySSLContext *self); |
| 1893 |
|
| 1894 |
static PyObject * |
| 1895 |
_ssl__SSLContext_cert_store_stats(PyObject *self, PyObject *Py_UNUSED(ignored)) |
| 1896 |
{ |
| 1897 |
PyObject *return_value = NULL; |
| 1898 |
|
| 1899 |
Py_BEGIN_CRITICAL_SECTION(self); |
| 1900 |
return_value = _ssl__SSLContext_cert_store_stats_impl((PySSLContext *)self); |
| 1901 |
Py_END_CRITICAL_SECTION(); |
| 1902 |
|
| 1903 |
return return_value; |
| 1904 |
} |
| 1905 |
|
| 1906 |
PyDoc_STRVAR(_ssl__SSLContext_get_ca_certs__doc__, |
| 1907 |
"get_ca_certs($self, /, binary_form=False)\n" |
| 1908 |
"--\n" |
| 1909 |
"\n" |
| 1910 |
"Returns a list of dicts with information of loaded CA certs.\n" |
| 1911 |
"\n" |
| 1912 |
"If the optional argument is True, returns a DER-encoded copy of the\n" |
| 1913 |
"CA certificate.\n" |
| 1914 |
"\n" |
| 1915 |
"NOTE: Certificates in a capath directory aren\'t loaded unless they\n" |
| 1916 |
"have been used at least once."); |
| 1917 |
|
| 1918 |
#define _SSL__SSLCONTEXT_GET_CA_CERTS_METHODDEF \ |
| 1919 |
{"get_ca_certs", _PyCFunction_CAST(_ssl__SSLContext_get_ca_certs), METH_FASTCALL|METH_KEYWORDS, _ssl__SSLContext_get_ca_certs__doc__}, |
| 1920 |
|
| 1921 |
static PyObject * |
| 1922 |
_ssl__SSLContext_get_ca_certs_impl(PySSLContext *self, int binary_form); |
| 1923 |
|
| 1924 |
static PyObject * |
| 1925 |
_ssl__SSLContext_get_ca_certs(PyObject *self, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames) |
| 1926 |
{ |
| 1927 |
PyObject *return_value = NULL; |
| 1928 |
#if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE) |
| 1929 |
|
| 1930 |
#define NUM_KEYWORDS 1 |
| 1931 |
static struct { |
| 1932 |
PyGC_Head _this_is_not_used; |
| 1933 |
PyObject_VAR_HEAD |
| 1934 |
Py_hash_t ob_hash; |
| 1935 |
PyObject *ob_item[NUM_KEYWORDS]; |
| 1936 |
} _kwtuple = { |
| 1937 |
.ob_base = PyVarObject_HEAD_INIT(&PyTuple_Type, NUM_KEYWORDS) |
| 1938 |
.ob_hash = -1, |
| 1939 |
.ob_item = { &_Py_ID(binary_form), }, |
| 1940 |
}; |
| 1941 |
#undef NUM_KEYWORDS |
| 1942 |
#define KWTUPLE (&_kwtuple.ob_base.ob_base) |
| 1943 |
|
| 1944 |
#else // !Py_BUILD_CORE |
| 1945 |
# define KWTUPLE NULL |
| 1946 |
#endif // !Py_BUILD_CORE |
| 1947 |
|
| 1948 |
static const char * const _keywords[] = {"binary_form", NULL}; |
| 1949 |
static _PyArg_Parser _parser = { |
| 1950 |
.keywords = _keywords, |
| 1951 |
.fname = "get_ca_certs", |
| 1952 |
.kwtuple = KWTUPLE, |
| 1953 |
}; |
| 1954 |
#undef KWTUPLE |
| 1955 |
PyObject *argsbuf[1]; |
| 1956 |
Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 0; |
| 1957 |
int binary_form = 0; |
| 1958 |
|
| 1959 |
args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, |
| 1960 |
/*minpos*/ 0, /*maxpos*/ 1, /*minkw*/ 0, /*varpos*/ 0, argsbuf); |
| 1961 |
if (!args) { |
| 1962 |
goto exit; |
| 1963 |
} |
| 1964 |
if (!noptargs) { |
| 1965 |
goto skip_optional_pos; |
| 1966 |
} |
| 1967 |
binary_form = PyObject_IsTrue(args[0]); |
| 1968 |
if (binary_form < 0) { |
| 1969 |
goto exit; |
| 1970 |
} |
| 1971 |
skip_optional_pos: |
| 1972 |
Py_BEGIN_CRITICAL_SECTION(self); |
| 1973 |
return_value = _ssl__SSLContext_get_ca_certs_impl((PySSLContext *)self, binary_form); |
| 1974 |
Py_END_CRITICAL_SECTION(); |
| 1975 |
|
| 1976 |
exit: |
| 1977 |
return return_value; |
| 1978 |
} |
| 1979 |
|
| 1980 |
PyDoc_STRVAR(_ssl__SSLContext_set_psk_client_callback__doc__, |
| 1981 |
"set_psk_client_callback($self, /, callback)\n" |
| 1982 |
"--\n" |
| 1983 |
"\n"); |
| 1984 |
|
| 1985 |
#define _SSL__SSLCONTEXT_SET_PSK_CLIENT_CALLBACK_METHODDEF \ |
| 1986 |
{"set_psk_client_callback", _PyCFunction_CAST(_ssl__SSLContext_set_psk_client_callback), METH_FASTCALL|METH_KEYWORDS, _ssl__SSLContext_set_psk_client_callback__doc__}, |
| 1987 |
|
| 1988 |
static PyObject * |
| 1989 |
_ssl__SSLContext_set_psk_client_callback_impl(PySSLContext *self, |
| 1990 |
PyObject *callback); |
| 1991 |
|
| 1992 |
static PyObject * |
| 1993 |
_ssl__SSLContext_set_psk_client_callback(PyObject *self, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames) |
| 1994 |
{ |
| 1995 |
PyObject *return_value = NULL; |
| 1996 |
#if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE) |
| 1997 |
|
| 1998 |
#define NUM_KEYWORDS 1 |
| 1999 |
static struct { |
| 2000 |
PyGC_Head _this_is_not_used; |
| 2001 |
PyObject_VAR_HEAD |
| 2002 |
Py_hash_t ob_hash; |
| 2003 |
PyObject *ob_item[NUM_KEYWORDS]; |
| 2004 |
} _kwtuple = { |
| 2005 |
.ob_base = PyVarObject_HEAD_INIT(&PyTuple_Type, NUM_KEYWORDS) |
| 2006 |
.ob_hash = -1, |
| 2007 |
.ob_item = { &_Py_ID(callback), }, |
| 2008 |
}; |
| 2009 |
#undef NUM_KEYWORDS |
| 2010 |
#define KWTUPLE (&_kwtuple.ob_base.ob_base) |
| 2011 |
|
| 2012 |
#else // !Py_BUILD_CORE |
| 2013 |
# define KWTUPLE NULL |
| 2014 |
#endif // !Py_BUILD_CORE |
| 2015 |
|
| 2016 |
static const char * const _keywords[] = {"callback", NULL}; |
| 2017 |
static _PyArg_Parser _parser = { |
| 2018 |
.keywords = _keywords, |
| 2019 |
.fname = "set_psk_client_callback", |
| 2020 |
.kwtuple = KWTUPLE, |
| 2021 |
}; |
| 2022 |
#undef KWTUPLE |
| 2023 |
PyObject *argsbuf[1]; |
| 2024 |
PyObject *callback; |
| 2025 |
|
| 2026 |
args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, |
| 2027 |
/*minpos*/ 1, /*maxpos*/ 1, /*minkw*/ 0, /*varpos*/ 0, argsbuf); |
| 2028 |
if (!args) { |
| 2029 |
goto exit; |
| 2030 |
} |
| 2031 |
callback = args[0]; |
| 2032 |
Py_BEGIN_CRITICAL_SECTION(self); |
| 2033 |
return_value = _ssl__SSLContext_set_psk_client_callback_impl((PySSLContext *)self, callback); |
| 2034 |
Py_END_CRITICAL_SECTION(); |
| 2035 |
|
| 2036 |
exit: |
| 2037 |
return return_value; |
| 2038 |
} |
| 2039 |
|
| 2040 |
PyDoc_STRVAR(_ssl__SSLContext_set_psk_server_callback__doc__, |
| 2041 |
"set_psk_server_callback($self, /, callback, identity_hint=None)\n" |
| 2042 |
"--\n" |
| 2043 |
"\n"); |
| 2044 |
|
| 2045 |
#define _SSL__SSLCONTEXT_SET_PSK_SERVER_CALLBACK_METHODDEF \ |
| 2046 |
{"set_psk_server_callback", _PyCFunction_CAST(_ssl__SSLContext_set_psk_server_callback), METH_FASTCALL|METH_KEYWORDS, _ssl__SSLContext_set_psk_server_callback__doc__}, |
| 2047 |
|
| 2048 |
static PyObject * |
| 2049 |
_ssl__SSLContext_set_psk_server_callback_impl(PySSLContext *self, |
| 2050 |
PyObject *callback, |
| 2051 |
const char *identity_hint); |
| 2052 |
|
| 2053 |
static PyObject * |
| 2054 |
_ssl__SSLContext_set_psk_server_callback(PyObject *self, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames) |
| 2055 |
{ |
| 2056 |
PyObject *return_value = NULL; |
| 2057 |
#if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE) |
| 2058 |
|
| 2059 |
#define NUM_KEYWORDS 2 |
| 2060 |
static struct { |
| 2061 |
PyGC_Head _this_is_not_used; |
| 2062 |
PyObject_VAR_HEAD |
| 2063 |
Py_hash_t ob_hash; |
| 2064 |
PyObject *ob_item[NUM_KEYWORDS]; |
| 2065 |
} _kwtuple = { |
| 2066 |
.ob_base = PyVarObject_HEAD_INIT(&PyTuple_Type, NUM_KEYWORDS) |
| 2067 |
.ob_hash = -1, |
| 2068 |
.ob_item = { &_Py_ID(callback), &_Py_ID(identity_hint), }, |
| 2069 |
}; |
| 2070 |
#undef NUM_KEYWORDS |
| 2071 |
#define KWTUPLE (&_kwtuple.ob_base.ob_base) |
| 2072 |
|
| 2073 |
#else // !Py_BUILD_CORE |
| 2074 |
# define KWTUPLE NULL |
| 2075 |
#endif // !Py_BUILD_CORE |
| 2076 |
|
| 2077 |
static const char * const _keywords[] = {"callback", "identity_hint", NULL}; |
| 2078 |
static _PyArg_Parser _parser = { |
| 2079 |
.keywords = _keywords, |
| 2080 |
.fname = "set_psk_server_callback", |
| 2081 |
.kwtuple = KWTUPLE, |
| 2082 |
}; |
| 2083 |
#undef KWTUPLE |
| 2084 |
PyObject *argsbuf[2]; |
| 2085 |
Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 1; |
| 2086 |
PyObject *callback; |
| 2087 |
const char *identity_hint = NULL; |
| 2088 |
|
| 2089 |
args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, |
| 2090 |
/*minpos*/ 1, /*maxpos*/ 2, /*minkw*/ 0, /*varpos*/ 0, argsbuf); |
| 2091 |
if (!args) { |
| 2092 |
goto exit; |
| 2093 |
} |
| 2094 |
callback = args[0]; |
| 2095 |
if (!noptargs) { |
| 2096 |
goto skip_optional_pos; |
| 2097 |
} |
| 2098 |
if (args[1] == Py_None) { |
| 2099 |
identity_hint = NULL; |
| 2100 |
} |
| 2101 |
else if (PyUnicode_Check(args[1])) { |
| 2102 |
Py_ssize_t identity_hint_length; |
| 2103 |
identity_hint = PyUnicode_AsUTF8AndSize(args[1], &identity_hint_length); |
| 2104 |
if (identity_hint == NULL) { |
| 2105 |
goto exit; |
| 2106 |
} |
| 2107 |
if (strlen(identity_hint) != (size_t)identity_hint_length) { |
| 2108 |
PyErr_SetString(PyExc_ValueError, "embedded null character"); |
| 2109 |
goto exit; |
| 2110 |
} |
| 2111 |
} |
| 2112 |
else { |
| 2113 |
_PyArg_BadArgument("set_psk_server_callback", "argument 'identity_hint'", "str or None", args[1]); |
| 2114 |
goto exit; |
| 2115 |
} |
| 2116 |
skip_optional_pos: |
| 2117 |
Py_BEGIN_CRITICAL_SECTION(self); |
| 2118 |
return_value = _ssl__SSLContext_set_psk_server_callback_impl((PySSLContext *)self, callback, identity_hint); |
| 2119 |
Py_END_CRITICAL_SECTION(); |
| 2120 |
|
| 2121 |
exit: |
| 2122 |
return return_value; |
| 2123 |
} |
| 2124 |
|
| 2125 |
static PyObject * |
| 2126 |
_ssl_MemoryBIO_impl(PyTypeObject *type); |
| 2127 |
|
| 2128 |
static PyObject * |
| 2129 |
_ssl_MemoryBIO(PyTypeObject *type, PyObject *args, PyObject *kwargs) |
| 2130 |
{ |
| 2131 |
PyObject *return_value = NULL; |
| 2132 |
PyTypeObject *base_tp = get_state_type(type)->PySSLMemoryBIO_Type; |
| 2133 |
|
| 2134 |
if ((type == base_tp || type->tp_init == base_tp->tp_init) && |
| 2135 |
!_PyArg_NoPositional("MemoryBIO", args)) { |
| 2136 |
goto exit; |
| 2137 |
} |
| 2138 |
if ((type == base_tp || type->tp_init == base_tp->tp_init) && |
| 2139 |
!_PyArg_NoKeywords("MemoryBIO", kwargs)) { |
| 2140 |
goto exit; |
| 2141 |
} |
| 2142 |
Py_BEGIN_CRITICAL_SECTION(type); |
| 2143 |
return_value = _ssl_MemoryBIO_impl(type); |
| 2144 |
Py_END_CRITICAL_SECTION(); |
| 2145 |
|
| 2146 |
exit: |
| 2147 |
return return_value; |
| 2148 |
} |
| 2149 |
|
| 2150 |
PyDoc_STRVAR(_ssl_MemoryBIO_pending__doc__, |
| 2151 |
"The number of bytes pending in the memory BIO."); |
| 2152 |
#if defined(_ssl_MemoryBIO_pending_DOCSTR) |
| 2153 |
# undef _ssl_MemoryBIO_pending_DOCSTR |
| 2154 |
#endif |
| 2155 |
#define _ssl_MemoryBIO_pending_DOCSTR _ssl_MemoryBIO_pending__doc__ |
| 2156 |
|
| 2157 |
#if !defined(_ssl_MemoryBIO_pending_DOCSTR) |
| 2158 |
# define _ssl_MemoryBIO_pending_DOCSTR NULL |
| 2159 |
#endif |
| 2160 |
#if defined(_SSL_MEMORYBIO_PENDING_GETSETDEF) |
| 2161 |
# undef _SSL_MEMORYBIO_PENDING_GETSETDEF |
| 2162 |
# define _SSL_MEMORYBIO_PENDING_GETSETDEF {"pending", (getter)_ssl_MemoryBIO_pending_get, (setter)_ssl_MemoryBIO_pending_set, _ssl_MemoryBIO_pending_DOCSTR}, |
| 2163 |
#else |
| 2164 |
# define _SSL_MEMORYBIO_PENDING_GETSETDEF {"pending", (getter)_ssl_MemoryBIO_pending_get, NULL, _ssl_MemoryBIO_pending_DOCSTR}, |
| 2165 |
#endif |
| 2166 |
|
| 2167 |
static PyObject * |
| 2168 |
_ssl_MemoryBIO_pending_get_impl(PySSLMemoryBIO *self); |
| 2169 |
|
| 2170 |
static PyObject * |
| 2171 |
_ssl_MemoryBIO_pending_get(PyObject *self, void *Py_UNUSED(context)) |
| 2172 |
{ |
| 2173 |
PyObject *return_value = NULL; |
| 2174 |
|
| 2175 |
Py_BEGIN_CRITICAL_SECTION(self); |
| 2176 |
return_value = _ssl_MemoryBIO_pending_get_impl((PySSLMemoryBIO *)self); |
| 2177 |
Py_END_CRITICAL_SECTION(); |
| 2178 |
|
| 2179 |
return return_value; |
| 2180 |
} |
| 2181 |
|
| 2182 |
PyDoc_STRVAR(_ssl_MemoryBIO_eof__doc__, |
| 2183 |
"Whether the memory BIO is at EOF."); |
| 2184 |
#if defined(_ssl_MemoryBIO_eof_DOCSTR) |
| 2185 |
# undef _ssl_MemoryBIO_eof_DOCSTR |
| 2186 |
#endif |
| 2187 |
#define _ssl_MemoryBIO_eof_DOCSTR _ssl_MemoryBIO_eof__doc__ |
| 2188 |
|
| 2189 |
#if !defined(_ssl_MemoryBIO_eof_DOCSTR) |
| 2190 |
# define _ssl_MemoryBIO_eof_DOCSTR NULL |
| 2191 |
#endif |
| 2192 |
#if defined(_SSL_MEMORYBIO_EOF_GETSETDEF) |
| 2193 |
# undef _SSL_MEMORYBIO_EOF_GETSETDEF |
| 2194 |
# define _SSL_MEMORYBIO_EOF_GETSETDEF {"eof", (getter)_ssl_MemoryBIO_eof_get, (setter)_ssl_MemoryBIO_eof_set, _ssl_MemoryBIO_eof_DOCSTR}, |
| 2195 |
#else |
| 2196 |
# define _SSL_MEMORYBIO_EOF_GETSETDEF {"eof", (getter)_ssl_MemoryBIO_eof_get, NULL, _ssl_MemoryBIO_eof_DOCSTR}, |
| 2197 |
#endif |
| 2198 |
|
| 2199 |
static PyObject * |
| 2200 |
_ssl_MemoryBIO_eof_get_impl(PySSLMemoryBIO *self); |
| 2201 |
|
| 2202 |
static PyObject * |
| 2203 |
_ssl_MemoryBIO_eof_get(PyObject *self, void *Py_UNUSED(context)) |
| 2204 |
{ |
| 2205 |
PyObject *return_value = NULL; |
| 2206 |
|
| 2207 |
Py_BEGIN_CRITICAL_SECTION(self); |
| 2208 |
return_value = _ssl_MemoryBIO_eof_get_impl((PySSLMemoryBIO *)self); |
| 2209 |
Py_END_CRITICAL_SECTION(); |
| 2210 |
|
| 2211 |
return return_value; |
| 2212 |
} |
| 2213 |
|
| 2214 |
PyDoc_STRVAR(_ssl_MemoryBIO_read__doc__, |
| 2215 |
"read($self, size=-1, /)\n" |
| 2216 |
"--\n" |
| 2217 |
"\n" |
| 2218 |
"Read up to size bytes from the memory BIO.\n" |
| 2219 |
"\n" |
| 2220 |
"If size is not specified, read the entire buffer.\n" |
| 2221 |
"If the return value is an empty bytes instance, this means either\n" |
| 2222 |
"EOF or that no data is available. Use the \"eof\" property to\n" |
| 2223 |
"distinguish between the two."); |
| 2224 |
|
| 2225 |
#define _SSL_MEMORYBIO_READ_METHODDEF \ |
| 2226 |
{"read", _PyCFunction_CAST(_ssl_MemoryBIO_read), METH_FASTCALL, _ssl_MemoryBIO_read__doc__}, |
| 2227 |
|
| 2228 |
static PyObject * |
| 2229 |
_ssl_MemoryBIO_read_impl(PySSLMemoryBIO *self, int len); |
| 2230 |
|
| 2231 |
static PyObject * |
| 2232 |
_ssl_MemoryBIO_read(PyObject *self, PyObject *const *args, Py_ssize_t nargs) |
| 2233 |
{ |
| 2234 |
PyObject *return_value = NULL; |
| 2235 |
int len = -1; |
| 2236 |
|
| 2237 |
if (!_PyArg_CheckPositional("read", nargs, 0, 1)) { |
| 2238 |
goto exit; |
| 2239 |
} |
| 2240 |
if (nargs < 1) { |
| 2241 |
goto skip_optional; |
| 2242 |
} |
| 2243 |
len = PyLong_AsInt(args[0]); |
| 2244 |
if (len == -1 && PyErr_Occurred()) { |
| 2245 |
goto exit; |
| 2246 |
} |
| 2247 |
skip_optional: |
| 2248 |
Py_BEGIN_CRITICAL_SECTION(self); |
| 2249 |
return_value = _ssl_MemoryBIO_read_impl((PySSLMemoryBIO *)self, len); |
| 2250 |
Py_END_CRITICAL_SECTION(); |
| 2251 |
|
| 2252 |
exit: |
| 2253 |
return return_value; |
| 2254 |
} |
| 2255 |
|
| 2256 |
PyDoc_STRVAR(_ssl_MemoryBIO_write__doc__, |
| 2257 |
"write($self, b, /)\n" |
| 2258 |
"--\n" |
| 2259 |
"\n" |
| 2260 |
"Writes the bytes b into the memory BIO.\n" |
| 2261 |
"\n" |
| 2262 |
"Returns the number of bytes written."); |
| 2263 |
|
| 2264 |
#define _SSL_MEMORYBIO_WRITE_METHODDEF \ |
| 2265 |
{"write", (PyCFunction)_ssl_MemoryBIO_write, METH_O, _ssl_MemoryBIO_write__doc__}, |
| 2266 |
|
| 2267 |
static PyObject * |
| 2268 |
_ssl_MemoryBIO_write_impl(PySSLMemoryBIO *self, Py_buffer *b); |
| 2269 |
|
| 2270 |
static PyObject * |
| 2271 |
_ssl_MemoryBIO_write(PyObject *self, PyObject *arg) |
| 2272 |
{ |
| 2273 |
PyObject *return_value = NULL; |
| 2274 |
Py_buffer b = {NULL, NULL}; |
| 2275 |
|
| 2276 |
if (PyObject_GetBuffer(arg, &b, PyBUF_SIMPLE) != 0) { |
| 2277 |
goto exit; |
| 2278 |
} |
| 2279 |
Py_BEGIN_CRITICAL_SECTION(self); |
| 2280 |
return_value = _ssl_MemoryBIO_write_impl((PySSLMemoryBIO *)self, &b); |
| 2281 |
Py_END_CRITICAL_SECTION(); |
| 2282 |
|
| 2283 |
exit: |
| 2284 |
/* Cleanup for b */ |
| 2285 |
if (b.obj) { |
| 2286 |
PyBuffer_Release(&b); |
| 2287 |
} |
| 2288 |
|
| 2289 |
return return_value; |
| 2290 |
} |
| 2291 |
|
| 2292 |
PyDoc_STRVAR(_ssl_MemoryBIO_write_eof__doc__, |
| 2293 |
"write_eof($self, /)\n" |
| 2294 |
"--\n" |
| 2295 |
"\n" |
| 2296 |
"Write an EOF marker to the memory BIO.\n" |
| 2297 |
"\n" |
| 2298 |
"When all data has been read, the \"eof\" property will be True."); |
| 2299 |
|
| 2300 |
#define _SSL_MEMORYBIO_WRITE_EOF_METHODDEF \ |
| 2301 |
{"write_eof", (PyCFunction)_ssl_MemoryBIO_write_eof, METH_NOARGS, _ssl_MemoryBIO_write_eof__doc__}, |
| 2302 |
|
| 2303 |
static PyObject * |
| 2304 |
_ssl_MemoryBIO_write_eof_impl(PySSLMemoryBIO *self); |
| 2305 |
|
| 2306 |
static PyObject * |
| 2307 |
_ssl_MemoryBIO_write_eof(PyObject *self, PyObject *Py_UNUSED(ignored)) |
| 2308 |
{ |
| 2309 |
PyObject *return_value = NULL; |
| 2310 |
|
| 2311 |
Py_BEGIN_CRITICAL_SECTION(self); |
| 2312 |
return_value = _ssl_MemoryBIO_write_eof_impl((PySSLMemoryBIO *)self); |
| 2313 |
Py_END_CRITICAL_SECTION(); |
| 2314 |
|
| 2315 |
return return_value; |
| 2316 |
} |
| 2317 |
|
| 2318 |
PyDoc_STRVAR(_ssl_SSLSession_time__doc__, |
| 2319 |
"Session creation time (seconds since epoch)."); |
| 2320 |
#if defined(_ssl_SSLSession_time_DOCSTR) |
| 2321 |
# undef _ssl_SSLSession_time_DOCSTR |
| 2322 |
#endif |
| 2323 |
#define _ssl_SSLSession_time_DOCSTR _ssl_SSLSession_time__doc__ |
| 2324 |
|
| 2325 |
#if !defined(_ssl_SSLSession_time_DOCSTR) |
| 2326 |
# define _ssl_SSLSession_time_DOCSTR NULL |
| 2327 |
#endif |
| 2328 |
#if defined(_SSL_SSLSESSION_TIME_GETSETDEF) |
| 2329 |
# undef _SSL_SSLSESSION_TIME_GETSETDEF |
| 2330 |
# define _SSL_SSLSESSION_TIME_GETSETDEF {"time", (getter)_ssl_SSLSession_time_get, (setter)_ssl_SSLSession_time_set, _ssl_SSLSession_time_DOCSTR}, |
| 2331 |
#else |
| 2332 |
# define _SSL_SSLSESSION_TIME_GETSETDEF {"time", (getter)_ssl_SSLSession_time_get, NULL, _ssl_SSLSession_time_DOCSTR}, |
| 2333 |
#endif |
| 2334 |
|
| 2335 |
static PyObject * |
| 2336 |
_ssl_SSLSession_time_get_impl(PySSLSession *self); |
| 2337 |
|
| 2338 |
static PyObject * |
| 2339 |
_ssl_SSLSession_time_get(PyObject *self, void *Py_UNUSED(context)) |
| 2340 |
{ |
| 2341 |
PyObject *return_value = NULL; |
| 2342 |
|
| 2343 |
Py_BEGIN_CRITICAL_SECTION(self); |
| 2344 |
return_value = _ssl_SSLSession_time_get_impl((PySSLSession *)self); |
| 2345 |
Py_END_CRITICAL_SECTION(); |
| 2346 |
|
| 2347 |
return return_value; |
| 2348 |
} |
| 2349 |
|
| 2350 |
PyDoc_STRVAR(_ssl_SSLSession_timeout__doc__, |
| 2351 |
"Session timeout (delta in seconds)."); |
| 2352 |
#if defined(_ssl_SSLSession_timeout_DOCSTR) |
| 2353 |
# undef _ssl_SSLSession_timeout_DOCSTR |
| 2354 |
#endif |
| 2355 |
#define _ssl_SSLSession_timeout_DOCSTR _ssl_SSLSession_timeout__doc__ |
| 2356 |
|
| 2357 |
#if !defined(_ssl_SSLSession_timeout_DOCSTR) |
| 2358 |
# define _ssl_SSLSession_timeout_DOCSTR NULL |
| 2359 |
#endif |
| 2360 |
#if defined(_SSL_SSLSESSION_TIMEOUT_GETSETDEF) |
| 2361 |
# undef _SSL_SSLSESSION_TIMEOUT_GETSETDEF |
| 2362 |
# define _SSL_SSLSESSION_TIMEOUT_GETSETDEF {"timeout", (getter)_ssl_SSLSession_timeout_get, (setter)_ssl_SSLSession_timeout_set, _ssl_SSLSession_timeout_DOCSTR}, |
| 2363 |
#else |
| 2364 |
# define _SSL_SSLSESSION_TIMEOUT_GETSETDEF {"timeout", (getter)_ssl_SSLSession_timeout_get, NULL, _ssl_SSLSession_timeout_DOCSTR}, |
| 2365 |
#endif |
| 2366 |
|
| 2367 |
static PyObject * |
| 2368 |
_ssl_SSLSession_timeout_get_impl(PySSLSession *self); |
| 2369 |
|
| 2370 |
static PyObject * |
| 2371 |
_ssl_SSLSession_timeout_get(PyObject *self, void *Py_UNUSED(context)) |
| 2372 |
{ |
| 2373 |
PyObject *return_value = NULL; |
| 2374 |
|
| 2375 |
Py_BEGIN_CRITICAL_SECTION(self); |
| 2376 |
return_value = _ssl_SSLSession_timeout_get_impl((PySSLSession *)self); |
| 2377 |
Py_END_CRITICAL_SECTION(); |
| 2378 |
|
| 2379 |
return return_value; |
| 2380 |
} |
| 2381 |
|
| 2382 |
PyDoc_STRVAR(_ssl_SSLSession_ticket_lifetime_hint__doc__, |
| 2383 |
"Ticket life time hint."); |
| 2384 |
#if defined(_ssl_SSLSession_ticket_lifetime_hint_DOCSTR) |
| 2385 |
# undef _ssl_SSLSession_ticket_lifetime_hint_DOCSTR |
| 2386 |
#endif |
| 2387 |
#define _ssl_SSLSession_ticket_lifetime_hint_DOCSTR _ssl_SSLSession_ticket_lifetime_hint__doc__ |
| 2388 |
|
| 2389 |
#if !defined(_ssl_SSLSession_ticket_lifetime_hint_DOCSTR) |
| 2390 |
# define _ssl_SSLSession_ticket_lifetime_hint_DOCSTR NULL |
| 2391 |
#endif |
| 2392 |
#if defined(_SSL_SSLSESSION_TICKET_LIFETIME_HINT_GETSETDEF) |
| 2393 |
# undef _SSL_SSLSESSION_TICKET_LIFETIME_HINT_GETSETDEF |
| 2394 |
# define _SSL_SSLSESSION_TICKET_LIFETIME_HINT_GETSETDEF {"ticket_lifetime_hint", (getter)_ssl_SSLSession_ticket_lifetime_hint_get, (setter)_ssl_SSLSession_ticket_lifetime_hint_set, _ssl_SSLSession_ticket_lifetime_hint_DOCSTR}, |
| 2395 |
#else |
| 2396 |
# define _SSL_SSLSESSION_TICKET_LIFETIME_HINT_GETSETDEF {"ticket_lifetime_hint", (getter)_ssl_SSLSession_ticket_lifetime_hint_get, NULL, _ssl_SSLSession_ticket_lifetime_hint_DOCSTR}, |
| 2397 |
#endif |
| 2398 |
|
| 2399 |
static PyObject * |
| 2400 |
_ssl_SSLSession_ticket_lifetime_hint_get_impl(PySSLSession *self); |
| 2401 |
|
| 2402 |
static PyObject * |
| 2403 |
_ssl_SSLSession_ticket_lifetime_hint_get(PyObject *self, void *Py_UNUSED(context)) |
| 2404 |
{ |
| 2405 |
PyObject *return_value = NULL; |
| 2406 |
|
| 2407 |
Py_BEGIN_CRITICAL_SECTION(self); |
| 2408 |
return_value = _ssl_SSLSession_ticket_lifetime_hint_get_impl((PySSLSession *)self); |
| 2409 |
Py_END_CRITICAL_SECTION(); |
| 2410 |
|
| 2411 |
return return_value; |
| 2412 |
} |
| 2413 |
|
| 2414 |
PyDoc_STRVAR(_ssl_SSLSession_id__doc__, |
| 2415 |
"Session ID."); |
| 2416 |
#if defined(_ssl_SSLSession_id_DOCSTR) |
| 2417 |
# undef _ssl_SSLSession_id_DOCSTR |
| 2418 |
#endif |
| 2419 |
#define _ssl_SSLSession_id_DOCSTR _ssl_SSLSession_id__doc__ |
| 2420 |
|
| 2421 |
#if !defined(_ssl_SSLSession_id_DOCSTR) |
| 2422 |
# define _ssl_SSLSession_id_DOCSTR NULL |
| 2423 |
#endif |
| 2424 |
#if defined(_SSL_SSLSESSION_ID_GETSETDEF) |
| 2425 |
# undef _SSL_SSLSESSION_ID_GETSETDEF |
| 2426 |
# define _SSL_SSLSESSION_ID_GETSETDEF {"id", (getter)_ssl_SSLSession_id_get, (setter)_ssl_SSLSession_id_set, _ssl_SSLSession_id_DOCSTR}, |
| 2427 |
#else |
| 2428 |
# define _SSL_SSLSESSION_ID_GETSETDEF {"id", (getter)_ssl_SSLSession_id_get, NULL, _ssl_SSLSession_id_DOCSTR}, |
| 2429 |
#endif |
| 2430 |
|
| 2431 |
static PyObject * |
| 2432 |
_ssl_SSLSession_id_get_impl(PySSLSession *self); |
| 2433 |
|
| 2434 |
static PyObject * |
| 2435 |
_ssl_SSLSession_id_get(PyObject *self, void *Py_UNUSED(context)) |
| 2436 |
{ |
| 2437 |
PyObject *return_value = NULL; |
| 2438 |
|
| 2439 |
Py_BEGIN_CRITICAL_SECTION(self); |
| 2440 |
return_value = _ssl_SSLSession_id_get_impl((PySSLSession *)self); |
| 2441 |
Py_END_CRITICAL_SECTION(); |
| 2442 |
|
| 2443 |
return return_value; |
| 2444 |
} |
| 2445 |
|
| 2446 |
PyDoc_STRVAR(_ssl_SSLSession_has_ticket__doc__, |
| 2447 |
"Does the session contain a ticket?"); |
| 2448 |
#if defined(_ssl_SSLSession_has_ticket_DOCSTR) |
| 2449 |
# undef _ssl_SSLSession_has_ticket_DOCSTR |
| 2450 |
#endif |
| 2451 |
#define _ssl_SSLSession_has_ticket_DOCSTR _ssl_SSLSession_has_ticket__doc__ |
| 2452 |
|
| 2453 |
#if !defined(_ssl_SSLSession_has_ticket_DOCSTR) |
| 2454 |
# define _ssl_SSLSession_has_ticket_DOCSTR NULL |
| 2455 |
#endif |
| 2456 |
#if defined(_SSL_SSLSESSION_HAS_TICKET_GETSETDEF) |
| 2457 |
# undef _SSL_SSLSESSION_HAS_TICKET_GETSETDEF |
| 2458 |
# define _SSL_SSLSESSION_HAS_TICKET_GETSETDEF {"has_ticket", (getter)_ssl_SSLSession_has_ticket_get, (setter)_ssl_SSLSession_has_ticket_set, _ssl_SSLSession_has_ticket_DOCSTR}, |
| 2459 |
#else |
| 2460 |
# define _SSL_SSLSESSION_HAS_TICKET_GETSETDEF {"has_ticket", (getter)_ssl_SSLSession_has_ticket_get, NULL, _ssl_SSLSession_has_ticket_DOCSTR}, |
| 2461 |
#endif |
| 2462 |
|
| 2463 |
static PyObject * |
| 2464 |
_ssl_SSLSession_has_ticket_get_impl(PySSLSession *self); |
| 2465 |
|
| 2466 |
static PyObject * |
| 2467 |
_ssl_SSLSession_has_ticket_get(PyObject *self, void *Py_UNUSED(context)) |
| 2468 |
{ |
| 2469 |
PyObject *return_value = NULL; |
| 2470 |
|
| 2471 |
Py_BEGIN_CRITICAL_SECTION(self); |
| 2472 |
return_value = _ssl_SSLSession_has_ticket_get_impl((PySSLSession *)self); |
| 2473 |
Py_END_CRITICAL_SECTION(); |
| 2474 |
|
| 2475 |
return return_value; |
| 2476 |
} |
| 2477 |
|
| 2478 |
PyDoc_STRVAR(_ssl_RAND_add__doc__, |
| 2479 |
"RAND_add($module, string, entropy, /)\n" |
| 2480 |
"--\n" |
| 2481 |
"\n" |
| 2482 |
"Mix string into the OpenSSL PRNG state.\n" |
| 2483 |
"\n" |
| 2484 |
"entropy (a float) is a lower bound on the entropy contained in\n" |
| 2485 |
"string. See RFC 4086."); |
| 2486 |
|
| 2487 |
#define _SSL_RAND_ADD_METHODDEF \ |
| 2488 |
{"RAND_add", _PyCFunction_CAST(_ssl_RAND_add), METH_FASTCALL, _ssl_RAND_add__doc__}, |
| 2489 |
|
| 2490 |
static PyObject * |
| 2491 |
_ssl_RAND_add_impl(PyObject *module, Py_buffer *view, double entropy); |
| 2492 |
|
| 2493 |
static PyObject * |
| 2494 |
_ssl_RAND_add(PyObject *module, PyObject *const *args, Py_ssize_t nargs) |
| 2495 |
{ |
| 2496 |
PyObject *return_value = NULL; |
| 2497 |
Py_buffer view = {NULL, NULL}; |
| 2498 |
double entropy; |
| 2499 |
|
| 2500 |
if (!_PyArg_CheckPositional("RAND_add", nargs, 2, 2)) { |
| 2501 |
goto exit; |
| 2502 |
} |
| 2503 |
if (PyUnicode_Check(args[0])) { |
| 2504 |
Py_ssize_t len; |
| 2505 |
const char *ptr = PyUnicode_AsUTF8AndSize(args[0], &len); |
| 2506 |
if (ptr == NULL) { |
| 2507 |
goto exit; |
| 2508 |
} |
| 2509 |
if (PyBuffer_FillInfo(&view, args[0], (void *)ptr, len, 1, PyBUF_SIMPLE) < 0) { |
| 2510 |
goto exit; |
| 2511 |
} |
| 2512 |
} |
| 2513 |
else { /* any bytes-like object */ |
| 2514 |
if (PyObject_GetBuffer(args[0], &view, PyBUF_SIMPLE) != 0) { |
| 2515 |
goto exit; |
| 2516 |
} |
| 2517 |
} |
| 2518 |
if (PyFloat_CheckExact(args[1])) { |
| 2519 |
entropy = PyFloat_AS_DOUBLE(args[1]); |
| 2520 |
} |
| 2521 |
else |
| 2522 |
{ |
| 2523 |
entropy = PyFloat_AsDouble(args[1]); |
| 2524 |
if (entropy == -1.0 && PyErr_Occurred()) { |
| 2525 |
goto exit; |
| 2526 |
} |
| 2527 |
} |
| 2528 |
Py_BEGIN_CRITICAL_SECTION(module); |
| 2529 |
return_value = _ssl_RAND_add_impl(module, &view, entropy); |
| 2530 |
Py_END_CRITICAL_SECTION(); |
| 2531 |
|
| 2532 |
exit: |
| 2533 |
/* Cleanup for view */ |
| 2534 |
if (view.obj) { |
| 2535 |
PyBuffer_Release(&view); |
| 2536 |
} |
| 2537 |
|
| 2538 |
return return_value; |
| 2539 |
} |
| 2540 |
|
| 2541 |
PyDoc_STRVAR(_ssl_RAND_bytes__doc__, |
| 2542 |
"RAND_bytes($module, n, /)\n" |
| 2543 |
"--\n" |
| 2544 |
"\n" |
| 2545 |
"Generate n cryptographically strong pseudo-random bytes."); |
| 2546 |
|
| 2547 |
#define _SSL_RAND_BYTES_METHODDEF \ |
| 2548 |
{"RAND_bytes", (PyCFunction)_ssl_RAND_bytes, METH_O, _ssl_RAND_bytes__doc__}, |
| 2549 |
|
| 2550 |
static PyObject * |
| 2551 |
_ssl_RAND_bytes_impl(PyObject *module, int n); |
| 2552 |
|
| 2553 |
static PyObject * |
| 2554 |
_ssl_RAND_bytes(PyObject *module, PyObject *arg) |
| 2555 |
{ |
| 2556 |
PyObject *return_value = NULL; |
| 2557 |
int n; |
| 2558 |
|
| 2559 |
n = PyLong_AsInt(arg); |
| 2560 |
if (n == -1 && PyErr_Occurred()) { |
| 2561 |
goto exit; |
| 2562 |
} |
| 2563 |
Py_BEGIN_CRITICAL_SECTION(module); |
| 2564 |
return_value = _ssl_RAND_bytes_impl(module, n); |
| 2565 |
Py_END_CRITICAL_SECTION(); |
| 2566 |
|
| 2567 |
exit: |
| 2568 |
return return_value; |
| 2569 |
} |
| 2570 |
|
| 2571 |
PyDoc_STRVAR(_ssl_RAND_status__doc__, |
| 2572 |
"RAND_status($module, /)\n" |
| 2573 |
"--\n" |
| 2574 |
"\n" |
| 2575 |
"Returns True if the OpenSSL PRNG has been seeded with enough data and False if not.\n" |
| 2576 |
"\n" |
| 2577 |
"It is necessary to seed the PRNG with RAND_add() on some platforms\n" |
| 2578 |
"before using the ssl() function."); |
| 2579 |
|
| 2580 |
#define _SSL_RAND_STATUS_METHODDEF \ |
| 2581 |
{"RAND_status", (PyCFunction)_ssl_RAND_status, METH_NOARGS, _ssl_RAND_status__doc__}, |
| 2582 |
|
| 2583 |
static PyObject * |
| 2584 |
_ssl_RAND_status_impl(PyObject *module); |
| 2585 |
|
| 2586 |
static PyObject * |
| 2587 |
_ssl_RAND_status(PyObject *module, PyObject *Py_UNUSED(ignored)) |
| 2588 |
{ |
| 2589 |
PyObject *return_value = NULL; |
| 2590 |
|
| 2591 |
Py_BEGIN_CRITICAL_SECTION(module); |
| 2592 |
return_value = _ssl_RAND_status_impl(module); |
| 2593 |
Py_END_CRITICAL_SECTION(); |
| 2594 |
|
| 2595 |
return return_value; |
| 2596 |
} |
| 2597 |
|
| 2598 |
PyDoc_STRVAR(_ssl_get_default_verify_paths__doc__, |
| 2599 |
"get_default_verify_paths($module, /)\n" |
| 2600 |
"--\n" |
| 2601 |
"\n" |
| 2602 |
"Return search paths and environment vars that are used by SSLContext\'s set_default_verify_paths() to load default CAs.\n" |
| 2603 |
"\n" |
| 2604 |
"The values are \'cert_file_env\', \'cert_file\', \'cert_dir_env\', \'cert_dir\'."); |
| 2605 |
|
| 2606 |
#define _SSL_GET_DEFAULT_VERIFY_PATHS_METHODDEF \ |
| 2607 |
{"get_default_verify_paths", (PyCFunction)_ssl_get_default_verify_paths, METH_NOARGS, _ssl_get_default_verify_paths__doc__}, |
| 2608 |
|
| 2609 |
static PyObject * |
| 2610 |
_ssl_get_default_verify_paths_impl(PyObject *module); |
| 2611 |
|
| 2612 |
static PyObject * |
| 2613 |
_ssl_get_default_verify_paths(PyObject *module, PyObject *Py_UNUSED(ignored)) |
| 2614 |
{ |
| 2615 |
PyObject *return_value = NULL; |
| 2616 |
|
| 2617 |
Py_BEGIN_CRITICAL_SECTION(module); |
| 2618 |
return_value = _ssl_get_default_verify_paths_impl(module); |
| 2619 |
Py_END_CRITICAL_SECTION(); |
| 2620 |
|
| 2621 |
return return_value; |
| 2622 |
} |
| 2623 |
|
| 2624 |
PyDoc_STRVAR(_ssl_txt2obj__doc__, |
| 2625 |
"txt2obj($module, /, txt, name=False)\n" |
| 2626 |
"--\n" |
| 2627 |
"\n" |
| 2628 |
"Lookup NID, short name, long name and OID of an ASN1_OBJECT.\n" |
| 2629 |
"\n" |
| 2630 |
"By default objects are looked up by OID. With name=True short and\n" |
| 2631 |
"long name are also matched."); |
| 2632 |
|
| 2633 |
#define _SSL_TXT2OBJ_METHODDEF \ |
| 2634 |
{"txt2obj", _PyCFunction_CAST(_ssl_txt2obj), METH_FASTCALL|METH_KEYWORDS, _ssl_txt2obj__doc__}, |
| 2635 |
|
| 2636 |
static PyObject * |
| 2637 |
_ssl_txt2obj_impl(PyObject *module, const char *txt, int name); |
| 2638 |
|
| 2639 |
static PyObject * |
| 2640 |
_ssl_txt2obj(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames) |
| 2641 |
{ |
| 2642 |
PyObject *return_value = NULL; |
| 2643 |
#if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE) |
| 2644 |
|
| 2645 |
#define NUM_KEYWORDS 2 |
| 2646 |
static struct { |
| 2647 |
PyGC_Head _this_is_not_used; |
| 2648 |
PyObject_VAR_HEAD |
| 2649 |
Py_hash_t ob_hash; |
| 2650 |
PyObject *ob_item[NUM_KEYWORDS]; |
| 2651 |
} _kwtuple = { |
| 2652 |
.ob_base = PyVarObject_HEAD_INIT(&PyTuple_Type, NUM_KEYWORDS) |
| 2653 |
.ob_hash = -1, |
| 2654 |
.ob_item = { &_Py_ID(txt), &_Py_ID(name), }, |
| 2655 |
}; |
| 2656 |
#undef NUM_KEYWORDS |
| 2657 |
#define KWTUPLE (&_kwtuple.ob_base.ob_base) |
| 2658 |
|
| 2659 |
#else // !Py_BUILD_CORE |
| 2660 |
# define KWTUPLE NULL |
| 2661 |
#endif // !Py_BUILD_CORE |
| 2662 |
|
| 2663 |
static const char * const _keywords[] = {"txt", "name", NULL}; |
| 2664 |
static _PyArg_Parser _parser = { |
| 2665 |
.keywords = _keywords, |
| 2666 |
.fname = "txt2obj", |
| 2667 |
.kwtuple = KWTUPLE, |
| 2668 |
}; |
| 2669 |
#undef KWTUPLE |
| 2670 |
PyObject *argsbuf[2]; |
| 2671 |
Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 1; |
| 2672 |
const char *txt; |
| 2673 |
int name = 0; |
| 2674 |
|
| 2675 |
args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, |
| 2676 |
/*minpos*/ 1, /*maxpos*/ 2, /*minkw*/ 0, /*varpos*/ 0, argsbuf); |
| 2677 |
if (!args) { |
| 2678 |
goto exit; |
| 2679 |
} |
| 2680 |
if (!PyUnicode_Check(args[0])) { |
| 2681 |
_PyArg_BadArgument("txt2obj", "argument 'txt'", "str", args[0]); |
| 2682 |
goto exit; |
| 2683 |
} |
| 2684 |
Py_ssize_t txt_length; |
| 2685 |
txt = PyUnicode_AsUTF8AndSize(args[0], &txt_length); |
| 2686 |
if (txt == NULL) { |
| 2687 |
goto exit; |
| 2688 |
} |
| 2689 |
if (strlen(txt) != (size_t)txt_length) { |
| 2690 |
PyErr_SetString(PyExc_ValueError, "embedded null character"); |
| 2691 |
goto exit; |
| 2692 |
} |
| 2693 |
if (!noptargs) { |
| 2694 |
goto skip_optional_pos; |
| 2695 |
} |
| 2696 |
name = PyObject_IsTrue(args[1]); |
| 2697 |
if (name < 0) { |
| 2698 |
goto exit; |
| 2699 |
} |
| 2700 |
skip_optional_pos: |
| 2701 |
Py_BEGIN_CRITICAL_SECTION(module); |
| 2702 |
return_value = _ssl_txt2obj_impl(module, txt, name); |
| 2703 |
Py_END_CRITICAL_SECTION(); |
| 2704 |
|
| 2705 |
exit: |
| 2706 |
return return_value; |
| 2707 |
} |
| 2708 |
|
| 2709 |
PyDoc_STRVAR(_ssl_nid2obj__doc__, |
| 2710 |
"nid2obj($module, nid, /)\n" |
| 2711 |
"--\n" |
| 2712 |
"\n" |
| 2713 |
"Lookup NID, short name, long name and OID of an ASN1_OBJECT by NID."); |
| 2714 |
|
| 2715 |
#define _SSL_NID2OBJ_METHODDEF \ |
| 2716 |
{"nid2obj", (PyCFunction)_ssl_nid2obj, METH_O, _ssl_nid2obj__doc__}, |
| 2717 |
|
| 2718 |
static PyObject * |
| 2719 |
_ssl_nid2obj_impl(PyObject *module, int nid); |
| 2720 |
|
| 2721 |
static PyObject * |
| 2722 |
_ssl_nid2obj(PyObject *module, PyObject *arg) |
| 2723 |
{ |
| 2724 |
PyObject *return_value = NULL; |
| 2725 |
int nid; |
| 2726 |
|
| 2727 |
nid = PyLong_AsInt(arg); |
| 2728 |
if (nid == -1 && PyErr_Occurred()) { |
| 2729 |
goto exit; |
| 2730 |
} |
| 2731 |
Py_BEGIN_CRITICAL_SECTION(module); |
| 2732 |
return_value = _ssl_nid2obj_impl(module, nid); |
| 2733 |
Py_END_CRITICAL_SECTION(); |
| 2734 |
|
| 2735 |
exit: |
| 2736 |
return return_value; |
| 2737 |
} |
| 2738 |
|
| 2739 |
#if defined(_MSC_VER) |
| 2740 |
|
| 2741 |
PyDoc_STRVAR(_ssl_enum_certificates__doc__, |
| 2742 |
"enum_certificates($module, /, store_name)\n" |
| 2743 |
"--\n" |
| 2744 |
"\n" |
| 2745 |
"Retrieve certificates from Windows\' cert store.\n" |
| 2746 |
"\n" |
| 2747 |
"store_name may be one of \'CA\', \'ROOT\' or \'MY\'. The system may\n" |
| 2748 |
"provide more cert storages, too. The function returns a list of\n" |
| 2749 |
"(bytes, encoding_type, trust) tuples. The encoding_type flag can be\n" |
| 2750 |
"interpreted with X509_ASN_ENCODING or PKCS_7_ASN_ENCODING. The\n" |
| 2751 |
"trust setting is either a set of OIDs or the boolean True."); |
| 2752 |
|
| 2753 |
#define _SSL_ENUM_CERTIFICATES_METHODDEF \ |
| 2754 |
{"enum_certificates", _PyCFunction_CAST(_ssl_enum_certificates), METH_FASTCALL|METH_KEYWORDS, _ssl_enum_certificates__doc__}, |
| 2755 |
|
| 2756 |
static PyObject * |
| 2757 |
_ssl_enum_certificates_impl(PyObject *module, const char *store_name); |
| 2758 |
|
| 2759 |
static PyObject * |
| 2760 |
_ssl_enum_certificates(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames) |
| 2761 |
{ |
| 2762 |
PyObject *return_value = NULL; |
| 2763 |
#if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE) |
| 2764 |
|
| 2765 |
#define NUM_KEYWORDS 1 |
| 2766 |
static struct { |
| 2767 |
PyGC_Head _this_is_not_used; |
| 2768 |
PyObject_VAR_HEAD |
| 2769 |
Py_hash_t ob_hash; |
| 2770 |
PyObject *ob_item[NUM_KEYWORDS]; |
| 2771 |
} _kwtuple = { |
| 2772 |
.ob_base = PyVarObject_HEAD_INIT(&PyTuple_Type, NUM_KEYWORDS) |
| 2773 |
.ob_hash = -1, |
| 2774 |
.ob_item = { &_Py_ID(store_name), }, |
| 2775 |
}; |
| 2776 |
#undef NUM_KEYWORDS |
| 2777 |
#define KWTUPLE (&_kwtuple.ob_base.ob_base) |
| 2778 |
|
| 2779 |
#else // !Py_BUILD_CORE |
| 2780 |
# define KWTUPLE NULL |
| 2781 |
#endif // !Py_BUILD_CORE |
| 2782 |
|
| 2783 |
static const char * const _keywords[] = {"store_name", NULL}; |
| 2784 |
static _PyArg_Parser _parser = { |
| 2785 |
.keywords = _keywords, |
| 2786 |
.fname = "enum_certificates", |
| 2787 |
.kwtuple = KWTUPLE, |
| 2788 |
}; |
| 2789 |
#undef KWTUPLE |
| 2790 |
PyObject *argsbuf[1]; |
| 2791 |
const char *store_name; |
| 2792 |
|
| 2793 |
args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, |
| 2794 |
/*minpos*/ 1, /*maxpos*/ 1, /*minkw*/ 0, /*varpos*/ 0, argsbuf); |
| 2795 |
if (!args) { |
| 2796 |
goto exit; |
| 2797 |
} |
| 2798 |
if (!PyUnicode_Check(args[0])) { |
| 2799 |
_PyArg_BadArgument("enum_certificates", "argument 'store_name'", "str", args[0]); |
| 2800 |
goto exit; |
| 2801 |
} |
| 2802 |
Py_ssize_t store_name_length; |
| 2803 |
store_name = PyUnicode_AsUTF8AndSize(args[0], &store_name_length); |
| 2804 |
if (store_name == NULL) { |
| 2805 |
goto exit; |
| 2806 |
} |
| 2807 |
if (strlen(store_name) != (size_t)store_name_length) { |
| 2808 |
PyErr_SetString(PyExc_ValueError, "embedded null character"); |
| 2809 |
goto exit; |
| 2810 |
} |
| 2811 |
Py_BEGIN_CRITICAL_SECTION(module); |
| 2812 |
return_value = _ssl_enum_certificates_impl(module, store_name); |
| 2813 |
Py_END_CRITICAL_SECTION(); |
| 2814 |
|
| 2815 |
exit: |
| 2816 |
return return_value; |
| 2817 |
} |
| 2818 |
|
| 2819 |
#endif /* defined(_MSC_VER) */ |
| 2820 |
|
| 2821 |
#if defined(_MSC_VER) |
| 2822 |
|
| 2823 |
PyDoc_STRVAR(_ssl_enum_crls__doc__, |
| 2824 |
"enum_crls($module, /, store_name)\n" |
| 2825 |
"--\n" |
| 2826 |
"\n" |
| 2827 |
"Retrieve CRLs from Windows\' cert store.\n" |
| 2828 |
"\n" |
| 2829 |
"store_name may be one of \'CA\', \'ROOT\' or \'MY\'. The system may provide\n" |
| 2830 |
"more cert storages, too. The function returns a list of (bytes,\n" |
| 2831 |
"encoding_type) tuples. The encoding_type flag can be interpreted with\n" |
| 2832 |
"X509_ASN_ENCODING or PKCS_7_ASN_ENCODING."); |
| 2833 |
|
| 2834 |
#define _SSL_ENUM_CRLS_METHODDEF \ |
| 2835 |
{"enum_crls", _PyCFunction_CAST(_ssl_enum_crls), METH_FASTCALL|METH_KEYWORDS, _ssl_enum_crls__doc__}, |
| 2836 |
|
| 2837 |
static PyObject * |
| 2838 |
_ssl_enum_crls_impl(PyObject *module, const char *store_name); |
| 2839 |
|
| 2840 |
static PyObject * |
| 2841 |
_ssl_enum_crls(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames) |
| 2842 |
{ |
| 2843 |
PyObject *return_value = NULL; |
| 2844 |
#if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE) |
| 2845 |
|
| 2846 |
#define NUM_KEYWORDS 1 |
| 2847 |
static struct { |
| 2848 |
PyGC_Head _this_is_not_used; |
| 2849 |
PyObject_VAR_HEAD |
| 2850 |
Py_hash_t ob_hash; |
| 2851 |
PyObject *ob_item[NUM_KEYWORDS]; |
| 2852 |
} _kwtuple = { |
| 2853 |
.ob_base = PyVarObject_HEAD_INIT(&PyTuple_Type, NUM_KEYWORDS) |
| 2854 |
.ob_hash = -1, |
| 2855 |
.ob_item = { &_Py_ID(store_name), }, |
| 2856 |
}; |
| 2857 |
#undef NUM_KEYWORDS |
| 2858 |
#define KWTUPLE (&_kwtuple.ob_base.ob_base) |
| 2859 |
|
| 2860 |
#else // !Py_BUILD_CORE |
| 2861 |
# define KWTUPLE NULL |
| 2862 |
#endif // !Py_BUILD_CORE |
| 2863 |
|
| 2864 |
static const char * const _keywords[] = {"store_name", NULL}; |
| 2865 |
static _PyArg_Parser _parser = { |
| 2866 |
.keywords = _keywords, |
| 2867 |
.fname = "enum_crls", |
| 2868 |
.kwtuple = KWTUPLE, |
| 2869 |
}; |
| 2870 |
#undef KWTUPLE |
| 2871 |
PyObject *argsbuf[1]; |
| 2872 |
const char *store_name; |
| 2873 |
|
| 2874 |
args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, |
| 2875 |
/*minpos*/ 1, /*maxpos*/ 1, /*minkw*/ 0, /*varpos*/ 0, argsbuf); |
| 2876 |
if (!args) { |
| 2877 |
goto exit; |
| 2878 |
} |
| 2879 |
if (!PyUnicode_Check(args[0])) { |
| 2880 |
_PyArg_BadArgument("enum_crls", "argument 'store_name'", "str", args[0]); |
| 2881 |
goto exit; |
| 2882 |
} |
| 2883 |
Py_ssize_t store_name_length; |
| 2884 |
store_name = PyUnicode_AsUTF8AndSize(args[0], &store_name_length); |
| 2885 |
if (store_name == NULL) { |
| 2886 |
goto exit; |
| 2887 |
} |
| 2888 |
if (strlen(store_name) != (size_t)store_name_length) { |
| 2889 |
PyErr_SetString(PyExc_ValueError, "embedded null character"); |
| 2890 |
goto exit; |
| 2891 |
} |
| 2892 |
Py_BEGIN_CRITICAL_SECTION(module); |
| 2893 |
return_value = _ssl_enum_crls_impl(module, store_name); |
| 2894 |
Py_END_CRITICAL_SECTION(); |
| 2895 |
|
| 2896 |
exit: |
| 2897 |
return return_value; |
| 2898 |
} |
| 2899 |
|
| 2900 |
#endif /* defined(_MSC_VER) */ |
| 2901 |
|
| 2902 |
#ifndef _SSL_ENUM_CERTIFICATES_METHODDEF |
| 2903 |
#define _SSL_ENUM_CERTIFICATES_METHODDEF |
| 2904 |
#endif /* !defined(_SSL_ENUM_CERTIFICATES_METHODDEF) */ |
| 2905 |
|
| 2906 |
#ifndef _SSL_ENUM_CRLS_METHODDEF |
| 2907 |
#define _SSL_ENUM_CRLS_METHODDEF |
| 2908 |
#endif /* !defined(_SSL_ENUM_CRLS_METHODDEF) */ |
| 2909 |
/*[clinic end generated code: output=6b5d14b14e152522 input=a9049054013a1b77]*/ |