code wiki / _hdl_build / nx_apertus_shard_verify.nx

nx_apertus_shard_verify.nx

buildroot/runtime/_hdl_build/nx_apertus_shard_verify.nx

4515 B68 linesdepth 5pulls 5 transitivereach 0 importersview sourcekind tooltopic apertus
docsdependenciesstructsconstsfunctions

about

nx_apertus_shard_verify.nx -- SOVEREIGN fail-closed verify of the streamed Apertus shards: for each .part file on the NAS, stream-hash it with nx_sha256 (8MB window, no full buffer) and compare to the shard's lfs.oid (from the sovereign enumerate nx_apertus_tree_parse). Match -> rename .part -> final (the shard is now a trusted, byte-exact mirror). Mismatch -> leave .part (REJECTED; a corrupt/truncated stream is NEVER promoted). NO TLS import -> no M32 clash with the fetch/streaming path. license_tier: ORIGINAL expect_exit: 0

dependencies 2 imports · 0 importers

nx_syscalls.nx nx_sha256.nx nx_apertus_shard_verify.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 w sys_write sys_mmap sv_cat sv_hash_file sys_mmap ↻ sha256_init sys_mmap ↻ sha256_k sys_openat_rd sys_read sha256_update sha256_compress_ni_blocks blk_set_byte sha256_compress sha256_compress_ni blk_word blk_byte sys_close sha256_final blk_set_byte ↻ sha256_compress ↻ sv_hexenc wn w ↻ sys_mmap ↻ sys_write ↻ sv_streq sys_renameat sys_exit

structs

none

consts

8const K_MAGIC_8388608: i64 = 8388608
9const K_MAGIC_1024: i64 = 1024

functions

11func w(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 2: wnmain calls 1: sys_write
12func wn(v: i64) -> i64 { var m: i64=v; if m<0{w("-" as *u8);m=0-m} let t:*u8=sys_mmap(24); var k:i64=0; if m==0{t[0]=48 as u8;k=1} while m>0{t[k]=(48+(m%10)) as u8;m=m/10;k=k+1} var i:i64=0; let o:*u8=sys_mmap(24); while i<k{o[i]=t[k-1-i];i=i+1} sys_write(1,o,k); return 0 }
called by 1: main calls 3: wsys_mmapsys_write
13func sv_cat(dst: *u8, off: i64, s: *u8) -> i64 { var o: i64=off; var i: i64=0; while s[i]!=(0 as u8){dst[o]=s[i];o=o+1;i=i+1} return o }
called by 1: main
14func sv_streq(a: *u8, b: *u8) -> i64 { var i: i64=0; while 1==1 { if a[i]!=b[i] {return 0} if a[i]==(0 as u8) {return 1} i=i+1 } return 1 }
called by 1: main
15func sv_hexenc(inp: *u8, n: i64, out: *u8) -> i64 { let hx: *u8="0123456789abcdef" as *u8; var i: i64=0; while i<n { out[i*2]=hx[((inp[i] as i64)>>4)&15]; out[i*2+1]=hx[(inp[i] as i64)&15]; i=i+1 } out[n*2]=0 as u8; return n*2 }
called by 1: sv_hash_file
18func sv_hash_file(path: *u8, out_hex: *u8) -> i64
35func main() -> i64