code wiki / _hdl_build / nx_pub_receipt_keys_gate.nx

nx_pub_receipt_keys_gate.nx

buildroot/runtime/_hdl_build/nx_pub_receipt_keys_gate.nx

5197 B62 linesdepth 10pulls 15 transitivereach 0 importersview sourcekind gate/prooftopic pub
docsdependenciesstructsconstsfunctions

about

nx_pub_receipt_keys_gate.nx -- referee for the publisher's stable receipt-signing identity (nx_pub_receipt_keys). PROVES: generate-once (fresh -> 2; re-init -> 1, SAME priv) ; priv persisted 32 raw bytes, pub published 64 hex ; the published pub round-trips ; CROSS-RUN: a message signed with the priv verifies with the PUBLISHED pub (so a receipt is verifiable by anyone, durably) ; a different key does NOT verify ; the private seed NEVER leaks into the published pubkey file. -> knowledge/status/pub_receipt_keys_gate.log.

dependencies 3 imports · 0 importers

nx_pub_receipt_keys.nx nx_ed25519_signature.nx nx_syscalls.nx nx_pub_receipt_keys_gate.nx

imports: nx_pub_receipt_keys.nxnx_ed25519_signature.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 g_w sys_write gtrunc sys_openat_wr sys_close sys_mmap chk g_w ↻ g_n g_w ↻ sys_mmap ↻ sys_write ↻ prk_load_or_init sys_mmap ↻ sys_read_file sys_openat_rd sys_lseek sys_mmap ↻ sys_read sys_close ↻ nx_csprng_fill sys_mmap ↻ nx_csprng_urandom_path sys_openat_rd ↻ sys_read ↻ sys_close ↻ sys_openat_wr ↻ sys_write ↻ sys_close ↻ ed25519_pub_from_priv sys_mmap ↻ ed25519_sha512 sys_mmap ↻ sha512_init sha512_update sha512_blk_set_byte blk_get_i64 blk_set_i64 sha512_compress

structs

none

consts

none

functions

10func g_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 3: g_nchkmain calls 1: sys_write
11func g_n(v: i64) -> i64 { var m: i64=v; if m<0{g_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 2: chkmain calls 3: g_wsys_mmapsys_write
12func gw(fd: i64, s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(fd,s,n); return 0 }
called by 1: main calls 1: sys_write
13func gtrunc(path: *u8) -> i64 { let fd: i64 = sys_openat_wr(path, 0x1a4); if fd>=0 { sys_close(fd) } return 0 }
called by 1: main calls 2: sys_openat_wrsys_close
14func g_eq32(a: *u8, b: *u8) -> i64 { var i: i64=0; while i<32 { if a[i]!=b[i] {return 0} i=i+1 } return 1 }
called by 1: main
15func g_fsize(path: *u8) -> i64 { let lp: *i64=sys_mmap(8) as *i64; lp[0]=0; let d: *u8=sys_read_file(path,lp); if (d as i64)==0 {return 0} return lp[0] }
called by 1: main calls 2: sys_mmapsys_read_file
16func g_has(buf: *u8, n: i64, needle: *u8, nl: i64) -> i64 { if nl==0{return 1} var i: i64=0; while i+nl<=n { var j: i64=0; var ok: i64=1; while j<nl { if buf[i+j]!=needle[j]{ok=0;j=nl} else {j=j+1} } if ok==1{return 1} i=i+1 } return 0 }
called by 1: main
17func g_hex(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 } return n*2 }
called by 1: main
18func chk(got: i64, want: i64, label: *u8) -> i64 { g_w(" "); g_w(label); g_w(" got="); g_n(got); g_w(" want="); g_n(want); if got==want { g_w(" PASS\n"); return 1 } g_w(" FAIL\n"); return 0 }
called by 1: main calls 2: g_wg_n
20func main() -> i64