[PATCH 6/7] digest: add HMAC support for md5, sha1, sha224, sha256, sha384, sha512

Sascha Hauer s.hauer at pengutronix.de
Tue Mar 10 22:40:14 PDT 2015


On Tue, Mar 10, 2015 at 03:28:16PM +0100, Jean-Christophe PLAGNIOL-VILLARD wrote:
> Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj at jcrosoft.com>
> ---
>  common/digest.c  | 51 +++++++++++++++++++++++++++++++++++++++++++++++++++
>  crypto/md5.c     |  1 +
>  crypto/sha1.c    |  1 +
>  crypto/sha2.c    |  2 ++
>  crypto/sha4.c    |  2 ++
>  include/digest.h | 16 ++++++++++++++++
>  6 files changed, 73 insertions(+)
> 
> diff --git a/common/digest.c b/common/digest.c
> index 89af862..7c09ce2 100644
> --- a/common/digest.c
> +++ b/common/digest.c
> @@ -102,6 +102,57 @@ void digest_free(struct digest *d)
>  }
>  EXPORT_SYMBOL_GPL(digest_free);
>  
> +void digest_hmac_init(struct digest *d, const unsigned char *key,
> +                       size_t keylen)
> +{

We should rather implement hmac just like the other digests. That is,
this function should be digest->init and the key would have to be passed
via the same mechanism used in the kernel: a digest->setkey

Sascha

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |



More information about the barebox mailing list