code wiki / (root) / nx_p256_field_mul_test.nx

nx_p256_field_mul_test.nx

buildroot/runtime/nx_p256_field_mul_test.nx

6135 B193 linesdepth 5pulls 6 transitivereach 0 importersview sourcekind gate/prooftopic p256
docsdependenciesstructsconstsfunctions

about

nx_p256_field_mul_test.nx -- KAT for P-256 field multiplication. Verifies: - 0 * 0 = 0 - 0 * a = 0 - 1 * a = a (identity) - 2 * 3 = 6 (small) - 2 * (p+1)/2 = 1 (where (p+1)/2 is the modular inverse of 2) - (p-1) * (p-1) = 1 (since -1 * -1 = 1 mod p) - (p-1) * 2 = p-2 (no boundary cross) - 2 * 2^255 = 2^256 = (p + 2^224 - 2^192 - 2^96 + 1) mod p = 2^224 - 2^192 - 2^96 + 1 - associativity spot-check: (a*b)*c == a*(b*c) for 3 values - commutativity: a*b == b*a - distributivity: a*(b+c) == a*b + a*c - sq matches mul-with-self expect_exit: 0 license_tier: ORIGINAL

dependencies 4 imports · 0 importers

nx_syscalls.nx nx_u256.nx nx_p256_field.nx nx_p256_field_mul.nx nx_p256_field_mul_test.nx

imports: nx_syscalls.nxnx_u256.nxnx_p256_field.nxnx_p256_field_mul.nx

imported by: nobody (leaf or entry point)

call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown

main u256_alloc nx_scratch nx_scratch_init sys_mmap nx_scratch_oom sys_write sys_exit sys_mmap ↻ p256_field_load_p p256_field_zero u256_zero p256_field_mul nx_scratch_save nx_scratch_init ↻ u256_wide_alloc nx_scratch ↻ u256_mul_wide _p256_solinas_reduce u256_alloc ↻ p256_field_load_p ↻ nx_scratch ↻ _r_reduce9 _r_cmp8 nx_scratch_restore u256_is_zero u256_zero ↻ p256_field_one u256_one u256_zero ↻ u256_cmp p256_field_eq u256_eq u256_copy p256_field_sub nx_scratch_save ↻ u256_alloc ↻ p256_field_load_p ↻ u256_sub_with_borrow u256_add_with_carry

structs

none

consts

none

functions

26func main() -> i64