@@ -2288,6 +2288,42 @@ PySSL_select(PySocketSockObject *s, int writing, _PyTime_t timeout)
2288
2288
return rc == 0 ? SOCKET_HAS_TIMED_OUT : SOCKET_OPERATION_OK ;
2289
2289
}
2290
2290
2291
+ /*[clinic input]
2292
+ _ssl._SSLSocket.uses_ktls_for_write
2293
+
2294
+ Check if the Kernel TLS data-path is used for sending.
2295
+ [clinic start generated code]*/
2296
+
2297
+ static PyObject *
2298
+ _ssl__SSLSocket_uses_ktls_for_write_impl (PySSLSocket * self )
2299
+ /*[clinic end generated code: output=a6c2a790ffd0587e input=156f67420e69b2f9]*/
2300
+ {
2301
+ #ifdef BIO_get_ktls_send
2302
+ int uses = BIO_get_ktls_send (SSL_get_wbio (self -> ssl ));
2303
+ return PyBool_FromLong ((long )uses );
2304
+ #else
2305
+ return Py_False ;
2306
+ #endif
2307
+ }
2308
+
2309
+ /*[clinic input]
2310
+ _ssl._SSLSocket.uses_ktls_for_read
2311
+
2312
+ Check if the Kernel TLS data-path is used for receiving.
2313
+ [clinic start generated code]*/
2314
+
2315
+ static PyObject *
2316
+ _ssl__SSLSocket_uses_ktls_for_read_impl (PySSLSocket * self )
2317
+ /*[clinic end generated code: output=140a75033c8316a6 input=0296846b94a57932]*/
2318
+ {
2319
+ #ifdef BIO_get_ktls_recv
2320
+ int uses = BIO_get_ktls_recv (SSL_get_rbio (self -> ssl ));
2321
+ return PyBool_FromLong ((long )uses );
2322
+ #else
2323
+ return Py_False ;
2324
+ #endif
2325
+ }
2326
+
2291
2327
/*[clinic input]
2292
2328
_ssl._SSLSocket.write
2293
2329
b: Py_buffer
@@ -2904,6 +2940,8 @@ static PyGetSetDef ssl_getsetlist[] = {
2904
2940
2905
2941
static PyMethodDef PySSLMethods [] = {
2906
2942
_SSL__SSLSOCKET_DO_HANDSHAKE_METHODDEF
2943
+ _SSL__SSLSOCKET_USES_KTLS_FOR_WRITE_METHODDEF
2944
+ _SSL__SSLSOCKET_USES_KTLS_FOR_READ_METHODDEF
2907
2945
_SSL__SSLSOCKET_WRITE_METHODDEF
2908
2946
_SSL__SSLSOCKET_READ_METHODDEF
2909
2947
_SSL__SSLSOCKET_PENDING_METHODDEF
0 commit comments