mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH] crypto: ecdsa: remove unused ecdsa public key list
@ 2025-10-14  9:38 Jonas Rebmann
  2025-10-20 11:35 ` Sascha Hauer
  0 siblings, 1 reply; 2+ messages in thread
From: Jonas Rebmann @ 2025-10-14  9:38 UTC (permalink / raw)
  To: Sascha Hauer, BAREBOX; +Cc: Jonas Rebmann

This code is unused in barebox and is misleading as we're using
public_key lists containing keys of all supported types.

Signed-off-by: Jonas Rebmann <jre@pengutronix.de>
---
 crypto/ecdsa.c         | 18 ------------------
 include/crypto/ecdsa.h |  7 -------
 2 files changed, 25 deletions(-)

diff --git a/crypto/ecdsa.c b/crypto/ecdsa.c
index 69c0accc95..6aaeff5c14 100644
--- a/crypto/ecdsa.c
+++ b/crypto/ecdsa.c
@@ -104,15 +104,6 @@ int ecdsa_verify(const struct ecdsa_public_key *key, const uint8_t *sig,
 	return _ecdsa_verify(ctx, (void *)mhash, rh, sh);
 }
 
-static LIST_HEAD(ecdsa_keys);
-
-int ecdsa_key_add(struct ecdsa_public_key *key)
-{
-	list_add_tail(&key->list, &ecdsa_keys);
-
-	return 0;
-}
-
 struct ecdsa_public_key *ecdsa_key_dup(const struct ecdsa_public_key *key)
 {
 	struct ecdsa_public_key *new;
@@ -129,12 +120,3 @@ struct ecdsa_public_key *ecdsa_key_dup(const struct ecdsa_public_key *key)
 
 	return new;
 }
-
-const struct ecdsa_public_key *ecdsa_key_next(const struct ecdsa_public_key *prev)
-{
-	prev = list_prepare_entry(prev, &ecdsa_keys, list);
-	list_for_each_entry_continue(prev, &ecdsa_keys, list)
-		return prev;
-
-	return NULL;
-}
diff --git a/include/crypto/ecdsa.h b/include/crypto/ecdsa.h
index 2e2b359d96..1bad70b9d2 100644
--- a/include/crypto/ecdsa.h
+++ b/include/crypto/ecdsa.h
@@ -4,21 +4,14 @@
 
 #include <linux/types.h>
 #include <linux/list.h>
-#include <errno.h>
 
 struct ecdsa_public_key {
 	const char *curve_name;	/* Name of curve, e.g. "prime256v1" */
 	const uint64_t *x;	/* x coordinate of public key */
 	const uint64_t *y;	/* y coordinate of public key */
 	unsigned int size_bits;	/* key size in bits, derived from curve name */
-	struct list_head list;
 };
 
-const struct ecdsa_public_key *ecdsa_key_next(const struct ecdsa_public_key *prev);
-
-#define for_each_ecdsa_key(key) \
-	for (key = ecdsa_key_next(NULL); key; key = ecdsa_key_next(key))
-
 #ifdef CONFIG_CRYPTO_ECDSA
 int ecdsa_verify(const struct ecdsa_public_key *key, const uint8_t *sig,
 		 const uint32_t sig_len, const uint8_t *hash);

---
base-commit: 8785a6ad7467b6f1f70b6e12aa2ceb2fdd5d8546
change-id: 20251014-ecdsa_keys-fd8125a83e38

Best regards,
--  
Jonas Rebmann <jre@pengutronix.de>




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

* Re: [PATCH] crypto: ecdsa: remove unused ecdsa public key list
  2025-10-14  9:38 [PATCH] crypto: ecdsa: remove unused ecdsa public key list Jonas Rebmann
@ 2025-10-20 11:35 ` Sascha Hauer
  0 siblings, 0 replies; 2+ messages in thread
From: Sascha Hauer @ 2025-10-20 11:35 UTC (permalink / raw)
  To: Jonas Rebmann; +Cc: BAREBOX

On Tue, Oct 14, 2025 at 11:38:36AM +0200, Jonas Rebmann wrote:
> This code is unused in barebox and is misleading as we're using
> public_key lists containing keys of all supported types.
> 
> Signed-off-by: Jonas Rebmann <jre@pengutronix.de>
> ---
>  crypto/ecdsa.c         | 18 ------------------
>  include/crypto/ecdsa.h |  7 -------
>  2 files changed, 25 deletions(-)

This is fine. I came up with the same patch, please see my more complete
series I created before my holidays but haven't sent yet. I hope this
doesn't conflict with your TLV signature series.

Sascha

> 
> diff --git a/crypto/ecdsa.c b/crypto/ecdsa.c
> index 69c0accc95..6aaeff5c14 100644
> --- a/crypto/ecdsa.c
> +++ b/crypto/ecdsa.c
> @@ -104,15 +104,6 @@ int ecdsa_verify(const struct ecdsa_public_key *key, const uint8_t *sig,
>  	return _ecdsa_verify(ctx, (void *)mhash, rh, sh);
>  }
>  
> -static LIST_HEAD(ecdsa_keys);
> -
> -int ecdsa_key_add(struct ecdsa_public_key *key)
> -{
> -	list_add_tail(&key->list, &ecdsa_keys);
> -
> -	return 0;
> -}
> -
>  struct ecdsa_public_key *ecdsa_key_dup(const struct ecdsa_public_key *key)
>  {
>  	struct ecdsa_public_key *new;
> @@ -129,12 +120,3 @@ struct ecdsa_public_key *ecdsa_key_dup(const struct ecdsa_public_key *key)
>  
>  	return new;
>  }
> -
> -const struct ecdsa_public_key *ecdsa_key_next(const struct ecdsa_public_key *prev)
> -{
> -	prev = list_prepare_entry(prev, &ecdsa_keys, list);
> -	list_for_each_entry_continue(prev, &ecdsa_keys, list)
> -		return prev;
> -
> -	return NULL;
> -}
> diff --git a/include/crypto/ecdsa.h b/include/crypto/ecdsa.h
> index 2e2b359d96..1bad70b9d2 100644
> --- a/include/crypto/ecdsa.h
> +++ b/include/crypto/ecdsa.h
> @@ -4,21 +4,14 @@
>  
>  #include <linux/types.h>
>  #include <linux/list.h>
> -#include <errno.h>
>  
>  struct ecdsa_public_key {
>  	const char *curve_name;	/* Name of curve, e.g. "prime256v1" */
>  	const uint64_t *x;	/* x coordinate of public key */
>  	const uint64_t *y;	/* y coordinate of public key */
>  	unsigned int size_bits;	/* key size in bits, derived from curve name */
> -	struct list_head list;
>  };
>  
> -const struct ecdsa_public_key *ecdsa_key_next(const struct ecdsa_public_key *prev);
> -
> -#define for_each_ecdsa_key(key) \
> -	for (key = ecdsa_key_next(NULL); key; key = ecdsa_key_next(key))
> -
>  #ifdef CONFIG_CRYPTO_ECDSA
>  int ecdsa_verify(const struct ecdsa_public_key *key, const uint8_t *sig,
>  		 const uint32_t sig_len, const uint8_t *hash);
> 
> ---
> base-commit: 8785a6ad7467b6f1f70b6e12aa2ceb2fdd5d8546
> change-id: 20251014-ecdsa_keys-fd8125a83e38
> 
> Best regards,
> --  
> Jonas Rebmann <jre@pengutronix.de>
> 
> 

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



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

end of thread, other threads:[~2025-10-20 12:59 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-10-14  9:38 [PATCH] crypto: ecdsa: remove unused ecdsa public key list Jonas Rebmann
2025-10-20 11:35 ` Sascha Hauer

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