diff options
author | Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> | 2015-03-18 10:37:53 +0100 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2015-03-20 11:45:55 +0100 |
commit | ca95c2531f7ff68c95cfa205623e157e720615f0 (patch) | |
tree | 3a33bf098d46eef3fcb8e8e7fa69f7f7f0b8fea5 /include | |
parent | b0be99fc10e50c41b75647a2486c05f9bd47f1c3 (diff) | |
download | barebox-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 'include')
-rw-r--r-- | include/digest.h | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/include/digest.h b/include/digest.h index cb579ee03d..85c4da36f5 100644 --- a/include/digest.h +++ b/include/digest.h @@ -25,6 +25,8 @@ struct digest; struct digest_algo { char *name; +#define DIGEST_ALGO_NEED_KEY (1 << 0) + unsigned int flags; int (*alloc)(struct digest *d); void (*free)(struct digest *d); @@ -108,4 +110,14 @@ static inline int digest_set_key(struct digest *d, const unsigned char *key, return d->algo->set_key(d, key, len); } +static inline int digest_is_flags(struct digest *d, unsigned int flags) +{ + return d->algo->flags & flags; +} + +static inline const char *digest_name(struct digest *d) +{ + return d->algo->name; +} + #endif /* __SH_ST_DEVICES_H__ */ |