code wiki / _hdl_build / nx_pw_rotate_gate.nx

nx_pw_rotate_gate.nx

buildroot/runtime/_hdl_build/nx_pw_rotate_gate.nx

6606 B140 linesdepth 2pulls 2 transitivereach 0 importersview sourcekind gate/proof
docsdependenciesstructsconstsfunctions

about

nx_pw_rotate_gate.nx -- re-runnable GATE for vault secret rotation (Engineer verb: VERIFY). Operates ONLY on a throwaway secret name (rotate_gate_tmp) so nas.nv is NEVER touched. K1 seed: secret_cli put rotate_gate_tmp = a known value -> open returns it K2 rotate: nx_pw_rotate rotate_gate_tmp -> exit 0 + /tmp/nxnewpw exists, 24 chars K3 store changed: secret_cli get rotate_gate_tmp == /tmp/nxnewpw (the NEW value), != seed K4 backup exists and DECODES to the old seed (rollback material is real, not a stub) K5 idempotent re-rotate: a second rotate succeeds + value changes again (no nonce reuse) Cleans up the throwaway secret + backup. Exit 0 only on 5/5. license_tier: ORIGINAL

dependencies 1 imports · 0 importers

nx_syscalls.nx nx_pw_rotate_gate.nx

imports: nx_syscalls.nx

imported by: nobody (leaf or entry point)

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

main _p sys_write rg_unlink rg_write sys_openat_wr sys_write ↻ sys_close rg_run sys_fork sys_openat_wr ↻ sys_dup3 sys_mmap sys_execve sys_exit sys_wait4 sys_mmap ↻ rg_read sys_openat_rd sys_read sys_close ↻ rg_eqn _pn sys_mmap ↻ sys_write ↻ sys_exit ↻

structs

none

consts

11const AT_FDCWD: i64 = 0 - 100

functions

12func _p(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
13func _pn(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;k=1}; while m>0{t[k]=48+(m%10);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 1: main calls 2: sys_mmapsys_write
16func rg_read(path: *u8, buf: *u8, cap: i64) -> i64
called by 1: main calls 3: sys_openat_rdsys_readsys_close
30func rg_write(path: *u8, buf: *u8, n: i64) -> i64
37func rg_run(path: *u8, a1: *u8, a2: *u8) -> i64
59func rg_eqn(a: *u8, an: i64, b: *u8, bn: i64) -> i64
called by 1: main
66func main() -> i64