Re: KASAN: stack-out-of-bounds Write in sha3_update

From: Eric Biggers
Date: Tue Nov 28 2017 - 20:53:59 EST


On Tue, Nov 28, 2017 at 12:58:45PM -0800, Eric Biggers wrote:
> diff --git a/crypto/hmac.c b/crypto/hmac.c
> index 92871dc2a63e..82436db6b6a6 100644
> --- a/crypto/hmac.c
> +++ b/crypto/hmac.c
> @@ -196,6 +196,11 @@ static int hmac_create(struct crypto_template *tmpl, struct rtattr **tb)
> if (IS_ERR(salg))
> return PTR_ERR(salg);
>
> + /* The underlying hash algorithm must be unkeyed */
> + err = -EINVAL;
> + if (crypto_shash_alg_has_setkey(salg))
> + goto out_put_alg;
> +
> err = -EINVAL;
> ds = salg->digestsize;
> ss = salg->statesize;

I messed this up; it needs to initialize 'alg' first. I'll send a fixed
version.

Eric