mirror of
https://github.com/ipxe/ipxe
synced 2026-06-29 00:07:28 +03:00
[crypto] Remove elliptic curve abstraction for X25519
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>
This commit is contained in:
@@ -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 ),
|
||||
};
|
||||
|
||||
|
||||
@@ -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
|
||||
*
|
||||
|
||||
@@ -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 */
|
||||
|
||||
Reference in New Issue
Block a user