[crypto] Expose the base point as an explicit elliptic curve property

Add the generator base point as an explicit property of an elliptic
curve, and remove the ability to pass a NULL to elliptic_multiply() to
imply the use of the generator base point.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
This commit is contained in:
Michael Brown
2025-12-05 13:00:12 +00:00
parent 88c3e68dfb
commit e50e30a7f8
6 changed files with 11 additions and 14 deletions
+2 -5
View File
@@ -822,7 +822,7 @@ int x25519_key ( const struct x25519_value *base,
/**
* Multiply scalar by curve point
*
* @v base Base point (or NULL to use generator)
* @v base Base point
* @v scalar Scalar multiple
* @v result Result point to fill in
* @ret rc Return status code
@@ -830,10 +830,6 @@ int x25519_key ( const struct x25519_value *base,
static int x25519_curve_multiply ( const void *base, const void *scalar,
void *result ) {
/* Use base point if applicable */
if ( ! base )
base = &x25519_generator;
return x25519_key ( base, scalar, result );
}
@@ -842,5 +838,6 @@ struct elliptic_curve x25519_curve = {
.name = "x25519",
.pointsize = sizeof ( struct x25519_value ),
.keysize = sizeof ( struct x25519_value ),
.base = x25519_generator.raw,
.multiply = x25519_curve_multiply,
};