mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH] rsa: fix deleting RSA keys
@ 2024-07-24  9:47 Ahmad Fatoum
  2024-07-30  8:15 ` Sascha Hauer
  0 siblings, 1 reply; 2+ messages in thread
From: Ahmad Fatoum @ 2024-07-24  9:47 UTC (permalink / raw)
  To: barebox; +Cc: Ahmad Fatoum

RSA keys are appended onto rsa_keys with rsa_key_add, so it makes sense
that rsa_key_free would remove them from the key ring's linked list.

It's possible to have "standalone" RSA keys outside the key ring, but
those would be global variables which can't be freed anyway.

There are no current users of this function.

Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 crypto/rsa.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/crypto/rsa.c b/crypto/rsa.c
index b798badce0d0..a379b77c9acb 100644
--- a/crypto/rsa.c
+++ b/crypto/rsa.c
@@ -439,6 +439,8 @@ struct rsa_public_key *rsa_of_read_key(struct device_node *node)
 
 void rsa_key_free(struct rsa_public_key *key)
 {
+	list_del(&key->list);
+
 	free(key->modulus);
 	free(key->rr);
 	free(key);
-- 
2.39.2




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

* Re: [PATCH] rsa: fix deleting RSA keys
  2024-07-24  9:47 [PATCH] rsa: fix deleting RSA keys Ahmad Fatoum
@ 2024-07-30  8:15 ` Sascha Hauer
  0 siblings, 0 replies; 2+ messages in thread
From: Sascha Hauer @ 2024-07-30  8:15 UTC (permalink / raw)
  To: barebox, Ahmad Fatoum


On Wed, 24 Jul 2024 11:47:02 +0200, Ahmad Fatoum wrote:
> RSA keys are appended onto rsa_keys with rsa_key_add, so it makes sense
> that rsa_key_free would remove them from the key ring's linked list.
> 
> It's possible to have "standalone" RSA keys outside the key ring, but
> those would be global variables which can't be freed anyway.
> 
> There are no current users of this function.
> 
> [...]

Applied, thanks!

[1/1] rsa: fix deleting RSA keys
      https://git.pengutronix.de/cgit/barebox/commit/?id=cc4c86c95893 (link may not be stable)

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




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

end of thread, other threads:[~2024-07-30  8:16 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-07-24  9:47 [PATCH] rsa: fix deleting RSA keys Ahmad Fatoum
2024-07-30  8:15 ` Sascha Hauer

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