summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2019-10-01 23:36:26 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2019-10-15 14:55:11 +0200
commitd091a81f3ece732826dd4dec0b241624159ae1d6 (patch)
treed5b1cbb075851dc21c5009f9f7aeb1bf98790001 /include
parent128ad3cbe043d5153007a50f09208c25703257dd (diff)
downloadbarebox-d091a81f3ece732826dd4dec0b241624159ae1d6.tar.gz
barebox-d091a81f3ece732826dd4dec0b241624159ae1d6.tar.xz
rsa: let rsa_of_read_key() return a fully allocated key
Until now rsa_of_read_key() took a pointer to a key and filled the struct rsa_public_key members with allocated values. So far we have never freed these values. Change rsa_of_read_key() to always return a fully allocated key and provide rsa_key_free() to free it. Let the FIT image code free the key after usage. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'include')
-rw-r--r--include/rsa.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/include/rsa.h b/include/rsa.h
index feb8c31200..cf2e6c7e08 100644
--- a/include/rsa.h
+++ b/include/rsa.h
@@ -49,6 +49,7 @@ int rsa_verify(const struct rsa_public_key *key, const uint8_t *sig,
/* This is the maximum signature length that we support, in bits */
#define RSA_MAX_SIG_BITS 4096
-int rsa_of_read_key(struct device_node *node, struct rsa_public_key *key);
+struct rsa_public_key *rsa_of_read_key(struct device_node *node);
+void rsa_key_free(struct rsa_public_key *key);
#endif