Re: [PATCH 6/6] crypto: hmac - Add ahash support

kernel test robot
2025-05-10T15:43:30Z

Hi Herbert,

kernel test robot noticed the following build warnings:

[auto build test WARNING on herbert-cryptodev-2.6/master]
[also build test WARNING on next-20250509]
[cannot apply to herbert-crypto-2.6/master linus/master v6.15-rc5]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url: https://github.com/intel-lab-lkp/linux/commits/Herbert-Xu/crypto-ahash-Handle-partial-blocks-in-API/20250505-203411
base: https://git.kernel.org/pub/scm/linux/kernel/git/herbert/cryptodev-2.6.git master
patch link: https://lore.kernel.org/r/f67cc874594fd2cc873667530c83e239ae09db81.1746448291.git.herbert%40gondor.apana.org.au
patch subject: [PATCH 6/6] crypto: hmac - Add ahash support
config: mips-eyeq6_defconfig (https://download.01.org/0day-ci/archive/20250510/202505102347.IvvpwcPQ-lkp@intel.com/config)
compiler: clang version 21.0.0git (https://github.com/llvm/llvm-project f819f46284f2a79790038e1f6649172789734ae8)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250510/202505102347.IvvpwcPQ-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202505102347.IvvpwcPQ-lkp@intel.com/

All warnings (new ones prefixed by >>):

>> crypto/hmac.c:231:12: warning: stack frame size (1152) exceeds limit (1024) in 'hmac_setkey_ahash' [-Wframe-larger-than]
231 | static int hmac_setkey_ahash(struct crypto_ahash *parent,
| ^
1 warning generated.

vim +/hmac_setkey_ahash +231 crypto/hmac.c

230
> 231 static int hmac_setkey_ahash(struct crypto_ahash *parent,
232 const u8 *inkey, unsigned int keylen)
233 {
234 struct ahash_hmac_ctx *tctx = crypto_ahash_ctx(parent);
235 struct crypto_ahash *fb = crypto_ahash_fb(tctx->hash);
236 int ds = crypto_ahash_digestsize(parent);
237 int bs = crypto_ahash_blocksize(parent);
238 int ss = crypto_ahash_statesize(parent);
239 HASH_REQUEST_ON_STACK(req, fb);
240 u8 *opad = &tctx->pads[ss];
241 u8 *ipad = &tctx->pads[0];
242 int err, i;
243
244 if (fips_enabled && (keylen < 112 / 8))
245 return -EINVAL;
246
247 ahash_request_set_callback(req, 0, NULL, NULL);
248
249 if (keylen > bs) {
250 ahash_request_set_virt(req, inkey, ipad, keylen);
251 err = crypto_ahash_digest(req);
252 if (err)
253 goto out_zero_req;
254
255 keylen = ds;
256 } else
257 memcpy(ipad, inkey, keylen);
258
259 memset(ipad + keylen, 0, bs - keylen);
260 memcpy(opad, ipad, bs);
261
262 for (i = 0; i < bs; i++) {
263 ipad[i] ^= HMAC_IPAD_VALUE;
264 opad[i] ^= HMAC_OPAD_VALUE;
265 }
266
267 ahash_request_set_virt(req, ipad, NULL, bs);
268 err = crypto_ahash_init(req) ?:
269 crypto_ahash_update(req) ?:
270 crypto_ahash_export(req, ipad);
271
272 ahash_request_set_virt(req, opad, NULL, bs);
273 err = err ?:
274 crypto_ahash_init(req) ?:
275 crypto_ahash_update(req) ?:
276 crypto_ahash_export(req, opad);
277
278 out_zero_req:
279 HASH_REQUEST_ZERO(req);
280 return err;
281 }
282

--
0-DAY CI Kernel Test Service