code wiki / _hdl_build / nx_tls12_frag_read_gate.nx

nx_tls12_frag_read_gate.nx

buildroot/runtime/_hdl_build/nx_tls12_frag_read_gate.nx

7911 B167 linesdepth 8pulls 16 transitivereach 0 importersview sourcekind gate/prooftopic tls12
docsdependenciesstructsconstsfunctions

about

nx_tls12_frag_read_gate.nx -- DETERMINISTIC partial-read proof for the TLS 1.2 record reader + ServerHello parser. The intermittent "cipher reads 0xC02B instead of 0xC02F" garble was hypothesised to be an INCOMPLETE record read: the 5-byte header says length N but fewer bytes have arrived, so tls12_parse_server_hello runs on a short/shifted buffer. A live host (WSL2/CDN) often delivers the whole flight in one big segment, so the partial-read code path is never exercised live. This gate forces MAXIMAL fragmentation deterministically: a forked child writes a known-good ServerHello record ONE BYTE AT A TIME down a pipe; the parent reads it back through nx_tls13_read_record_from_fd (the exact framer the 1.2 session uses) and parses the cipher. If the record reader truly loops to completion, the reassembled cipher MUST be 0xC02F under any fragmentation. A short-buffer parse would yield a garbled value -> RED. This proves (or refutes) the read mechanism. expect_exit: 0 license_tier: ORIGINAL

dependencies 3 imports · 0 importers

nx_syscalls.nx nx_tls12_parse.nx nx_tls13_read_record_from_fd.nx nx_tls12_frag_read_gate.nx

imports: nx_syscalls.nxnx_tls12_parse.nxnx_tls13_read_record_from_fd.nx

imported by: nobody (leaf or entry point)

call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown

main sys_mmap fg_w sys_write fg_build_sh fg_n fg_w ↻ sys_mmap ↻ sys_write ↻ fg_scenario sys_mmap ↻ sys_pipe2 sys_fork sys_close sys_write ↻ sys_sleep_ms sys_mmap ↻ sys_munmap sys_exit fg_read_and_parse sys_mmap ↻ nx_tls13_read_record_from_ _read_n sys_read tls12_parse_server_hello _t12_u16 sys_wait4 fg_row fg_w ↻ sys_exit ↻

structs

none

consts

none

functions

25func fg_w(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(1,s,n); return 0 }
called by 3: fg_nfg_rowmain calls 1: sys_write
26func fg_n(v: i64) -> i64
called by 1: main calls 3: fg_wsys_mmapsys_write
36func fg_row(id: *u8, ok: i64, pass: *i64, total: *i64) -> i64
called by 1: main calls 1: fg_w
48func fg_build_sh(out: *u8, chi: i64, clo: i64) -> i64
called by 1: main
66func fg_read_and_parse(rfd: i64) -> i64
83func fg_scenario(rec: *u8, n: i64, chunk: i64, ms: i64) -> i64
117func main() -> i64