summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorJean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>2015-03-11 17:53:03 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2015-03-12 07:58:24 +0100
commit804fae5d16c8c48c6fca8d54f2878a2e382a0bc2 (patch)
treeba56426830aef6a3ca7b5c1d2a9b808ae5361b8f /include
parent1ac61317c64f8fda2ab533200dffce5fd3edcbf6 (diff)
downloadbarebox-804fae5d16c8c48c6fca8d54f2878a2e382a0bc2.tar.gz
barebox-804fae5d16c8c48c6fca8d54f2878a2e382a0bc2.tar.xz
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.h21
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__ */