linux-sg2042/arch/arm64/crypto
Ard Biesheuvel 2db34e78f1 crypto: arm64/aes-ctr - fix NULL dereference in tail processing
The AES-CTR glue code avoids calling into the blkcipher API for the
tail portion of the walk, by comparing the remainder of walk.nbytes
modulo AES_BLOCK_SIZE with the residual nbytes, and jumping straight
into the tail processing block if they are equal. This tail processing
block checks whether nbytes != 0, and does nothing otherwise.

However, in case of an allocation failure in the blkcipher layer, we
may enter this code with walk.nbytes == 0, while nbytes > 0. In this
case, we should not dereference the source and destination pointers,
since they may be NULL. So instead of checking for nbytes != 0, check
for (walk.nbytes % AES_BLOCK_SIZE) != 0, which implies the former in
non-error conditions.

Fixes: 49788fe2a1 ("arm64/crypto: AES-ECB/CBC/CTR/XTS using ARMv8 NEON and Crypto Extensions")
Cc: stable@vger.kernel.org
Reported-by: xiakaixu <xiakaixu@huawei.com>
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
2016-09-13 18:44:59 +08:00
..
Kconfig Merge git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6 2014-12-13 13:33:26 -08:00
Makefile arm64: crypto: increase AES interleave to 4x 2015-02-26 18:31:46 +00:00
aes-ce-ccm-core.S arm64/crypto: issue aese/aesmc instructions in pairs 2015-03-19 10:43:57 +00:00
aes-ce-ccm-glue.c crypto: aead - Remove CRYPTO_ALG_AEAD_NEW flag 2015-08-17 16:53:53 +08:00
aes-ce-cipher.c arm64: crypto: reduce priority of core AES cipher 2015-11-18 12:09:08 +00:00
aes-ce-setkey.h arm64/crypto: use crypto instructions to generate AES key schedule 2014-11-06 17:25:28 +00:00
aes-ce.S arm64/crypto: issue aese/aesmc instructions in pairs 2015-03-19 10:43:57 +00:00
aes-glue.c crypto: arm64/aes-ctr - fix NULL dereference in tail processing 2016-09-13 18:44:59 +08:00
aes-modes.S arm64/crypto: AES-ECB/CBC/CTR/XTS using ARMv8 NEON and Crypto Extensions 2014-05-14 10:04:16 -07:00
aes-neon.S arm64/crypto: AES-ECB/CBC/CTR/XTS using ARMv8 NEON and Crypto Extensions 2014-05-14 10:04:16 -07:00
crc32-arm64.c crypto: arm64/crc32 - bring in line with generic CRC32 2015-05-07 11:16:24 +08:00
ghash-ce-core.S arm64/crypto: improve performance of GHASH algorithm 2014-06-18 12:40:54 +01:00
ghash-ce-glue.c arm64/crypto: improve performance of GHASH algorithm 2014-06-18 12:40:54 +01:00
sha1-ce-core.S crypto: arm64/sha1-ce - move SHA-1 ARMv8 implementation to base layer 2015-04-10 21:39:46 +08:00
sha1-ce-glue.c crypto: arm64/sha1-ce - prevent asm code finalization in final() path 2015-05-07 11:16:25 +08:00
sha2-ce-core.S crypto: arm64/sha2-ce - move SHA-224/256 ARMv8 implementation to base layer 2015-04-10 21:39:46 +08:00
sha2-ce-glue.c crypto: arm64/sha2-ce - prevent asm code finalization in final() path 2015-05-07 11:16:26 +08:00