code wiki / (root) / nx_tls13_handshake_io.nx

nx_tls13_handshake_io.nx

buildroot/runtime/nx_tls13_handshake_io.nx

8069 B202 linesdepth 10pulls 36 transitivereach 0 importersview sourcekind orphan librarytopic tls13
docsdependenciesstructsconstsfunctions

about

nx_tls13_handshake_io.nx -- full TLS 1.3 handshake over real TCP. Phase 0c §L final wire-up per docs/NISHI_TLS13_GAP_AUDIT.md. Composes the in-memory handshake logic (shipped T6-T11) with the TCP wire layer (shipped T13) into one round-trip that drives the WHOLE handshake from `connect()` to CONNECTED over real sockets. This is the bridge between the in-memory loopback proof (nx_tls13_loopback_test, T6) which used byte buffers, and the real-world target where bytes have to flow through TCP. No new crypto, no new state machine -- pure orchestration. Wire layout (RFC 8446 §5): - CH and SH travel as TLSPlaintext records (type=22 handshake) - All records past SH are TLSCiphertext (type=23 application_data on the wire, with the inner content_type indicating what's actually inside) - This module uses ONE encrypted record per handshake message (simpler than the spec-allowed batching; valid per RFC 8446 since the spec lets any record carry 1+ messages) What it does today: - tls13_io_send_handshake_plain(fd, msg, msg_len) -- wrap msg in TLSPlaintext type=22, send - tls13_io_recv_handshake_plain(fd, out_buf, out_cap, out_len) -- recv TLSPlaintext, verify type=22, expose payload - tls13_io_send_handshake_encrypted(fd, key, iv, seq, msg, msg_len) -- encrypt under AEAD + send as TLSCiphertext - tls13_io_recv_handshake_encrypted(fd, key, iv, seq, out_buf, out_cap, out_len, out_inner_type) -- recv + decrypt + expose inner content_type and stripped-padding payload Orchestrators (the actual "drive a handshake from start to finish" callables that compose everything): - tls13_run_client_handshake(fd, sni, sni_len, client_priv, client_random, server_pub_out, out_keys, transcript) - tls13_run_server_handshake(fd, server_priv, server_random, out_keys, transcript)

dependencies 13 imports · 0 importers

nx_syscalls_x86_64.nx nx_x25519.nx nx_tls13.nx nx_tls13_io.nx nx_tls13_ext.nx nx_tls13_hello.nx nx_tls13_record.nx nx_tls13_finished.nx nx_tls13_transcript.nx nx_tls13_schedule.nx nx_tls13_handshake_io.nx

diagram shows first 10 each side; +3 more imports, +0 more importers in the complete lists below.

imports: nx_syscalls_x86_64.nxnx_x25519.nxnx_tls13.nxnx_tls13_io.nxnx_tls13_ext.nxnx_tls13_hello.nxnx_tls13_record.nxnx_tls13_finished.nxnx_tls13_transcript.nxnx_tls13_schedule.nxnx_tls13_handshake.nxnx_tls13_client.nxnx_tls13_server.nx

imported by: nobody (leaf or entry point)

structs

none

consts

92const NX_TLS13_HSIO_VERDICT_OK: i64 = 1
93const NX_TLS13_HSIO_VERDICT_IO_FAIL: i64 = 2
94const NX_TLS13_HSIO_VERDICT_DECRYPT_FAIL: i64 = 3
95const NX_TLS13_HSIO_VERDICT_WRONG_TYPE: i64 = 4
96const NX_TLS13_HSIO_VERDICT_HELLO_BAD: i64 = 5
97const NX_TLS13_HSIO_VERDICT_NO_KEY_SHARE: i64 = 6
98const NX_TLS13_HSIO_VERDICT_SF_BAD: i64 = 7
99const NX_TLS13_HSIO_VERDICT_CF_BAD: i64 = 8
100const NX_TLS13_HSIO_VERDICT_N: i64 = 9
102const NX_TLS13_HSIO_MAX_HS_MSG: i64 = 8192

functions

105func tls13_io_send_handshake_plain(fd: i64, msg: *u8, msg_len: i64) -> i64
112func tls13_io_recv_handshake_plain(
125func tls13_io_send_handshake_encrypted(
158func tls13_io_recv_handshake_encrypted(
198func nx_tls13_hsio_verdict_is_valid(v: i64) -> i64