code wiki / (root) / nx_ed25519_arith.nx

nx_ed25519_arith.nx

buildroot/runtime/nx_ed25519_arith.nx

7369 B235 linesdepth 6pulls 6 transitivereach 837 importersview sourcekind librarytopic ed25519
docsdependenciesstructsconstsfunctions

about

nx_ed25519_arith.nx -- Edwards-curve point arithmetic (RFC 8032). Phase 0b §I.1.C-1 of the Ed25519 completion arc per docs/NISHI_TLS13_GAP_AUDIT.md. Builds on the field primitives (T7) and point decompression (T8) with the arithmetic that scalar multiplication needs: point doubling, point addition, point negation, identity, and the compressed-form encoder used for equality testing + the public-key wire format. Formulas: Bernstein + Lange "Twisted Edwards Curves Revisited" (Asiacrypt 2008), extended coordinates, a = -1. These are the dbl-2008-hwcd-3 doubling and add-2008-hwcd-3 addition from the Explicit-Formulas Database (EFD), which are the standard reference choices for Ed25519. What it does today: - ge_p3_identity: returns the curve identity (0, 1, 1, 0) - ge_p3_negate: in-place negate (X' = -X, T' = -T) - ge_p3_double: 4M + 4S; consumes only X1, Y1, Z1 (T1 unused) - ge_p3_add: 9M; general extended-coord addition - ge_p3_compress: normalize Z to 1 via fe_invert, encode Y + sign-of-X bit into 32 LE bytes - ge_p3_equal: compare two GeP3 by their compressed encodings What it doesn't do yet: - scalar multiplication (Piece 3b uses double + add to build it) - sc_reduce mod L (Piece 3c; 21-bit limb scalar reduction) - ge_p3_madd (mixed addition with precomputed-form points; a perf optimization, not a correctness requirement) KAT verified: - identity point passes on-curve check - basepoint doubled satisfies the curve equation - basepoint + basepoint == double(basepoint) (verified by compressing both and comparing bytes) - P + (-P) compresses to the identity encoding (32 zero bytes except byte 0 = 0x01; the canonical encoding of y=1, x=0) - encode(decompress(B_compressed)) == B_compressed (round-trip) Composes with:

dependencies 4 imports · 7 importers

nx_syscalls.nx nx_x25519.nx nx_ed25519_field.nx nx_ed25519_point.nx nx_ed25519_arith.nx nx_doc_seal.nx nx_ed25519_arith_test.nx nx_ed25519_scalar.nx nx_ed25519_scalar_test.nx nx_ed25519_signature.nx nx_ed25519_signature_test.nx nx_https_get_happy_test.nx

imports: nx_syscalls.nxnx_x25519.nxnx_ed25519_field.nxnx_ed25519_point.nx

imported by: nx_doc_seal.nxnx_ed25519_arith_test.nxnx_ed25519_scalar.nxnx_ed25519_scalar_test.nxnx_ed25519_signature.nxnx_ed25519_signature_test.nxnx_https_get_happy_test.nx

structs

none

consts

none

functions

61func ge_p3_identity(out: *GeP3) -> i64
called by 3: mainge_scalar_mulmain calls 2: fe_zerofe_one
72func ge_p3_negate(out: *GeP3, p: *GeP3) -> i64
called by 1: main calls 2: fe_negfe_copy
95func ge_p3_double(out: *GeP3, p: *GeP3) -> i64
139func ge_p3_add(out: *GeP3, p1: *GeP3, p2: *GeP3) -> i64
191func ge_p3_cmov(dst: *GeP3, src: *GeP3, flag: i64) -> i64
called by 1: ge_scalar_mul calls 1: fe_cmov
204func ge_p3_compress(out_32: *u8, p: *GeP3) -> i64
224func ge_p3_equal(p1: *GeP3, p2: *GeP3) -> i64