OpenCloudOS-Kernel/drivers/crypto/vmx
Daniel Axtens 1372a51b88 crypto: vmx - reject xts inputs that are too short
When the kernel XTS implementation was extended to deal with ciphertext
stealing in commit 8083b1bf81 ("crypto: xts - add support for ciphertext
stealing"), a check was added to reject inputs that were too short.

However, in the vmx enablement - commit 2396684193 ("crypto: vmx/xts -
use fallback for ciphertext stealing"), that check wasn't added to the
vmx implementation. This disparity leads to errors like the following:

alg: skcipher: p8_aes_xts encryption unexpectedly succeeded on test vector "random: len=0 klen=64"; expected_error=-22, cfg="random: inplace may_sleep use_finup src_divs=[<flush>66.99%@+10, 33.1%@alignmask+1155]"

Return -EINVAL if asked to operate with a cryptlen smaller than the AES
block size. This brings vmx in line with the generic implementation.

Reported-by: Erhard Furtner <erhard_f@mailbox.org>
Link: https://bugzilla.kernel.org/show_bug.cgi?id=206049
Fixes: 2396684193 ("crypto: vmx/xts - use fallback for ciphertext stealing")
Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: stable@vger.kernel.org # v5.4+
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
[dja: commit message]
Signed-off-by: Daniel Axtens <dja@axtens.net>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
2020-01-16 15:18:13 +08:00
..
.gitignore crypto: vmx - Ignore generated files 2016-07-20 22:41:44 +08:00
Kconfig treewide: Add SPDX license identifier - Makefile/Kconfig 2019-05-21 10:50:46 +02:00
Makefile crypto: vmx - Avoid weird build failures 2019-11-22 18:48:39 +08:00
aes.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 299 2019-06-05 17:36:59 +02:00
aes_cbc.c Merge branch 'linus' of git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6 2019-07-08 20:57:08 -07:00
aes_ctr.c Merge branch 'linus' of git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6 2019-07-08 20:57:08 -07:00
aes_xts.c crypto: vmx - reject xts inputs that are too short 2020-01-16 15:18:13 +08:00
aesp8-ppc.h crypto: vmx - convert to skcipher API 2019-05-30 15:28:40 +08:00
aesp8-ppc.pl crypto: vmx - Document CTR mode counter width quirks 2019-06-20 14:18:33 +08:00
ghash.c crypto: vmx - ghash: do nosimd fallback manually 2019-05-17 13:36:54 +08:00
ghashp8-ppc.pl treewide: convert ISO_8859-1 text comments to utf-8 2018-08-23 18:48:43 -07:00
ppc-xlate.pl License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
vmx.c Merge branch 'linus' of git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6 2019-07-08 20:57:08 -07:00