code wiki / (root) / nx_p384_field.nx

nx_p384_field.nx

buildroot/runtime/nx_p384_field.nx

3687 B120 linesdepth 3pulls 3 transitivereach 543 importersview sourcekind tooltopic p384
docsdependenciesstructsconstsfunctions

about

nx_p384_field.nx -- NIST P-384 field arithmetic mod p. p = 2^384 - 2^128 - 2^96 + 2^32 - 1 (FIPS 186-5 D.1.2.4) = 0xffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff Mirrors nx_p256_field.nx structure on the 12-limb u384 layout. Provides add / sub / neg mod p, plus shipped u384 wrappers under the field name. Mul + invert ship separately as nx_p384_field_mul + nx_p384_field_inv (matching the P-256 split). API: p384_field_load_p(out) p384_field_zero/one/copy/eq (wrappers over u384_*) p384_field_add(r, a, b) r = (a + b) mod p p384_field_sub(r, a, b) r = (a - b) mod p p384_field_neg(r, a) r = (-a) mod p license_tier: INDEPENDENT_REDERIVE genealogy_id: international-research-sources/nist/fips_186_5 lineage_id: nishi_p384_field_q10

dependencies 2 imports · 13 importers

nx_syscalls.nx nx_u384.nx nx_p384_field.nx nx_ecdsa_p384_bisect_test.nx nx_p384_ecdh.nx nx_p384_field_inv.nx nx_p384_field_inv_test.nx nx_p384_field_mul.nx nx_p384_field_mul_fast.nx nx_p384_field_mul_fast_gate.nx nx_p384_field_mul_test.nx nx_p384_field_test.nx nx_p384_point.nx

diagram shows first 10 each side; +0 more imports, +3 more importers in the complete lists below.

imports: nx_syscalls.nxnx_u384.nx

imported by: nx_ecdsa_p384_bisect_test.nxnx_p384_ecdh.nxnx_p384_field_inv.nxnx_p384_field_inv_test.nxnx_p384_field_mul.nxnx_p384_field_mul_fast.nxnx_p384_field_mul_fast_gate.nxnx_p384_field_mul_test.nxnx_p384_field_test.nxnx_p384_point.nxnx_p384_point_add.nxnx_p384_point_test.nxnx_p384_scalar_mul.nx

structs

none

consts

32const NX_P384_FIELD_OK: i64 = 1
33const NX_P384_FIELD_BAD: i64 = 2
34const NX_P384_FIELD_VERDICT_N: i64 = 3

functions

36func nx_p384_field_verdict_is_valid(v: i64) -> i64
52func p384_field_load_p(out: *i64) -> i64
69func p384_field_zero(out: *i64) -> i64 { return u384_zero(out) }
70func p384_field_one(out: *i64) -> i64 { return u384_one(out) }
71func p384_field_copy(out: *i64, src: *i64) -> i64 { return u384_copy(out, src) }
calls 1: u384_copy
72func p384_field_eq(a: *i64, b: *i64) -> i64 { return u384_eq(a, b) }
79func p384_field_add(r: *i64, a: *i64, b: *i64) -> i64
96func p384_field_sub(r: *i64, a: *i64, b: *i64) -> i64
107func p384_field_neg(r: *i64, a: *i64) -> i64
118func main() -> i64