diff options
author | Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> | 2015-03-17 12:53:11 +0100 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2015-03-19 07:46:22 +0100 |
commit | 7aeb9650b6c57a81c0cf903a3977e6d6fbb2808c (patch) | |
tree | 21490f2e829ad93f622b09d5c3bb7d322dc43a39 /include/digest.h | |
parent | ec4f9699718054f2b4e49ed441f3420c257f5f26 (diff) | |
download | barebox-7aeb9650b6c57a81c0cf903a3977e6d6fbb2808c.tar.gz barebox-7aeb9650b6c57a81c0cf903a3977e6d6fbb2808c.tar.xz |
digest: add digest callback
Combination of @init and @update and @final. This function
effectively behaves as the entire chain of operations, @init,
@update and @final issued in sequence. This is added for hardware
which cannot do even the @finup, but can only do the whole
transformation in one run.
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'include/digest.h')
-rw-r--r-- | include/digest.h | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/include/digest.h b/include/digest.h index 5d1d80c31d..718793a1a7 100644 --- a/include/digest.h +++ b/include/digest.h @@ -31,6 +31,8 @@ struct digest_algo { int (*init)(struct digest *d); int (*update)(struct digest *d, const void *data, unsigned long len); int (*final)(struct digest *d, unsigned char *md); + int (*digest)(struct digest *d, const void *data, + unsigned int len, u8 *out); int (*set_key)(struct digest *d, const unsigned char *key, unsigned int len); int (*verify)(struct digest *d, const unsigned char *md); @@ -78,6 +80,12 @@ static inline int digest_final(struct digest *d, unsigned char *md) return d->algo->final(d, md); } +static inline int digest_digest(struct digest *d, const void *data, + unsigned int len, u8 *md) +{ + return d->algo->digest(d, data, len, md); +} + static inline int digest_verify(struct digest *d, const unsigned char *md) { return d->algo->verify(d, md); |