code wiki / _hdl_build / nx_doc_crypto_gate.nx

nx_doc_crypto_gate.nx

buildroot/runtime/_hdl_build/nx_doc_crypto_gate.nx

6816 B107 linesdepth 7pulls 11 transitivereach 0 importersview sourcekind gate/prooftopic doc
docsdependenciesstructsconstsfunctions

about

nx_doc_crypto_gate.nx -- MEASURED hermetic gate for encryption-at-rest (nx_doc_crypto). Fresh nonce domain per run (sys_now_realtime_sec) so it never depends on prior state. Proves the AEAD envelope + crypto-shred: T1 round-trip : doc_encrypt -> doc_decrypt returns the plaintext BYTE-IDENTICAL T2 tamper : a flipped ciphertext byte -> doc_decrypt FAILS (Poly1305 tag reject) T3 wrong tenant : a different domain's DEK -> doc_decrypt FAILS (per-tenant isolation) T4 crypto-shred : after crypto_shred, doc_decrypt FAILS (DEK destroyed) while the ciphertext bytes survive Print pass=N/4 + GREEN/RED, append knowledge/status/dp_crypto_gate.log. STANDALONE -- no daemon touched. (Diagnostic note: nx_chacha20_poly1305_decrypt writes a single 'A' to STDERR on its first call -- scratch-alloc marker in the shipped AEAD; it does not affect stdout or the verdict.) license_tier: ORIGINAL

dependencies 1 imports · 0 importers

nx_doc_crypto.nx nx_doc_crypto_gate.nx

imports: nx_doc_crypto.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 dek_gen sys_mmap ↻ 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 nx_csprng_fill ↻ nx_chacha20_poly1305_encry sys_mmap ↻ aead_derive_otk sys_mmap ↻ chacha20_block sys_mmap ↻ _chacha20_set_consts_key load_u32_le load_u32_le ↻ chacha20_perm sys_mmap ↻ chacha20_perm_core chacha20_encrypt sys_mmap ↻

structs

none

consts

none

functions

12func 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
13func g_num(v: i64) -> i64
called by 1: main
19func 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
20func g_wn(fd: i64, v: i64) -> i64
called by 1: main
26func g_slen(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n }
called by 1: main
27func 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
28func g_catnum(out: *u8, o: i64, v: i64) -> i64
called by 1: main
34func 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
36func main() -> i64