[PATCH] rsa: fix deleting RSA keys

Ahmad Fatoum a.fatoum at pengutronix.de
Wed Jul 24 02:47:02 PDT 2024


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 at 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




More information about the barebox mailing list