summaryrefslogtreecommitdiffstats
path: root/commands/digest.c
diff options
context:
space:
mode:
authorJean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>2015-03-11 17:53:04 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2015-03-12 07:58:24 +0100
commit27b2336029335ea3f02243ff170986cdab1f98ef (patch)
tree722083808d1ce9b3bb69d3cca3520ce61a09064d /commands/digest.c
parent804fae5d16c8c48c6fca8d54f2878a2e382a0bc2 (diff)
downloadbarebox-27b2336029335ea3f02243ff170986cdab1f98ef.tar.gz
barebox-27b2336029335ea3f02243ff170986cdab1f98ef.tar.xz
digest: make it multi-instance
Now you need to call digest_alloc and when you finish to use it digest_free. We need this for upcomming aes encryption support and secure boot as we will need multiple instance of the same digest. Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'commands/digest.c')
-rw-r--r--commands/digest.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/commands/digest.c b/commands/digest.c
index bad7d3f094..c6a2751356 100644
--- a/commands/digest.c
+++ b/commands/digest.c
@@ -33,7 +33,7 @@ static int do_digest(char *algorithm, int argc, char *argv[])
int i;
unsigned char *hash;
- d = digest_get_by_name(algorithm);
+ d = digest_alloc(algorithm);
BUG_ON(!d);
if (argc < 2)
@@ -71,6 +71,7 @@ static int do_digest(char *algorithm, int argc, char *argv[])
}
free(hash);
+ digest_free(d);
return ret;
}