summaryrefslogtreecommitdiffstats
path: root/commands/digest.c
diff options
context:
space:
mode:
authorJean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>2015-03-11 17:53:03 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2015-03-12 07:58:24 +0100
commit804fae5d16c8c48c6fca8d54f2878a2e382a0bc2 (patch)
treeba56426830aef6a3ca7b5c1d2a9b808ae5361b8f /commands/digest.c
parent1ac61317c64f8fda2ab533200dffce5fd3edcbf6 (diff)
downloadbarebox-804fae5d16c8c48c6fca8d54f2878a2e382a0bc2.tar.gz
barebox-804fae5d16c8c48c6fca8d54f2878a2e382a0bc2.tar.xz
digest: introduce digest_{init/update/final/length}
This will allow to move from a one at a time digest to a multi-instance with too much impact on the code using it 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.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/commands/digest.c b/commands/digest.c
index 092fda21af..bad7d3f094 100644
--- a/commands/digest.c
+++ b/commands/digest.c
@@ -39,7 +39,7 @@ static int do_digest(char *algorithm, int argc, char *argv[])
if (argc < 2)
return COMMAND_ERROR_USAGE;
- hash = calloc(d->length, sizeof(unsigned char));
+ hash = calloc(digest_length(d), sizeof(unsigned char));
if (!hash) {
perror("calloc");
return COMMAND_ERROR_USAGE;
@@ -60,7 +60,7 @@ static int do_digest(char *algorithm, int argc, char *argv[])
if (digest_file_window(d, filename, hash, start, size) < 0) {
ret = 1;
} else {
- for (i = 0; i < d->length; i++)
+ for (i = 0; i < digest_length(d); i++)
printf("%02x", hash[i]);
printf(" %s\t0x%08llx ... 0x%08llx\n",