code wiki / (root) / nx_tls13_client_session_recv_hs.nx

nx_tls13_client_session_recv_hs.nx

buildroot/runtime/nx_tls13_client_session_recv_hs.nx

11992 B266 linesdepth 17pulls 103 transitivereach 497 importersview sourcekind tooltopic tls13
docsdependenciesstructsconstsfunctions

about

nx_tls13_client_session_recv_hs.nx -- step 3c.3 of the nx_https_client wiring arc. Consumes ONE encrypted TLS record (the caller has already read it from fd into a buffer, including the 5-byte TLSCiphertext header) and walks the dispatch loop: 1. Decrypt record with session.server_hs_traffic_key + IV + session.server_seq via shipped nx_tls13_record_decrypt -> produces inner plaintext + real ContentType 2. Increment session.server_seq for next record 3. Reject record if ContentType != 22 (HANDSHAKE) 4. Walk the inner plaintext extracting handshake messages (each is [type:1][length:3][body:length]) 5. For each handshake message: - Call shipped tls13_client_dispatch_with_validation (which enforces cert validation at WAIT_CERT via the bridge shipped in c5ddbf81) - Update session.state from out_new_state - If dispatcher returned non-OK -> bail with mapped verdict 6. Return OK after processing all messages in the record Caller invokes this once per record received from fd. After multiple calls the session reaches CONNECTED state (server Finished verified), at which point step 3c.4 emits the client Finished. Public API: nx_tls13_client_session_recv_hs( session, record_bytes, record_len, val_ctx ) -> verdict nx_tls13_recv_hs_verdict_is_valid(v) -> 0|1 Sealed verdict enum: NX_TLS13_RECV_HS_OK record processed (may be partial handshake progress; check session.state) NX_TLS13_RECV_HS_BAD_STATE session not in WAIT_EE..WAIT_SF NX_TLS13_RECV_HS_RECORD_FAIL record decrypt verdict non-OK NX_TLS13_RECV_HS_WRONG_CT decrypted ContentType != 22

dependencies 7 imports · 6 importers

nx_syscalls.nx nx_tls13_record.nx nx_tls13_client.nx nx_tls13_client_validate_certifica nx_tls13_client_dispatch_with_vali nx_tls13_client_session.nx nx_tls13_client_verify_cv.nx nx_tls13_client_session_recv_h nx_tls13_ch_compat_test.nx nx_tls13_client_h2run.nx nx_tls13_client_session_recv_hs_te nx_tls13_client_session_run.nx nx_tls13_recv_hs_diff_test.nx nx_tls13_recv_hs_probe_test.nx

imports: nx_syscalls.nxnx_tls13_record.nxnx_tls13_client.nxnx_tls13_client_validate_certificate.nxnx_tls13_client_dispatch_with_validation.nxnx_tls13_client_session.nxnx_tls13_client_verify_cv.nx

imported by: nx_tls13_ch_compat_test.nxnx_tls13_client_h2run.nxnx_tls13_client_session_recv_hs_test.nxnx_tls13_client_session_run.nxnx_tls13_recv_hs_diff_test.nxnx_tls13_recv_hs_probe_test.nx

structs

none

consts

71const NX_MAGIC_8192: i64 = 8192
73const NX_TLS13_RECV_HS_OK: i64 = 1
74const NX_TLS13_RECV_HS_BAD_STATE: i64 = 2
75const NX_TLS13_RECV_HS_RECORD_FAIL: i64 = 3
76const NX_TLS13_RECV_HS_WRONG_CT: i64 = 4
77const NX_TLS13_RECV_HS_MSG_TOO_SHORT: i64 = 5
78const NX_TLS13_RECV_HS_DISPATCH_FAIL: i64 = 6
79const NX_TLS13_RECV_HS_INTERNAL: i64 = 7
80const NX_TLS13_RECV_HS_VERDICT_N: i64 = 8

functions

82func nx_tls13_recv_hs_verdict_is_valid(v: i64) -> i64
called by 1: main
95func _map_dwv_verdict(v: i64) -> i64
103func nx_tls13_client_session_recv_hs(
264func main() -> i64