code wiki / _hdl_build / nx_torrent_authn_gate.nx

nx_torrent_authn_gate.nx

buildroot/runtime/_hdl_build/nx_torrent_authn_gate.nx

7851 B99 linesdepth 17pulls 47 transitivereach 0 importersview sourcekind gate/prooftopic torrent
docsdependenciesstructsconstsfunctions

about

nx_torrent_authn_gate.nx -- referee for the R3 session->level resolver (real OPAQUE, synthetic realm). Stands up a LIGHT-argon test realm; registers operator/family/stranger. PROVISIONS the roles registry BY HANDLE via tau_cred_id (operator=3, family=1; stranger ABSENT) -- the derive-from-handle path. Then logs each in to mint REAL Ed25519 tokens and drives tau_level. The crucial property: the id derived from a HANDLE (provisioning) equals the id a LOGIN TOKEN resolves to (runtime) -- so a by-handle-provisioned row actually grants the level at runtime. PROVES deny-by-default end to end: operator token -> 3 family token -> 1 no token -> 0 garbage -> 0 VALID token w/ NO provisioned role (stranger) -> 0 (leak-check) operator via ngs COOKIE -> 3 GREEN iff every row matches. Prints verdict=GREEN to STDOUT *and* returns the exit code. Durable -> knowledge/status/torrent_authn_gate.log. license_tier: ORIGINAL

dependencies 3 imports · 0 importers

nx_torrent_authn.nx nx_opaque_login.nx nx_syscalls.nx nx_torrent_authn_gate.nx

imports: nx_torrent_authn.nxnx_opaque_login.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_puts sys_write gwrite sys_openat_wr sys_write ↻ sys_close sys_mmap chk g_puts ↻ g_num sys_mmap ↻ sys_write ↻ olg_ctx_setup olg_ctx_setup_ttl nx_uas_server_keys_load_or sys_mmap ↻ sys_read_file sys_openat_rd sys_lseek sys_mmap ↻ sys_read sys_close ↻ _uas_hex_dec _uas_nib nx_csprng_fill sys_mmap ↻ nx_csprng_urandom_path sys_openat_rd ↻ sys_read ↻ sys_close ↻ nx_opq_derive_keypair sys_mmap ↻ _voprf_load_context_string u256_alloc nx_scratch nx_opq_hash_to_scalar sys_mmap ↻ nx_h2c_expand_message_xmd_ u256_alloc ↻

structs

none

consts

none

functions

15func g_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 2: chkmain calls 1: sys_write
16func g_num(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 as u8);k=1}; while m>0{t[k]=((48+(m%10)) as u8);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 }
called by 2: chkmain calls 2: sys_mmapsys_write
17func g_w(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
18func g_wn(fd: i64, v: i64) -> i64 { let bb: *u8=sys_mmap(28); var m: i64=v; if m<0{m=0-m}; let t: *u8=sys_mmap(28); 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; while i<k{bb[i]=t[k-1-i];i=i+1}; sys_write(fd,bb,k); return 0 }
called by 1: main calls 2: sys_mmapsys_write
19func rput(dst: *u8, off: i64, s: *u8) -> i64 { var i: i64=0; while s[i]!=(0 as u8){ dst[off+i]=s[i]; i=i+1 } return off+i }
called by 1: main
20func rlen(s: *u8) -> i64 { var i: i64=0; while s[i]!=(0 as u8){i=i+1} return i }
21func gwrite(path: *u8, s: *u8, n: i64) -> i64 { let fd: i64 = sys_openat_wr(path, 0x1a4); if fd<0 { return 0 } if n>0 { sys_write(fd, s, n) } sys_close(fd); return 0 }
22func chk(got: i64, want: i64, label: *u8) -> i64
called by 1: main calls 2: g_putsg_num
28func mint(ctx: *NxAuthContext, handle: *u8, hn: i64, pw: *u8, pwn: i64, tok: *u8) -> i64
called by 1: main calls 2: sys_mmapolg_login
35func main() -> i64