English
ours-ktls-sys
libs/ktls-sys — a workspace crate with unsafe: kernel TLS system calls that are not in rustix.
What it does
set_keys— hand the kernel the TLS 1.3 keys (kernel_tx/kernel_rx) for the cipherCipher.send_record— send a record of a type other than application data (alert, handshake — for example,KeyUpdate) throughsendmsgwith the control messageTLS_SET_RECORD_TYPE.attach— attach thetlsULP to a TCP socket, before the keys.recv_record— receive one decrypted record and its type from the control messageTLS_GET_RECORD_TYPE; a record that fails to decrypt (EBADMSG) isInvalidData.supports_key_update— whether the kernel accepts new keys on a live connection: Linux 6.14 or later, read fromuname.
Everything else (splice, reading records before the handover) is done by ours-tls13.
Why a separate crate
The workspace forbids unsafe. The kTLS calls need it, so they live in this small crate with its own [lints]; see unsafe.
Who uses it
ours-tls13 (the unstable-ktls feature, an optional dependency). As a dev dependency — the tests of ours-mod-tls and ours-mod-vless.
Specifics
- Dependencies:
libcandrustix(foruname). - Works only on Linux; when kTLS is unavailable, the decision to stay in userspace TLS is made by
ours-tls13, not by this crate.
Tests
None of its own; kTLS is checked by modules/system/tls/tests/ktls.rs and the VLESS/HTTP tests, partly #[ignore] (they need the tls module and a kernel with key updates).