code wiki / _hdl_build / nx_dr_restore_verify.nx
nx_dr_restore_verify.nx
buildroot/runtime/_hdl_build/nx_dr_restore_verify.nx
about
nx_dr_restore_verify.nx -- CAP-DR-RESTORE-VERIFY (sovereign-format): PROVE the archive is restorable + intact by
re-hashing each archived file against the SOVEREIGN receipt (nx_seg_store .docs/.keys -- NOT TSV). Walks the archive
dir (getdents), and for each file looks up its receipted sha256 via ss_get (binary-search .keys), re-hashes the file,
compares. Meta files (receipt.docs/.keys/manifest) are not receipt keys -> skipped. Detects bit-rot / tamper that a
naive copy never would. argv: [1]=archive-dir. GREEN iff every receipted file re-hashes to its recorded digest.
license_tier: ORIGINAL
dependencies 3 imports · 0 importers
imports: nx_syscalls.nxnx_sha256.nxnx_seg_store.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 RV_MAGIC_1536: i64 = 1536 |
| 11 | const RV_MAGIC_131072: i64 = 131072 |
| 13 | const RV_CAP: i64 = 67108864 |
functions
| 15 | func rv_w(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(1,s,n); return 0 } |
| 16 | func rv_wn(v: i64) -> i64 { var t: i64=v; if t<0{sys_write(1,"-" as *u8,1);t=0-t} let tm:*u8=sys_mmap(24); var k:i64=0; if t==0{tm[0]=48 as u8;k=1} while t>0{tm[k]=(48+(t%10)) as u8;t=t/10;k=k+1} let b:*u8=sys_mmap(24); var j:i64=0; while j<k{b[j]=tm[k-1-j];j=j+1} sys_write(1,b,k); return 0 } |
| 17 | func rv_read(path: *u8, out: *u8, cap: i64) -> i64 |
| 23 | func rv_join(out: *u8, dir: *u8, name: *u8) -> i64 { var o: i64=0; var i: i64=0; while dir[i]!=(0 as u8){out[o]=dir[i];o=o+1;i=i+1} out[o]=47 as u8; o=o+1; i=0; while name[i]!=(0 as u8){out[o]=name[i];o=o+1;i=i+1} out[o]=0 as u8; return o } called by 1: main |
| 24 | func rv_isdotdot(nm: *u8) -> i64 { if nm[0]==(46 as u8) { if nm[1]==(0 as u8) { return 1 } if nm[1]==(46 as u8) { if nm[2]==(0 as u8) { return 1 } } } return 0 } called by 1: main |
| 26 | func rv_check(path: *u8, exp: *u8, fbuf: *u8, cap: i64) -> i64 |
| 35 | func main(argc: i64, argv: *i64) -> i64 |