code wiki / _hdl_build / nx_x509_verify_rsa_gate.nx

nx_x509_verify_rsa_gate.nx

buildroot/runtime/_hdl_build/nx_x509_verify_rsa_gate.nx

7241 B120 linesdepth 8pulls 15 transitivereach 0 importersview sourcekind gate/prooftopic x509
docsdependenciesstructsconstsfunctions

about

nx_x509_verify_rsa_gate.nx -- DIRECT gate for the x509 RSA-verify family (flagged by the HONESTY SYSTEM 2026-07-16: nx_x509_verify_rsa_pkcs1_sha256 + nx_x509_pubkey_extract_rsa, reach ~479, no DIRECT test edge). A crypto-verify gate CANNOT be fake-greened: it passes only if every DER offset, the issuer-key extraction, and the RSA signature are ALL correct (unlike marker judges). Composition over REAL persistent certs: parse real_leaf.der -> parse the intermediate out of real_fullchain.der -> extract issuer RSA (n,e) -> verify the leaf's TBS signature under the issuer key -> must be OK ; then corrupt one sig byte -> must FAIL. Wrapper-logic tests (verdict validator + sig_len!=256 rejection) hold regardless of the leaf's algorithm. Rich diagnostics: prints parse rc, tbs/sig lens, and the leaf sig-alg OID so a RED is INFORMATIVE, not opaque. license_tier: ORIGINAL expect_exit:0

dependencies 4 imports · 0 importers

nx_syscalls.nx nx_x509.nx nx_x509_pubkey_rsa.nx nx_x509_verify_rsa_pkcs1_sha256.nx nx_x509_verify_rsa_gate.nx

imports: nx_syscalls.nxnx_x509.nxnx_x509_pubkey_rsa.nxnx_x509_verify_rsa_pkcs1_sha256.nx

imported by: nobody (leaf or entry point)

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

main nx_x509_rsa_pkcs1_sha256_v xw sys_write sys_mmap nx_x509_verify_rsa_pkcs1_s rsa_pkcs1_v1_5_sha256_veri u2048_alloc sys_mmap ↻ 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 u2048_copy ↻ sys_mmap ↻

structs

none

consts

none

functions

15func xw(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
16func xn(v: i64) -> i64 { let b:*u8=sys_mmap(24); var m:i64=v; if m<0{sys_write(1,"-" as *u8,1);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 j:i64=0; while j<k{b[j]=t[k-1-j];j=j+1} sys_write(1,b,k); return 0 }
called by 1: main calls 2: sys_mmapsys_write
17func xhex(buf: *u8, off: i64, len: i64) -> i64
called by 1: main calls 2: sys_mmapsys_write
30func rdfile(path: *u8, lenout: *i64) -> *u8
called by 1: main calls 2: sys_mmapsys_read_file
38func main() -> i64