Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 9dc0836

Browse files
authored
gh-96828: Add an ssl.OP_ENABLE_KTLS option (GH-96830)
Expose the constant when OpenSSL defines it.
1 parent c69cfcd commit 9dc0836

File tree

3 files changed

+21
-0
lines changed

3 files changed

+21
-0
lines changed

Doc/library/ssl.rst

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -807,6 +807,22 @@ Constants
807807

808808
.. versionadded:: 3.10
809809

810+
.. data:: OP_ENABLE_KTLS
811+
812+
Enable the use of the kernel TLS. To benefit from the feature, OpenSSL must
813+
have been compiled with support for it, and the negotiated cipher suites and
814+
extensions must be supported by it (a list of supported ones may vary by
815+
platform and kernel version).
816+
817+
Note that with enabled kernel TLS some cryptographic operations are
818+
performed by the kernel directly and not via any available OpenSSL
819+
Providers. This might be undesirable if, for example, the application
820+
requires all cryptographic operations to be performed by the FIPS provider.
821+
822+
This option is only available with OpenSSL 3.0.0 and later.
823+
824+
.. versionadded:: 3.12
825+
810826
.. data:: HAS_ALPN
811827

812828
Whether the OpenSSL library has built-in support for the *Application-Layer
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Add an :data:`~ssl.OP_ENABLE_KTLS` option for enabling the use of the kernel
2+
TLS (kTLS). Patch by Illia Volochii.

Modules/_ssl.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5864,6 +5864,9 @@ sslmodule_init_constants(PyObject *m)
58645864
PyModule_AddIntConstant(m, "OP_IGNORE_UNEXPECTED_EOF",
58655865
SSL_OP_IGNORE_UNEXPECTED_EOF);
58665866
#endif
5867+
#ifdef SSL_OP_ENABLE_KTLS
5868+
PyModule_AddIntConstant(m, "OP_ENABLE_KTLS", SSL_OP_ENABLE_KTLS);
5869+
#endif
58675870

58685871
#ifdef X509_CHECK_FLAG_ALWAYS_CHECK_SUBJECT
58695872
PyModule_AddIntConstant(m, "HOSTFLAG_ALWAYS_CHECK_SUBJECT",

0 commit comments

Comments
 (0)