kernel_optimize_test/drivers/crypto
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
..
amcc crypto: skcipher - remove useless setting of type flags 2018-07-09 00:30:27 +08:00
axis crypto: artpec6 - Remove VLA usage of skcipher 2018-09-28 12:46:08 +08:00
bcm crypto: aead - remove useless setting of type flags 2018-07-09 00:30:26 +08:00
caam crypto: caam/qi2 - add support for ahash algorithms 2018-09-21 13:24:51 +08:00
cavium crypto: cavium - remove redundant null pointer check before kfree 2018-09-28 12:46:27 +08:00
ccp crypto: ccp - Make function sev_get_firmware() static 2018-10-05 10:16:56 +08:00
ccree crypto: ccree - allow bigger than sector XTS op 2018-08-03 18:06:05 +08:00
chelsio crypto: chtls - remove redundant null pointer check before kfree_skb 2018-09-28 12:46:26 +08:00
hisilicon crypto: hisilicon - sec_send_request() can be static 2018-08-07 17:51:39 +08:00
inside-secure crypto: inside-secure - initialize first_rdesc to make GCC happy 2018-07-20 13:51:22 +08:00
marvell crypto: remove redundant type flags from tfm allocation 2018-07-09 00:30:29 +08:00
mediatek headers: separate linux/mod_devicetable.h from linux/platform_device.h 2018-07-07 17:52:26 +02:00
nx powerpc updates for 4.19 2018-08-17 11:32:50 -07:00
qat crypto: qat - move temp buffers off the stack 2018-10-05 10:22:47 +08:00
qce crypto: qce - Remove VLA usage of skcipher 2018-09-28 12:46:08 +08:00
rockchip
stm32 Char/Misc driver patches for 4.19-rc1 2018-08-18 11:04:51 -07:00
sunxi-ss crypto: skcipher - remove useless setting of type flags 2018-07-09 00:30:27 +08:00
ux500 Char/Misc driver patches for 4.19-rc1 2018-08-18 11:04:51 -07:00
virtio Merge branch 'linus' of git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6 2018-08-15 16:01:47 -07:00
vmx crypto: vmx - Remove VLA usage of skcipher 2018-09-28 12:46:08 +08:00
atmel-aes-regs.h
atmel-aes.c crypto: atmel - switch to SPDX license identifiers 2018-09-04 11:37:04 +08:00
atmel-authenc.h crypto: atmel - switch to SPDX license identifiers 2018-09-04 11:37:04 +08:00
atmel-ecc.c crypto: atmel - switch to SPDX license identifiers 2018-09-04 11:37:04 +08:00
atmel-ecc.h crypto: atmel - switch to SPDX license identifiers 2018-09-04 11:37:04 +08:00
atmel-sha-regs.h
atmel-sha.c crypto: atmel - switch to SPDX license identifiers 2018-09-04 11:37:04 +08:00
atmel-tdes-regs.h
atmel-tdes.c crypto: atmel - switch to SPDX license identifiers 2018-09-04 11:37:04 +08:00
exynos-rng.c
geode-aes.c
geode-aes.h
hifn_795x.c
img-hash.c
ixp4xx_crypto.c
Kconfig crypto: hisilicon - SEC security accelerator driver 2018-08-03 18:06:02 +08:00
Makefile crypto: caam/qi2 - add DPAA2-CAAM driver 2018-09-21 13:24:51 +08:00
mxc-scc.c
mxs-dcp.c crypto: mxs-dcp - Remove VLA usage of skcipher 2018-09-28 12:46:09 +08:00
n2_asm.S
n2_core.c crypto: ahash - remove useless setting of type flags 2018-07-09 00:30:25 +08:00
n2_core.h
omap-aes-gcm.c
omap-aes.c crypto: omap-aes - Remove VLA usage of skcipher 2018-09-28 12:46:09 +08:00
omap-aes.h crypto: omap-aes - Remove VLA usage of skcipher 2018-09-28 12:46:09 +08:00
omap-crypto.c
omap-crypto.h
omap-des.c
omap-sham.c crypto: ahash - remove useless setting of type flags 2018-07-09 00:30:25 +08:00
padlock-aes.c crypto: padlock-aes - Fix Nano workaround data corruption 2018-07-20 13:47:42 +08:00
padlock-sha.c crypto: shash - remove useless setting of type flags 2018-07-09 00:30:24 +08:00
picoxcell_crypto_regs.h
picoxcell_crypto.c crypto: picoxcell - Remove VLA usage of skcipher 2018-09-28 12:46:09 +08:00
qcom-rng.c crypto: qcom-rng - Add ACPI support 2018-07-27 19:04:32 +08:00
s5p-sss.c crypto: s5p-sss: Add aes-ctr support 2018-09-28 12:46:06 +08:00
sahara.c crypto: sahara - Remove VLA usage of skcipher 2018-09-28 12:46:08 +08:00
talitos.c crypto: ahash - remove useless setting of cra_type 2018-07-09 00:30:26 +08:00
talitos.h