diff options
author | Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> | 2015-03-11 17:53:03 +0100 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2015-03-12 07:58:24 +0100 |
commit | 804fae5d16c8c48c6fca8d54f2878a2e382a0bc2 (patch) | |
tree | ba56426830aef6a3ca7b5c1d2a9b808ae5361b8f /include | |
parent | 1ac61317c64f8fda2ab533200dffce5fd3edcbf6 (diff) | |
download | barebox-804fae5d16c8c48c6fca8d54f2878a2e382a0bc2.tar.gz |
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 'include')
-rw-r--r-- | include/digest.h | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/include/digest.h b/include/digest.h index 8563c10128..208a463793 100644 --- a/include/digest.h +++ b/include/digest.h @@ -50,4 +50,25 @@ int digest_file(struct digest *d, char *filename, int digest_file_by_name(char *algo, char *filename, unsigned char *hash); +static inline int digest_init(struct digest *d) +{ + return d->init(d); +} + +static inline int digest_update(struct digest *d, const void *data, + unsigned long len) +{ + return d->update(d, data, len); +} + +static inline int digest_final(struct digest *d, unsigned char *md) +{ + return d->final(d, md); +} + +static inline int digest_length(struct digest *d) +{ + return d->length; +} + #endif /* __SH_ST_DEVICES_H__ */ |