code wiki / (root) / nx_tls13_server_session_emit_sf.nx

nx_tls13_server_session_emit_sf.nx

buildroot/runtime/nx_tls13_server_session_emit_sf.nx

5848 B161 linesdepth 11pulls 36 transitivereach 31 importersview sourcekind librarytopic tls13
docsdependenciesstructsconstsfunctions

about

nx_tls13_server_session_emit_sf.nx -- 7th TLS server stone. Emits the server Finished handshake message, AEAD-encrypted as a TLS 1.3 record under server_hs_traffic_key + iv. Per RFC 8446 ยง4.4.4: finished_key = HKDF-Expand-Label(traffic_secret, "finished", "", hash_len) verify_data = HMAC-SHA256(finished_key, transcript_hash) Where transcript_hash is the hash of all handshake messages up to (but not including) this Finished. Inner content (handshake plaintext): HT_FINISHED = 0x14 (1 byte) body_len = 0x000020 (3 bytes, u24 big-endian) verify_data (32 bytes for SHA-256) Total = 36 bytes Record format: same as emit_ee -- header(5) + ct(36+1) + tag(16). Precondition: state == CERT_SENT (set by emit_ee; we're skipping the Certificate + CertificateVerify stones for now -- substrate- honest about a stub server that doesn't authenticate to the client cryptographically yet). Postcondition: state == SF_SENT. SUBSTRATE HONESTY NOTE: a production server MUST emit Certificate + CertificateVerify before Finished, signed with the server's private key. This commit ships Finished EARLY (skipping cert + verify) so the AEAD record + transcript-finished pipeline is exercised end-to-end. A real client would refuse this handshake because the server is anonymous. Stones 6.5 + 7.5 (queued) ship the cert + verify messages. license_tier: ORIGINAL

dependencies 7 imports · 10 importers

nx_syscalls.nx nx_hmac.nx nx_tls13.nx nx_tls13_kdf.nx nx_tls13_record.nx nx_tls13_transcript.nx nx_tls13_server_session.nx nx_tls13_server_session_emit_s nx_edge_daemon.nx nx_edge_serve_static_test.nx nx_pages_https_daemon.nx nx_tls13_server_full_handshake_tes nx_tls13_server_session_app_data_t nx_tls13_server_session_emit_cv_te nx_tls13_server_session_emit_sf_te nx_tls13_server_session_recv_cf_te nx_tls13_server_session_run.nx nx_tls13_server_session_run_h2.nx

imports: nx_syscalls.nxnx_hmac.nxnx_tls13.nxnx_tls13_kdf.nxnx_tls13_record.nxnx_tls13_transcript.nxnx_tls13_server_session.nx

imported by: nx_edge_daemon.nxnx_edge_serve_static_test.nxnx_pages_https_daemon.nxnx_tls13_server_full_handshake_test.nxnx_tls13_server_session_app_data_test.nxnx_tls13_server_session_emit_cv_test.nxnx_tls13_server_session_emit_sf_test.nxnx_tls13_server_session_recv_cf_test.nxnx_tls13_server_session_run.nxnx_tls13_server_session_run_h2.nx

structs

none

consts

45const NX_TLS13_SF_VERIFY_LEN: i64 = 32 // SHA-256 HMAC tag
46const NX_TLS13_SF_INNER_LEN: i64 = 36 // HT + u24 + 32-byte verify_data
47const NX_TLS13_SF_REC_HEADER: i64 = 5
48const NX_TLS13_SF_REC_TAG: i64 = 16

functions

50func nx_tls13_server_session_emit_sf(