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

Sascha Hauer s.hauer at pengutronix.de
Thu Mar 12 00:17:07 PDT 2015


On Wed, Mar 11, 2015 at 05:53:08PM +0100, Jean-Christophe PLAGNIOL-VILLARD wrote:
> the hmac algo will be registered as hmac(%s) such as hmac(sha256)
> 
> Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj at jcrosoft.com>
> ---
> +static int digest_hmac_alloc(struct digest *d)
> +{
> +	struct digest_hmac_ctx *dh = d->ctx;
> +	struct digest_hmac *hmac = to_digest_hmac(d->algo);
> +
> +	dh->d = digest_alloc(hmac->name);
> +	if (!dh->d)
> +		return -EINVAL;
> +
> +	dh->ipad = xmalloc(sizeof(unsigned char) * hmac->pad_length);
> +	dh->opad = xmalloc(sizeof(unsigned char) * hmac->pad_length);

sizeof(unsigned char) is 1. Dropped while applying.

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