code wiki / _hdl_build / nx_pw_rotate_gate.nx
nx_pw_rotate_gate.nx
buildroot/runtime/_hdl_build/nx_pw_rotate_gate.nx
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
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
structs
| none |
consts
| 11 | const AT_FDCWD: i64 = 0 - 100 |
functions
| 12 | func _p(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(1,s,n); return 0 } |
| 13 | func _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 } |
| 14 | func rg_unlink(path: *u8) -> i64 { __syscall(263, AT_FDCWD, path, 0, 0, 0, 0) return 0 } called by 1: main |
| 16 | func rg_read(path: *u8, buf: *u8, cap: i64) -> i64 |
| 30 | func rg_write(path: *u8, buf: *u8, n: i64) -> i64 |
| 37 | func rg_run(path: *u8, a1: *u8, a2: *u8) -> i64 |
| 59 | func rg_eqn(a: *u8, an: i64, b: *u8, bn: i64) -> i64 called by 1: main |
| 66 | func main() -> i64 |