code wiki / _hdl_build / nx_audit_log.nx

nx_audit_log.nx

buildroot/runtime/_hdl_build/nx_audit_log.nx

7659 B143 linesdepth 5pulls 5 transitivereach 0 importersview sourcekind tooltopic audit
docsdependenciesstructsconstsfunctions

about

nx_audit_log.nx -- TAMPER-EVIDENT audit log for secret access (a capability real vaults have). Each entry is HASH-CHAINED: line_hash = SHA-256(prev_hash || epoch || op || name || outcome). Any deletion, reordering, or edit of a past entry breaks the chain at that point -- detectable by the verifier without a separate signature. Modes: append <op> <name> <outcome> -- append a chained entry to knowledge/status/secret_audit.log verify -- recompute the whole chain; report the first break (or OK) Uses the team's WORKING SHA-256 (no broken deps). license_tier: ORIGINAL

dependencies 2 imports · 0 importers

nx_syscalls.nx nx_sha256.nx nx_audit_log.nx

imports: nx_syscalls.nxnx_sha256.nx

imported by: nobody (leaf or entry point)

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

main _p sys_write sys_exit sys_mmap al_read sys_openat_rd sys_read sys_close al_last_hash al_payload sys_mmap ↻ sys_now_realtime_sec sys_mmap ↻ sys_clock_gettime_real al_chain sys_mmap ↻ sha256_init sys_mmap ↻ sha256_k sha256_update sha256_compress_ni_blocks blk_set_byte sha256_compress sha256_compress_ni blk_word blk_byte sha256_final blk_set_byte ↻ sha256_compress ↻ al_hex sys_openat_append sys_write ↻ sys_close ↻ _pn sys_mmap ↻ sys_write ↻

structs

none

consts

10const K_MAGIC_1048592: i64 = 1048592
11const K_MAGIC_1048576: i64 = 1048576
12const K_MAGIC_1024: i64 = 1024

functions

13func _p(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 calls 1: sys_write
14func _pn(v: i64) -> i64 { let bb: *u8=sys_mmap(28); var m: i64=v; if m<0{m=0-m;sys_write(1,"-" as *u8,1)}; let t: *u8=sys_mmap(28); var k: i64=0; if m==0{t[0]=48;k=1}; while m>0{t[k]=48+(m%10);m=m/10;k=k+1}; var i: i64=0; while i<k{bb[i]=t[k-1-i];i=i+1}; sys_write(1,bb,k); return 0 }
called by 1: main calls 2: sys_mmapsys_write
15func al_slen(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n }
16func al_hex(dig: *u8, out: *u8) -> i64
called by 1: al_chain
22func al_read(path: *u8, out: *u8, cap: i64, lb: *i64) -> i64
called by 1: main calls 3: sys_openat_rdsys_readsys_close
33func al_chain(prevhex: *u8, payload: *u8, plen: i64, outhex: *u8) -> i64
44func al_payload(buf: *u8, epoch: i64, op: *u8, name: *u8, outcome: *u8) -> i64
called by 1: main calls 1: sys_mmap
60func al_last_hash(buf: *u8, n: i64, outhex: *u8) -> i64
called by 1: main
74func main(argc: i64, argv: *i64) -> i64