code wiki / (root) / nx_rsa_pss_sha256_gate.nx

nx_rsa_pss_sha256_gate.nx

buildroot/runtime/nx_rsa_pss_sha256_gate.nx

4943 B57 linesdepth 7pulls 12 transitivereach 0 importersview sourcekind gate/prooftopic rsa
docsdependenciesstructsconstsfunctions

about

nx_rsa_pss_sha256_gate.nx -- KAT for rsa_pss_sha256_verify vs a REAL OpenSSL-3.2 RSA-PSS/SHA-256/salt32 signature (2048-bit key; "openssl dgst -sha256 -sigopt rsa_padding_mode:pss -sigopt rsa_pss_saltlen:32 -sign"; self-verified "Verified OK"). T1 accept the genuine sig; T2/T3/T4 reject a 1-bit-flipped sig / wrong message / flipped modulus (no false accept -- the possession-proof invariant). GREEN iff 4/4. expect_exit: 0

dependencies 4 imports · 0 importers

nx_syscalls.nx nx_u2048.nx nx_rsa_pss_sha256.nx nx_gate_verdict.nx nx_rsa_pss_sha256_gate.nx

imports: nx_syscalls.nxnx_u2048.nxnx_rsa_pss_sha256.nxnx_gate_verdict.nx

imported by: nobody (leaf or entry point)

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

main gw sys_write sys_mmap h2b hx u2048_alloc sys_mmap ↻ u2048_load_be rsa_pss_sha256_verify u2048_alloc ↻ u2048_load_be ↻ rsa2048_mod_exp_mont u2048_cmp u2048_one u2048_zero rsa2048_mont_n0inv u2048_alloc ↻ rsa2048_mont_r2 u2048_wide_alloc sys_mmap ↻ u2048_alloc ↻ rsa2048_mod u2048_alloc ↻ u2048_zero ↻ u2048_shl1 u2048_wide_get_bit u2048_sub_with_borrow u2048_cmp ↻ u2048_copy rsa2048_mul_mod u2048_wide_alloc ↻ u2048_mul_wide rsa2048_mod ↻ rsa2048_mont_mul sys_mmap ↻ u2048_cmp ↻ u2048_sub_with_borrow ↻ u2048_copy ↻ rsa2048_mont_highbit

structs

none

consts

none

functions

10func gw(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: gngrowmain calls 1: sys_write
11func gn(v: i64) -> i64 { let b: *u8 = sys_mmap(24); var m: i64 = v; if m<0 { gw("-" 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; while i<k {b[i]=t[k-1-i];i=i+1} sys_write(1,b,k); return 0 }
called by 1: main calls 3: sys_mmapgwsys_write
12func grow(name: *u8, ok: i64) -> i64 { if ok==1 { gw(" PASS " as *u8) } else { gw(" FAIL " as *u8) } gw(name); gw("\n" as *u8); return ok }
called by 1: main calls 1: gw
13func hx(c: i64) -> i64 { if c>=48 { if c<=57 { return c-48 } } if c>=97 { if c<=102 { return c-87 } } if c>=65 { if c<=70 { return c-55 } } return 0 }
called by 1: h2b
14func h2b(s: *u8, out: *u8) -> i64 { var i: i64=0; var o: i64=0; while s[i]!=(0 as u8) { if s[i+1]==(0 as u8) { i=i+1 } else { out[o]=((hx(s[i] as i64)<<4)|hx(s[i+1] as i64)) as u8; o=o+1; i=i+2 } } return o }
called by 1: main calls 1: hx
16func main() -> i64