nx_p384_field_inv.nx
buildroot/runtime/nx_p384_field_inv.nx
about
nx_p384_field_inv.nx -- P-384 modular inverse via Fermat's
little theorem. Mirror of nx_p256_field_inv.nx, adapted to
12-limb / 384-bit width.
a^(p-2) mod p computed left-to-right square-and-multiply over
the 384 bits of (p-2).
Performance note: portable bit-by-bit form (no addition-chain
optimization). ~384 squarings + ~variable mults; each mul
runs the 385-iteration bit-by-bit reduction in
nx_p384_field_mul. Slow but correct. Optimized addition
chain queued.
API:
p384_field_load_p_minus_2(out)
p384_field_inv(out, a) out = a^(-1) mod p (Fermat)
p384_field_bit_at(limbs, bit_pos) -> 0|1
Caveat: p384_field_inv(out, 0) returns 0. 0 has no inverse;
callers MUST guard zero by construction (point ops do).
license_tier: INDEPENDENT_REDERIVE
genealogy_id: international-research-sources/nist/fips_186_5
lineage_id: nishi_p384_field_inv_q10
dependencies 5 imports · 3 importers
imports: nx_syscalls.nxnx_u384.nxnx_p384_field.nxnx_p384_field_mul.nxnx_p384_field_mul_fast.nx
imported by: nx_ecdsa_p384_bisect_test.nxnx_p384_field_inv_test.nxnx_p384_point.nx
structs
| none |
consts
| none |
functions
| 39 | func p384_field_load_p_minus_2(out: *i64) -> i64 called by 1: p384_field_inv |
| 56 | func p384_field_bit_at(limbs: *i64, bit_pos: i64) -> i64 called by 1: p384_field_inv |
| 64 | func p384_field_inv(out: *i64, a: *i64) -> i64 |
| 88 | func main() -> i64 |