summaryrefslogtreecommitdiffstats
path: root/crypto
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2022-05-04 12:54:55 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2022-05-04 15:12:31 +0200
commit8a44a0c3259511f4eda61383d333f9f0858ca4a5 (patch)
tree0107327cb3ffe4abf6735dbdb51edd511e0316f6 /crypto
parentb2f33a4b95af0566c735cfc188dc8758636c2263 (diff)
downloadbarebox-8a44a0c3259511f4eda61383d333f9f0858ca4a5.tar.gz
barebox-8a44a0c3259511f4eda61383d333f9f0858ca4a5.tar.xz
rsa: Add iterator for rsa keys
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'crypto')
-rw-r--r--crypto/rsa.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/crypto/rsa.c b/crypto/rsa.c
index 4e2d463b54..2eeb9984b1 100644
--- a/crypto/rsa.c
+++ b/crypto/rsa.c
@@ -446,6 +446,15 @@ void rsa_key_free(struct rsa_public_key *key)
static LIST_HEAD(rsa_keys);
+const struct rsa_public_key *rsa_key_next(const struct rsa_public_key *prev)
+{
+ prev = list_prepare_entry(prev, &rsa_keys, list);
+ list_for_each_entry_continue(prev, &rsa_keys, list)
+ return prev;
+
+ return NULL;
+}
+
const struct rsa_public_key *rsa_get_key(const char *name)
{
const struct rsa_public_key *key;