From ec4f9699718054f2b4e49ed441f3420c257f5f26 Mon Sep 17 00:00:00 2001 From: Jean-Christophe PLAGNIOL-VILLARD Date: Tue, 17 Mar 2015 12:53:10 +0100 Subject: digest: add verify callback this will allow to compare a md with the original one When calling this do not call final For RSA_SIGN verification final does not exist only verify as final will be for signing Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD Signed-off-by: Sascha Hauer --- include/digest.h | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'include/digest.h') diff --git a/include/digest.h b/include/digest.h index 1c742f615e..5d1d80c31d 100644 --- a/include/digest.h +++ b/include/digest.h @@ -32,6 +32,7 @@ struct digest_algo { int (*update)(struct digest *d, const void *data, unsigned long len); int (*final)(struct digest *d, unsigned char *md); int (*set_key)(struct digest *d, const unsigned char *key, unsigned int len); + int (*verify)(struct digest *d, const unsigned char *md); unsigned int length; unsigned int ctx_length; @@ -77,6 +78,11 @@ static inline int digest_final(struct digest *d, unsigned char *md) return d->algo->final(d, md); } +static inline int digest_verify(struct digest *d, const unsigned char *md) +{ + return d->algo->verify(d, md); +} + static inline int digest_length(struct digest *d) { return d->algo->length; -- cgit v1.2.3