code wiki / (root) / nx_tls13_client_dispatch_with_validation.nx

nx_tls13_client_dispatch_with_validation.nx

buildroot/runtime/nx_tls13_client_dispatch_with_validation.nx

5002 B124 linesdepth 16pulls 84 transitivereach 499 importersview sourcekind tooltopic tls13
docsdependenciesstructsconstsfunctions

about

nx_tls13_client_dispatch_with_validation.nx -- TLS 1.3 client dispatcher variant that enforces cert chain validation against a TrustStore at the WAIT_CERT state. Phase 0b §L sub-4 of the TLS client arc. Wraps the existing tls13_client_dispatch_handshake_message (commit pre-dating this session, with the "accept ANY cert" STUB intentionally documented in its preamble) with the cert-validation BRIDGE shipped this session (nx_tls13_client_validate_certificate, commit c5ddbf81). Wrapper protocol: - For state != WAIT_CERT: delegate unchanged to the underlying dispatcher (transcript update + state transition unchanged). - For state == WAIT_CERT: call the bridge FIRST against the Certificate message bytes. If validation fails, return CERT_VERIFY_FAIL (no transcript update, no state advance -- handshake stalls until caller closes the connection). If validation succeeds, delegate to the underlying dispatcher (which advances state to WAIT_CV). Per Cardinal 19 (API contract stability): the existing dispatcher signature is UNCHANGED. Callers without a TrustStore (e.g. the loopback test that uses a self-signed throwaway) keep working in the legacy "accept any" mode. The real Web PKI client uses this variant. Per Cardinal 12 (defensive at boundaries): cert validation happens BEFORE the underlying dispatcher's transcript update, so a rejected cert doesn't poison the transcript hash. Public API: tls13_client_dispatch_with_validation( state, msg, msg_len, server_hs_traffic_secret, transcript_state, out_new_state, val_ctx: *TlsValidationContext ) -> verdict nx_tls13_dwv_verdict_is_valid(v) -> 0|1

dependencies 3 imports · 2 importers

nx_syscalls.nx nx_tls13_client.nx nx_tls13_client_validate_certifica nx_tls13_client_dispatch_with_ nx_tls13_client_dispatch_with_vali nx_tls13_client_session_recv_hs.nx

imports: nx_syscalls.nxnx_tls13_client.nxnx_tls13_client_validate_certificate.nx

imported by: nx_tls13_client_dispatch_with_validation_test.nxnx_tls13_client_session_recv_hs.nx

structs

none

consts

64const NX_TLS13_DWV_OK: i64 = 1
65const NX_TLS13_DWV_BAD_MSG_TYPE: i64 = 2
66const NX_TLS13_DWV_BAD_FORMAT: i64 = 3
67const NX_TLS13_DWV_SF_BAD_MAC: i64 = 4
68const NX_TLS13_DWV_BAD_STATE: i64 = 5
69const NX_TLS13_DWV_CERT_VERIFY_FAIL: i64 = 6
70const NX_TLS13_DWV_VERDICT_N: i64 = 7

functions

72func nx_tls13_dwv_verdict_is_valid(v: i64) -> i64
called by 1: main
81func _map_dispatcher_verdict(v: i64) -> i64
92func tls13_client_dispatch_with_validation(
122func main() -> i64