code wiki / (root) / nx_tls13_transcript_snapkat_test.nx

nx_tls13_transcript_snapkat_test.nx

buildroot/runtime/nx_tls13_transcript_snapkat_test.nx

3849 B97 linesdepth 6pulls 7 transitivereach 0 importersview sourcekind gate/prooftopic tls13
docsdependenciesstructsconstsfunctions

about

nx_tls13_transcript_snapkat_test.nx -- DURABLE anti-regression KAT for the TLS-FIN root fix (X-B1-FIN-001 / BL-015 / X-TLS-SNAPKAT-001). The bug it locks out: nx_tls13_transcript_snapshot once flat-byte-copied the Sha256 ctx, duplicating bufptr (a POINTER) so the clone SHARED the live transcript's 64-byte partial block. sha256_final(clone) then wrote padding into that shared block -- and in the two-block path (idx > 56) also zeroed bytes [0..55] -- CLOBBERING the live transcript. Every subsequent update() then compressed corrupted bytes and the Finished MAC diverged. It only triggered when a snapshot landed while idx was in the lethal {57..63} range (a function of cumulative handshake byte-count), so loopback + small cert chains passed while big real-server chains failed. The catch (the gate that WOULD have caught it): For each fill-level S in {55, 56, 57, 63} -- straddling the lethal idx>56 boundary -- snapshot the transcript at idx=S, THEN continue the SAME state with >=64 more bytes and finalize. Assert: (1) snapshot(S) == one-shot sha256(first S bytes) (2) continue-then-final == one-shot sha256(full S+extra bytes) Assertion (2) is precisely what the shallow-copy clobber violated: if the snapshot at idx in {57..63} corrupts the live partial block, the continuation hashes garbage and (2) fails (exit 32 / 42). expect_exit: 0 license_tier: ORIGINAL genealogy_id: international-research-sources/ietf/rfc_8446 lineage_id: nishi_tls13_transcript_snapkat_q10

dependencies 3 imports · 0 importers

nx_syscalls.nx nx_sha256.nx nx_tls13_transcript.nx nx_tls13_transcript_snapkat_te

imports: nx_syscalls.nxnx_sha256.nxnx_tls13_transcript.nx

imported by: nobody (leaf or entry point)

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

main snapkat_one sys_mmap snapkat_fill nx_tls13_transcript_new sys_mmap ↻ sha256_init sys_mmap ↻ sha256_k sha384_init nx_tls13_transcript_update sha256_update sha256_compress_ni_blocks blk_set_byte sha256_compress sha256_compress_ni blk_word blk_byte sha512_update sha512_blk_set_byte blk_get_i64 blk_set_i64 sha512_compress sys_mmap ↻ blk_get_i64 ↻ sha512_gamma0 rotr64_v shr64_v sha512_gamma1 rotr64_v ↻ shr64_v ↻ sha512_sigma1 rotr64_v ↻ sha512_ch sha512_k sha512_sigma0 rotr64_v ↻ sha512_maj nx_tls13_transcript_snapsh sys_mmap ↻

structs

none

consts

none

functions

34func snapkat_fill(buf: *u8, n: i64) -> i64
called by 1: snapkat_one
45func snapkat_one(s: i64, extra: i64, base: i64) -> i64
83func main() -> i64
calls 1: snapkat_one