code wiki / (root) / nx_rsa4096_mod_exp.nx

nx_rsa4096_mod_exp.nx

buildroot/runtime/nx_rsa4096_mod_exp.nx

2076 B70 linesdepth 5pulls 5 transitivereach 536 importersview sourcekind tooltopic rsa4096
docsdependenciesstructsconstsfunctions

about

nx_rsa4096_mod_exp.nx -- RSA mod-exp s^e mod n for 4096-bit modulus. Mirrors nx_rsa2048_mod_exp scaled to u4096. For RSA-PKCS#1 v1.5 signature verification, the public exponent e is small (commonly 65537 = 2^16 + 1). Square-and-multiply MSB-first over bits of e. API: rsa4096_mod_exp(out, s, e: i64, n) -- out = s^e mod n Caller responsibilities: - s < n (range-checked here; returns nonzero verdict if s >= n) - n is 4096-bit with top bit set - e fits in i64 (true for all Web PKI: e is either 3, 17, 65537) license_tier: INDEPENDENT_REDERIVE genealogy_id: international-research-sources/ietf/rfc_8017 lineage_id: nishi_rsa4096_mod_exp_q1

dependencies 4 imports · 6 importers

nx_syscalls.nx nx_u4096.nx nx_u4096_mul.nx nx_rsa4096_mod.nx nx_rsa4096_mod_exp.nx nx_rsa4096_mod_test.nx nx_rsa4096_mont_gate.nx nx_rsa_pkcs1_v1_5_k.nx nx_rsa_pkcs1_v1_5_sha256_4096.nx nx_rsa_pkcs1_v1_5_sha384.nx nx_rsa_pkcs1_v1_5_sha512.nx

imports: nx_syscalls.nxnx_u4096.nxnx_u4096_mul.nxnx_rsa4096_mod.nx

imported by: nx_rsa4096_mod_test.nxnx_rsa4096_mont_gate.nxnx_rsa_pkcs1_v1_5_k.nxnx_rsa_pkcs1_v1_5_sha256_4096.nxnx_rsa_pkcs1_v1_5_sha384.nxnx_rsa_pkcs1_v1_5_sha512.nx

structs

none

consts

24const NX_RSA4096_MOD_EXP_OK: i64 = 1
25const NX_RSA4096_MOD_EXP_S_OUT_OF_RANGE: i64 = 2

functions

28func rsa4096_highbit_i64(e: i64) -> i64
called by 1: rsa4096_mod_exp
39func rsa4096_mod_exp(out: *i64, s: *i64, e: i64, n: *i64) -> i64
68func main() -> i64