code wiki / _hdl_build / nx_audit_log.nx
nx_audit_log.nx
buildroot/runtime/_hdl_build/nx_audit_log.nx
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
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
structs
| none |
consts
| 10 | const K_MAGIC_1048592: i64 = 1048592 |
| 11 | const K_MAGIC_1048576: i64 = 1048576 |
| 12 | const K_MAGIC_1024: i64 = 1024 |
functions
| 13 | func _p(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(1,s,n); return 0 } |
| 14 | func _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 } |
| 15 | func al_slen(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n } |
| 16 | func al_hex(dig: *u8, out: *u8) -> i64 called by 1: al_chain |
| 22 | func al_read(path: *u8, out: *u8, cap: i64, lb: *i64) -> i64 |
| 33 | func al_chain(prevhex: *u8, payload: *u8, plen: i64, outhex: *u8) -> i64 |
| 44 | func al_payload(buf: *u8, epoch: i64, op: *u8, name: *u8, outcome: *u8) -> i64 |
| 60 | func al_last_hash(buf: *u8, n: i64, outhex: *u8) -> i64 called by 1: main |
| 74 | func main(argc: i64, argv: *i64) -> i64 |