]> git.ipfire.org Git - thirdparty/ipxe.git/commitdiff
[crypto] Remove elliptic curve abstraction for X25519
authorMichael Brown <mcb30@ipxe.org>
Sat, 6 Jun 2026 15:43:09 +0000 (16:43 +0100)
committerMichael Brown <mcb30@ipxe.org>
Sat, 6 Jun 2026 15:53:04 +0000 (16:53 +0100)
X25519 is defined as a key exchange algorithm, not as a generic
elliptic curve.  We have never supported arbitrary point addition on
the underlying curve, and we have never supported pure multiplication
(without the clamping defined in RFC7748, which modifies the scalar
multiple).

Now that we have an abstraction for key exchange that exists
independently of the elliptic curve abstraction, there are no further
consumers of the elliptic curve abstraction for X25519.  Remove this
redundant abstraction to simplify the codebase.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
src/crypto/mishmash/oid_x25519.c
src/crypto/x25519.c
src/include/ipxe/x25519.h

index da05efb1f7c56443ab0f1c59dc32001b9f8266af..6da8f3559a47c7c89c1aa1259609b7436a9e4341 100644 (file)
@@ -35,7 +35,6 @@ static uint8_t oid_x25519[] = { ASN1_OID_X25519 };
 /** "x25519" OID-identified algorithm */
 struct asn1_algorithm oid_x25519_algorithm __asn1_algorithm = {
        .name = "x25519",
-       .curve = &x25519_curve,
        .oid = ASN1_CURSOR ( oid_x25519 ),
 };
 
index 2a174a5012c8887f3af3d6abeb95a49868ff5325..58382bc8914745ab055c642f2812d189b68a1df1 100644 (file)
@@ -830,59 +830,6 @@ void x25519_key ( const struct x25519_value *base,
        x25519_reverse ( result );
 }
 
-/**
- * Check if this is the point at infinity
- *
- * @v point            Curve point
- * @ret is_infinity    This is the point at infinity
- */
-static int x25519_curve_is_infinity ( const void *point ) {
-
-       /* We use all zeroes for the point at infinity (as per RFC8422) */
-       return x25519_is_zero ( point );
-}
-
-/**
- * Multiply scalar by curve point
- *
- * @v base             Base point
- * @v scalar           Scalar multiple
- * @v result           Result point to fill in
- * @ret rc             Return status code
- */
-static int x25519_curve_multiply ( const void *base, const void *scalar,
-                                  void *result ) {
-
-       x25519_key ( base, scalar, result );
-       return 0;
-}
-
-/**
- * Add curve points (as a one-off operation)
- *
- * @v addend           Curve point to add
- * @v augend           Curve point to add
- * @v result           Curve point to hold result
- * @ret rc             Return status code
- */
-static int x25519_curve_add ( const void *addend __unused,
-                             const void *augend __unused,
-                             void *result __unused ) {
-
-       return -ENOTTY;
-}
-
-/** X25519 elliptic curve */
-struct elliptic_curve x25519_curve = {
-       .name = "x25519",
-       .pointsize = sizeof ( struct x25519_value ),
-       .keysize = sizeof ( struct x25519_value ),
-       .base = x25519_generator.raw,
-       .is_infinity = x25519_curve_is_infinity,
-       .multiply = x25519_curve_multiply,
-       .add = x25519_curve_add,
-};
-
 /**
  * Calculate public key
  *
index 358746366d3eda614dc54a7619dc639d6f87675c..88f3d66c1292c826194c331ecef8d8f1c853b4e2 100644 (file)
@@ -91,7 +91,6 @@ extern void x25519_key ( const struct x25519_value *base,
                         struct x25519_value *result );
 extern int x25519_is_zero ( const struct x25519_value *value );
 
-extern struct elliptic_curve x25519_curve;
 extern struct exchange_algorithm x25519_algorithm;
 
 #endif /* _IPXE_X25519_H */