code wiki / (root) / nx_tls13_transcript.nx

nx_tls13_transcript.nx

buildroot/runtime/nx_tls13_transcript.nx

9880 B218 linesdepth 5pulls 6 transitivereach 593 importersview sourcekind librarytopic tls13
docsdependenciesstructsconstsfunctions

about

nx_tls13_transcript.nx -- TLS 1.3 transcript hash (RFC 8446 §4.4.1). Phase 0b §E of the Nishi TLS 1.3 stack per docs/NISHI_TLS13_GAP_AUDIT.md. Running SHA-256 over the concatenation of every handshake message in send/receive order, with the HelloRetryRequest synthetic-message replacement special case. Every Derive-Secret call in the schedule and the Finished MAC's HMAC(transcript_hash) all read from this state. The HRR rule: When the server responds to ClientHello with HelloRetryRequest, the value of ClientHello1 in the transcript is REPLACED with a special synthetic handshake message of type message_hash(254) containing Hash(ClientHello1). Every subsequent Derive-Secret computation sees this replaced prefix, not the original CH1. This exists so that the handshake transcript stays ~constant-size on resumption regardless of how large the original ClientHello was (the original CH1 might carry an arbitrarily large pre_shared_key extension). What it does today: - init / update / snapshot (non-destructive get) - HRR replace via synthetic-message-hash construction - sealed verdict + validity gate What it doesn't do yet: - SHA-384 variant (queued; composes against nx_sha512 / nx_sha384 if/when that's wired) - Multi-buffer message append (caller can call update() multiple times instead; covered by streaming SHA-256 already) KAT verified: - empty transcript -> SHA-256("") = e3b0c4...b855 - 3-message concatenation matches sha256_digest of the same bytes - snapshot non-destructive (subsequent update changes hash) - HRR replace produces transcript whose hash equals SHA-256(synthetic_message_hash_record) Composes with:

dependencies 3 imports · 43 importers

nx_syscalls.nx nx_sha256.nx nx_sha512.nx nx_tls13_transcript.nx nx_edge_serve_static_test.nx nx_https_get_happy_test.nx nx_https_loopback_test.nx nx_mtls_loopback_probe.nx nx_tls13_client.nx nx_tls13_client_session.nx nx_tls13_client_session_derive_app nx_tls13_client_session_emit_finis nx_tls13_client_session_recv_sh.nx nx_tls13_client_test.nx

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

imports: nx_syscalls.nxnx_sha256.nxnx_sha512.nx

imported by: nx_edge_serve_static_test.nxnx_https_get_happy_test.nxnx_https_loopback_test.nxnx_mtls_loopback_probe.nxnx_tls13_client.nxnx_tls13_client_session.nxnx_tls13_client_session_derive_app.nxnx_tls13_client_session_emit_finished.nxnx_tls13_client_session_recv_sh.nxnx_tls13_client_test.nxnx_tls13_full_tcp_test.nxnx_tls13_handshake_io.nxnx_tls13_handshake_tcp_test.nxnx_tls13_loopback_test.nxnx_tls13_mtls_finished.nxnx_tls13_mtls_loopback_test.nxnx_tls13_mtls_recv_cert.nxnx_tls13_p256_loopback_test.nxnx_tls13_server.nxnx_tls13_server_full_handshake_test.nxnx_tls13_server_recv_client_cert.nxnx_tls13_server_recv_client_cv.nxnx_tls13_server_session.nxnx_tls13_server_session_app_data_test.nxnx_tls13_server_session_derive_hs.nxnx_tls13_server_session_derive_traffic.nxnx_tls13_server_session_emit_certificate.nxnx_tls13_server_session_emit_certreq.nxnx_tls13_server_session_emit_cv.nxnx_tls13_server_session_emit_ee.nxnx_tls13_server_session_emit_ee_alpn.nxnx_tls13_server_session_emit_hrr.nxnx_tls13_server_session_emit_sf.nxnx_tls13_server_session_emit_sh.nxnx_tls13_server_session_recv_cf.nxnx_tls13_server_session_recv_cf_test.nxnx_tls13_server_session_recv_ch.nxnx_tls13_server_session_run.nxnx_tls13_server_session_run_h2.nxnx_tls13_server_session_run_mtls.nxnx_tls13_transcript384_gate.nxnx_tls13_transcript_snapkat_test.nxnx_tls13_transcript_test.nx

structs

none

consts

62const NX_TLS13_TRANSCRIPT_CTX_BYTES: i64 = 256
63const NX_TLS13_HASH_LEN_SHA256: i64 = 32
66const NX_TLS13_HS_TYPE_MESSAGE_HASH: i64 = 254
69const NX_TLS13_TX_VERDICT_OK: i64 = 1
70const NX_TLS13_TX_VERDICT_N: i64 = 2

functions

75func nx_tls13_transcript_new() -> *u8
97func nx_tls13_transcript_update(state: *u8, msg: *u8, msg_len: i64) -> i64
135func nx_tls13_transcript_snapshot384(state: *u8, out_48: *u8) -> i64
148func nx_tls13_transcript_snapshot(state: *u8, out_32: *u8) -> i64
185func nx_tls13_transcript_replace_with_hrr(state: *u8) -> i64
214func nx_tls13_tx_verdict_is_valid(v: i64) -> i64
called by 1: main