linux/drivers/crypto/vmx
Daniel Axtens 009b30ac74 crypto: vmx - CTR: always increment IV as quadword
The kernel self-tests picked up an issue with CTR mode:
alg: skcipher: p8_aes_ctr encryption test failed (wrong result) on test vector 3, cfg="uneven misaligned splits, may sleep"

Test vector 3 has an IV of FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFD, so
after 3 increments it should wrap around to 0.

In the aesp8-ppc code from OpenSSL, there are two paths that
increment IVs: the bulk (8 at a time) path, and the individual
path which is used when there are fewer than 8 AES blocks to
process.

In the bulk path, the IV is incremented with vadduqm: "Vector
Add Unsigned Quadword Modulo", which does 128-bit addition.

In the individual path, however, the IV is incremented with
vadduwm: "Vector Add Unsigned Word Modulo", which instead
does 4 32-bit additions. Thus the IV would instead become
FFFFFFFFFFFFFFFFFFFFFFFF00000000, throwing off the result.

Use vadduqm.

This was probably a typo originally, what with q and w being
adjacent. It is a pretty narrow edge case: I am really
impressed by the quality of the kernel self-tests!

Fixes: 5c380d623e ("crypto: vmx - Add support for VMS instructions by ASM")
Cc: stable@vger.kernel.org
Signed-off-by: Daniel Axtens <dja@axtens.net>
Acked-by: Nayna Jain <nayna@linux.ibm.com>
Tested-by: Nayna Jain <nayna@linux.ibm.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
2019-05-17 13:36:54 +08:00
..
.gitignore crypto: vmx - Ignore generated files 2016-07-20 22:41:44 +08:00
aes_cbc.c crypto: powerpc - convert to use crypto_simd_usable() 2019-04-18 22:15:04 +08:00
aes_ctr.c crypto: powerpc - convert to use crypto_simd_usable() 2019-04-18 22:15:04 +08:00
aes_xts.c crypto: powerpc - convert to use crypto_simd_usable() 2019-04-18 22:15:04 +08:00
aes.c crypto: powerpc - convert to use crypto_simd_usable() 2019-04-18 22:15:04 +08:00
aesp8-ppc.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
aesp8-ppc.pl crypto: vmx - CTR: always increment IV as quadword 2019-05-17 13:36:54 +08:00
ghash.c crypto: shash - remove shash_desc::flags 2019-04-25 15:38:12 +08:00
ghashp8-ppc.pl treewide: convert ISO_8859-1 text comments to utf-8 2018-08-23 18:48:43 -07:00
Kconfig crypto: vmx - Ensure ghash-generic is enabled 2016-10-02 22:33:44 +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
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 crypto: vmx - Make p8_init and p8_exit static 2019-03-28 13:55:34 +08:00