nx_rsa_pkcs1_v1_5_k.nx
buildroot/runtime/nx_rsa_pkcs1_v1_5_k.nx
about
nx_rsa_pkcs1_v1_5_k.nx -- k-aware RSA-PKCS#1 v1.5 verify for RSA moduli
whose byte-length k is NOT exactly 256 or 512 (e.g. RSA-3072 = 384 bytes,
common on Sectigo/USERTrust intermediates like iana.org's chain).
Mechanism: load the (zero-extended) k-byte signature into a u4096 and
mod-exp under the (zero-extended) modulus. The recovered EM value is
< n < 2^(8k), so its big-endian 512-byte form has the high (512-k) bytes
= 0x00 and the real k-byte PKCS#1 EM (00 01 PS 00 T H) in the LOW k bytes,
i.e. starting at offset zoff = 512-k. We verify the high zero-extension
AND the EM structure at zoff with PS_LEN = k-3-19-hashlen.
For k=512 this reduces to the existing RSA-4096 check (zoff=0); we only
route here for k not in {256,512} so the proven 2048/4096 paths are
untouched. Verdicts reuse the SHA-384 module's enum (same shape).
license_tier: INDEPENDENT_REDERIVE
genealogy_id: international-research-sources/ietf/rfc_8017
lineage_id: nishi_rsa_pkcs1_v1_5_k_q1
dependencies 7 imports · 2 importers
imports: nx_syscalls.nxnx_sha256.nxnx_sha512.nxnx_u4096.nxnx_rsa4096_mod_exp.nxnx_rsa_pkcs1_v1_5_sha256.nxnx_rsa_pkcs1_v1_5_sha384.nx
imported by: nx_rsa_pkcs1_v1_5_k_test.nxnx_x509_verify_under_issuer.nx
structs
| none |
consts
| none |
functions
| 30 | func _rsa_k_recover(sig_bytes: *u8, sig_len: i64, n_4096: *i64, e_i64: i64, em_out: *u8) -> i64 |
| 48 | func _rsa_k_check_prefix(em: *u8, zoff: i64, ps_len: i64) -> i64 |
| 66 | func rsa_pkcs1_v1_5_sha256_k_verify(msg: *u8, msg_len: i64, |
| 95 | func rsa_pkcs1_v1_5_sha384_k_verify(msg: *u8, msg_len: i64, |
| 123 | func main() -> i64 |