code wiki / _hdl_build / nx_vault_shamir_test.nx

nx_vault_shamir_test.nx

buildroot/runtime/_hdl_build/nx_vault_shamir_test.nx

4076 B74 linesdepth 3pulls 3 transitivereach 0 importersview sourcekind gate/prooftopic vault
docsdependenciesstructsconstsfunctions

about

nx_vault_shamir_test.nx -- SHAMIRGATE: proves K-of-N threshold unseal. Split secret into N=5 shares with threshold K=3 (degree-2 poly). GREEN iff: ANY 3 distinct shares reconstruct the EXACT secret; K-1 (2) shares reconstruct a WRONG value (no quorum -> no unseal); a corrupted share yields a WRONG secret (integrity must be checked separately -- Shamir alone doesn't detect it, stated honestly); shares are distinct and nonzero. exit 0 on 7/7.

dependencies 2 imports · 0 importers

nx_vault_shamir.nx nx_syscalls.nx nx_vault_shamir_test.nx

imports: nx_vault_shamir.nxnx_syscalls.nx

imported by: nobody (leaf or entry point)

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

main sg_puts sys_write sys_mmap sh_eval sh_add sh_mod sh_mul sh_mod ↻ sg_recon3 sys_mmap ↻ sh_reconstruct sh_mul ↻ sh_sub sh_mod ↻ sh_inv sh_mod ↻ sh_add ↻ sg_recon2 sys_mmap ↻ sh_reconstruct ↻ sh_add ↻ sg_num sys_mmap ↻ sys_write ↻ sys_exit

structs

none

consts

none

functions

9func sg_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 calls 1: sys_write
10func sg_num(v: i64) -> i64 { let b: *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 {b[i]=t[k-1-i]; i=i+1}; sys_write(1,b,k); return 0 }
called by 1: main calls 2: sys_mmapsys_write
12func sg_recon3(x0: i64, x1: i64, x2: i64, y0: i64, y1: i64, y2: i64) -> i64
called by 1: main calls 2: sys_mmapsh_reconstruct
18func sg_recon2(x0: i64, x1: i64, y0: i64, y1: i64) -> i64
called by 1: main calls 2: sys_mmapsh_reconstruct
25func main() -> i64