linux/drivers/crypto/qat
Ard Biesheuvel cfa1d74495 crypto: qat - move temp buffers off the stack
Arnd reports that with Kees's latest VLA patches applied, the HMAC
handling in the QAT driver uses a worst case estimate of 160 bytes
for the SHA blocksize, allowing the compiler to determine the size
of the stack frame at compile time and throw a warning:

  drivers/crypto/qat/qat_common/qat_algs.c: In function 'qat_alg_do_precomputes':
  drivers/crypto/qat/qat_common/qat_algs.c:257:1: error: the frame size
  of 1112 bytes is larger than 1024 bytes [-Werror=frame-larger-than=]

Given that this worst case estimate is only 32 bytes larger than the
actual block size of SHA-512, the use of a VLA here was hiding the
excessive size of the stack frame from the compiler, and so we should
try to move these buffers off the stack.

So move the ipad/opad buffers and the various SHA state descriptors
into the tfm context struct. Since qat_alg_do_precomputes() is only
called in the context of a setkey() operation, this should be safe.
Using SHA512_BLOCK_SIZE for the size of the ipad/opad buffers allows
them to be used by SHA-1/SHA-256 as well.

Reported-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
2018-10-05 10:22:47 +08:00
..
qat_c3xxx crypto: qat - Add MODULE_FIRMWARE for all qat drivers 2018-05-31 00:13:51 +08:00
qat_c3xxxvf crypto: qat - modify format of dev top level debugfs entries 2016-12-30 19:52:34 +08:00
qat_c62x crypto: qat - Add MODULE_FIRMWARE for all qat drivers 2018-05-31 00:13:51 +08:00
qat_c62xvf crypto: qat - modify format of dev top level debugfs entries 2016-12-30 19:52:34 +08:00
qat_common crypto: qat - move temp buffers off the stack 2018-10-05 10:22:47 +08:00
qat_dh895xcc crypto: qat - Add MODULE_FIRMWARE for all qat drivers 2018-05-31 00:13:51 +08:00
qat_dh895xccvf crypto: qat - modify format of dev top level debugfs entries 2016-12-30 19:52:34 +08:00
Kconfig crypto: qat - Add DH support 2016-07-11 18:03:10 +08:00
Makefile License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00