[PATCH] crypto: ecc: drop unused curve25519 definitions

Jonas Rebmann jre at pengutronix.de
Mon Sep 22 09:45:08 PDT 2025


Hi,

On 2025-09-22 16:16, Ahmad Fatoum wrote:
> ecc_get_curve25519 is used in the kernel only to support the hisilicon
> hpre driver and can't be used for general purpose like the NIST curves
> defined in ecc_curve_defs.h.
> 
> In barebox, the function is fully unused, so drop it to prevent
> confusion.

Confusing indeed :)

> 
> Reported-by: Jonas Rebmann<jre at pengutronix.de>
> Signed-off-by: Ahmad Fatoum<a.fatoum at pengutronix.de>

Reviewed-by: Jonas Rebmann <jre at pengutronix.de>

Thanks,
Jonas

> ---
>   crypto/ecc.c               |  7 -------
>   crypto/ecc_curve_defs.h    | 18 ------------------
>   include/crypto/ecc_curve.h |  7 -------
>   3 files changed, 32 deletions(-)
> 
> diff --git a/crypto/ecc.c b/crypto/ecc.c
> index b90fe0e74809..c3d71627a64a 100644
> --- a/crypto/ecc.c
> +++ b/crypto/ecc.c
> @@ -38,13 +38,6 @@ typedef struct {
>   	u64 m_high;
>   } uint128_t;
>   
> -/* Returns curv25519 curve param */
> -const struct ecc_curve *ecc_get_curve25519(void)
> -{
> -	return &ecc_25519;
> -}
> -EXPORT_SYMBOL(ecc_get_curve25519);
> -
>   const struct ecc_curve *ecc_get_curve(unsigned int curve_id)
>   {
>   	switch (curve_id) {
> diff --git a/crypto/ecc_curve_defs.h b/crypto/ecc_curve_defs.h
> index 0ecade7d02f5..6867fe50e81b 100644
> --- a/crypto/ecc_curve_defs.h
> +++ b/crypto/ecc_curve_defs.h
> @@ -134,22 +134,4 @@ static struct ecc_curve nist_p521 = {
>   	.b = nist_p521_b
>   };
>   
> -/* curve25519 */
> -static u64 curve25519_g_x[] = { 0x0000000000000009, 0x0000000000000000,
> -				0x0000000000000000, 0x0000000000000000 };
> -static u64 curve25519_p[] = { 0xffffffffffffffed, 0xffffffffffffffff,
> -				0xffffffffffffffff, 0x7fffffffffffffff };
> -static u64 curve25519_a[] = { 0x000000000001DB41, 0x0000000000000000,
> -				0x0000000000000000, 0x0000000000000000 };
> -static const struct ecc_curve ecc_25519 = {
> -	.name = "curve25519",
> -	.nbits = 255,
> -	.g = {
> -		.x = curve25519_g_x,
> -		.ndigits = 4,
> -	},
> -	.p = curve25519_p,
> -	.a = curve25519_a,
> -};
> -
>   #endif
> diff --git a/include/crypto/ecc_curve.h b/include/crypto/ecc_curve.h
> index 7d90c5e82266..4ffb9fd8d228 100644
> --- a/include/crypto/ecc_curve.h
> +++ b/include/crypto/ecc_curve.h
> @@ -52,11 +52,4 @@ struct ecc_curve {
>    */
>   const struct ecc_curve *ecc_get_curve(unsigned int curve_id);
>   
> -/**
> - * ecc_get_curve25519() - get curve25519 curve;
> - *
> - * Returns curve25519
> - */
> -const struct ecc_curve *ecc_get_curve25519(void);
> -
>   #endif
> -- 2.47.3
> 

-- 
Pengutronix e.K.                           | Jonas Rebmann               |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-9    |




More information about the barebox mailing list