mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH] crypto: ecc: drop unused curve25519 definitions
@ 2025-09-22 14:16 Ahmad Fatoum
  2025-09-22 16:45 ` Jonas Rebmann
  2025-09-23  8:14 ` Sascha Hauer
  0 siblings, 2 replies; 3+ messages in thread
From: Ahmad Fatoum @ 2025-09-22 14:16 UTC (permalink / raw)
  To: barebox; +Cc: Jonas Rebmann, Ahmad Fatoum

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.

Reported-by: Jonas Rebmann <jre@pengutronix.de>
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 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




^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] crypto: ecc: drop unused curve25519 definitions
  2025-09-22 14:16 [PATCH] crypto: ecc: drop unused curve25519 definitions Ahmad Fatoum
@ 2025-09-22 16:45 ` Jonas Rebmann
  2025-09-23  8:14 ` Sascha Hauer
  1 sibling, 0 replies; 3+ messages in thread
From: Jonas Rebmann @ 2025-09-22 16:45 UTC (permalink / raw)
  To: Ahmad Fatoum, barebox

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@pengutronix.de>
> Signed-off-by: Ahmad Fatoum<a.fatoum@pengutronix.de>

Reviewed-by: Jonas Rebmann <jre@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    |




^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] crypto: ecc: drop unused curve25519 definitions
  2025-09-22 14:16 [PATCH] crypto: ecc: drop unused curve25519 definitions Ahmad Fatoum
  2025-09-22 16:45 ` Jonas Rebmann
@ 2025-09-23  8:14 ` Sascha Hauer
  1 sibling, 0 replies; 3+ messages in thread
From: Sascha Hauer @ 2025-09-23  8:14 UTC (permalink / raw)
  To: barebox, Ahmad Fatoum; +Cc: Jonas Rebmann


On Mon, 22 Sep 2025 16:16:11 +0200, 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.
> 
> [...]

Applied, thanks!

[1/1] crypto: ecc: drop unused curve25519 definitions
      https://git.pengutronix.de/cgit/barebox/commit/?id=b6076745cbbf (link may not be stable)

Best regards,
-- 
Sascha Hauer <s.hauer@pengutronix.de>




^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2025-09-23  8:14 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-09-22 14:16 [PATCH] crypto: ecc: drop unused curve25519 definitions Ahmad Fatoum
2025-09-22 16:45 ` Jonas Rebmann
2025-09-23  8:14 ` Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox