diff options
author | Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> | 2015-03-25 12:56:13 +0100 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2015-03-27 07:49:45 +0100 |
commit | e10cc0b3330d4dd72fef076a7f1b2b67cb271a12 (patch) | |
tree | 4122c65e03433a8936fa7f5fbb9bdfb279337e26 /include/digest.h | |
parent | 5afec9c781406a0aa3080c9aacb17c3f75abc0aa (diff) | |
download | barebox-e10cc0b3330d4dd72fef076a7f1b2b67cb271a12.tar.gz barebox-e10cc0b3330d4dd72fef076a7f1b2b67cb271a12.tar.xz |
digest: allow algo to specify their length at runtime
such as RSA as we load a DER key we will detect the key size
at runtime and so the algo length.
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 | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/include/digest.h b/include/digest.h index 85c4da36f5..c574b4d568 100644 --- a/include/digest.h +++ b/include/digest.h @@ -47,6 +47,7 @@ struct digest_algo { struct digest { struct digest_algo *algo; void *ctx; + unsigned int length; }; /* @@ -99,7 +100,7 @@ static inline int digest_verify(struct digest *d, const unsigned char *md) static inline int digest_length(struct digest *d) { - return d->algo->length; + return d->length ? d->length : d->algo->length; } static inline int digest_set_key(struct digest *d, const unsigned char *key, |