From 804fae5d16c8c48c6fca8d54f2878a2e382a0bc2 Mon Sep 17 00:00:00 2001 From: Jean-Christophe PLAGNIOL-VILLARD Date: Wed, 11 Mar 2015 17:53:03 +0100 Subject: 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 Signed-off-by: Sascha Hauer --- include/digest.h | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'include') 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__ */ -- cgit v1.2.1