Re: crypto/hmac.c:251:12: warning: stack frame size (1152) exceeds limit (1024) in 'hmac_setkey_ahash'

From: Herbert Xu

Date: Fri Apr 17 2026 - 00:00:18 EST


On Thu, Apr 16, 2026 at 11:24:06AM +0100, David Laight wrote:
>
> > 250
> > > 251 static int hmac_setkey_ahash(struct crypto_ahash *parent,
> > 252 const u8 *inkey, unsigned int keylen)
> > 253 {
> > 254 struct ahash_hmac_ctx *tctx = crypto_ahash_ctx(parent);
> > 255 struct crypto_ahash *fb = crypto_ahash_fb(tctx->hash);
> > 256 int ds = crypto_ahash_digestsize(parent);
> > 257 int bs = crypto_ahash_blocksize(parent);
> > 258 int ss = crypto_ahash_statesize(parent);
> > 259 HASH_REQUEST_ON_STACK(req, fb);
> > 260 u8 *opad = &tctx->pads[ss];
>
> Is ss actually guaranteed to be not smaller than bs ?

Yes, it's checked in hmac_create_ahash:

ds = halg->digestsize;
ss = halg->statesize;
if (ds > alg->cra_blocksize || ss < alg->cra_blocksize)
goto err_free_inst;

Thanks,
--
Email: Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt