code wiki / _hdl_build / nx_doc_at_rest_gate.nx

nx_doc_at_rest_gate.nx

buildroot/runtime/_hdl_build/nx_doc_at_rest_gate.nx

8264 B139 linesdepth 8pulls 15 transitivereach 0 importersview sourcekind gate/prooftopic doc
docsdependenciesstructsconstsfunctions

about

nx_doc_at_rest_gate.nx -- MEASURED hermetic gate for the at-rest wiring (nx_doc_at_rest). Fresh nonce domain per run (sys_now_realtime_sec). Proves encrypt-on-write + transparent read + legacy coexistence + crypto-shred: T1 doc_put a confidential doc -> the STORED bytes start with the NXENC1 magic (encrypted, NOT plaintext) and doc_get round-trips BYTE-IDENTICAL. T2 a LEGACY plaintext value (raw ss_add, no magic, in the confidential shard) -> doc_get passes it through unchanged (existing pre-encryption docs still readable). T3 the raw STORED encrypted bytes DO NOT contain the doc's distinctive plaintext canary (at-rest protection). T4 crypto_shred(domain) -> doc_get of the encrypted doc FAILS (erased) while the legacy-plaintext doc reads. Print pass=4 + GREEN/RED, append knowledge/status/dp_at_rest_gate.log. STANDALONE -- no daemon, no deploy. (nx_chacha20_poly1305_decrypt prints one 'A' to STDERR on first call -- shipped-AEAD scratch marker; harmless.) license_tier: ORIGINAL

dependencies 2 imports · 0 importers

nx_doc_at_rest.nx nx_docportal_lib.nx nx_doc_at_rest_gate.nx

imports: nx_doc_at_rest.nxnx_docportal_lib.nx

imported by: nobody (leaf or entry point)

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

main g_puts sys_now_realtime_sec sys_mmap sys_clock_gettime_real g_cat g_catnum g_slen doc_put dp_prefix dp_cat dp_key dp_cat ↻ dp_catn sys_mmap ↻ at_rest_confidential dek_ensure dek_load sys_mmap ↻ dc_dek_path dc_cat dc_readfile sys_openat_rd sys_read sys_close kek_ensure sys_openat_rd ↻ sys_read ↻ sys_close ↻ nx_csprng_fill sys_mmap ↻ nx_csprng_urandom_path sys_openat_rd ↻ sys_read ↻ sys_close ↻ dc_writefile sys_openat_wr sys_write sys_close ↻ sys_fsync

structs

none

consts

none

functions

15func g_puts(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 1: main
16func g_num(v: i64) -> i64
called by 1: main
22func g_w(fd: i64, s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } sys_write(fd, s, n); return 0 }
called by 1: main
23func g_wn(fd: i64, v: i64) -> i64
called by 1: main
29func g_slen(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n }
called by 2: g_containsmain
30func g_cat(out: *u8, o: i64, s: *u8) -> i64 { var i: i64 = 0; while s[i] != (0 as u8) { out[o] = s[i]; o = o + 1; i = i + 1 } return o }
called by 1: main
31func g_catnum(out: *u8, o: i64, v: i64) -> i64
called by 1: main
37func g_eqbytes(a: *u8, b: *u8, n: i64) -> i64 { var i: i64 = 0; while i < n { if a[i] != b[i] { return 0 } i = i + 1 } return 1 }
called by 1: main
38func g_contains(hay: *u8, hn: i64, ndl: *u8) -> i64
called by 1: main calls 1: g_slen
51func main() -> i64