code wiki / (root) / nx_u4096_mul.nx

nx_u4096_mul.nx

buildroot/runtime/nx_u4096_mul.nx

4191 B136 linesdepth 3pulls 3 transitivereach 540 importersview sourcekind tooltopic u4096
docsdependenciesstructsconstsfunctions

about

nx_u4096_mul.nx -- 4096x4096 -> 8192-bit schoolbook multiplication + wide-buffer helpers. Mirrors nx_u2048_mul on 256-limb wide buffers. Foundation for nx_rsa4096_mod (which Barrett-reduces against the ISRG Root X1 4096-bit modulus). API: u4096_wide_alloc() -> *i64 256-limb buffer (zeroed) u4096_mul_wide(out_256, a, b) -- out = a * b (no reduction) u4096_wide_shl1(out_256) -- in-place left shift by 1 bit u4096_wide_get_bit(a_256, bit) -- bit 0..8191 u4096_wide_sub_low(out_256, sub_128) -- out[0..128) -= sub u4096_wide_low_cmp(a_256, n_128) -- cmp low 128 limbs u4096_wide_copy_low(out_128, src_256) license_tier: INDEPENDENT_REDERIVE genealogy_id: international-research-sources/ietf/rfc_8017 lineage_id: nishi_u4096_mul_q1

dependencies 2 imports · 4 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_u4096_mul_test.nx

imports: nx_syscalls.nxnx_u4096.nx

imported by: nx_rsa4096_mod.nxnx_rsa4096_mod_exp.nxnx_rsa4096_mod_test.nxnx_u4096_mul_test.nx

structs

none

consts

28const NX_U4096_WIDE_LIMBS: i64 = 256
29const NX_U4096_WIDE_BYTES: i64 = 1024

functions

31func u4096_wide_alloc() -> *i64
called by 3: rsa4096_mul_modmainmain calls 1: sys_mmap
44func u4096_mul_wide(out_256: *i64, a: *i64, b: *i64) -> i64
called by 2: rsa4096_mul_modmain
71func u4096_wide_shl1(out_256: *i64) -> i64
called by 1: main
85func u4096_wide_get_bit(a_256: *i64, bit: i64) -> i64
called by 2: rsa4096_modmain
93func u4096_wide_sub_low(out_256: *i64, sub: *i64) -> i64
called by 1: main
113func u4096_wide_low_cmp(a_256: *i64, n: *i64) -> i64
called by 1: main
125func u4096_wide_copy_low(out_128: *i64, src_256: *i64) -> i64
called by 1: main
134func main() -> i64