nx_ed25519_arith.nx
buildroot/runtime/nx_ed25519_arith.nx
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
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
| 61 | func ge_p3_identity(out: *GeP3) -> i64 |
| 72 | func ge_p3_negate(out: *GeP3, p: *GeP3) -> i64 |
| 95 | func ge_p3_double(out: *GeP3, p: *GeP3) -> i64 |
| 139 | func ge_p3_add(out: *GeP3, p1: *GeP3, p2: *GeP3) -> i64 called by 5: mainge_scalar_mulmainmained25519_verify_full calls 5: fe_allocfe_subfe_mulfe_added25519_d_fe |
| 191 | func ge_p3_cmov(dst: *GeP3, src: *GeP3, flag: i64) -> i64 |
| 204 | func ge_p3_compress(out_32: *u8, p: *GeP3) -> i64 |
| 224 | func ge_p3_equal(p1: *GeP3, p2: *GeP3) -> i64 |