summaryrefslogtreecommitdiffstats
path: root/commands/digest.c
diff options
context:
space:
mode:
authorJean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>2015-03-18 10:37:53 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2015-03-20 11:45:55 +0100
commitca95c2531f7ff68c95cfa205623e157e720615f0 (patch)
tree3a33bf098d46eef3fcb8e8e7fa69f7f7f0b8fea5 /commands/digest.c
parentb0be99fc10e50c41b75647a2486c05f9bd47f1c3 (diff)
downloadbarebox-ca95c2531f7ff68c95cfa205623e157e720615f0.tar.gz
barebox-ca95c2531f7ff68c95cfa205623e157e720615f0.tar.xz
crypto: digest: speficied when a digest need a key to be used
such as for hmac(xxx) you must provide a key This will allow to enforce the correct parameter at digest command <digest>sum is not impacted 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, 3 insertions, 0 deletions
diff --git a/commands/digest.c b/commands/digest.c
index ef95e94816..b6bce88297 100644
--- a/commands/digest.c
+++ b/commands/digest.c
@@ -34,6 +34,9 @@ int __do_digest(struct digest *d, unsigned char *key, int keylen,
perror("set_key");
goto err;
}
+ } else if (digest_is_flags(d, DIGEST_ALGO_NEED_KEY)) {
+ eprintf("%s need a key to be used\n", digest_name(d));
+ goto err;
}
hash = calloc(digest_length(d), sizeof(unsigned char));