linux/arch/arm/crypto
Ard Biesheuvel f82e90b286 crypto: arm/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: 86464859cc ("crypto: arm - AES in ECB/CBC/CTR/XTS modes using ARMv8 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
..
.gitignore
Kconfig
Makefile
aes-armv4.S
aes-ce-core.S
aes-ce-glue.c crypto: arm/aes-ctr - fix NULL dereference in tail processing 2016-09-13 18:44:59 +08:00
aes_glue.c
aes_glue.h
aesbs-core.S_shipped
aesbs-glue.c
bsaes-armv7.pl
ghash-ce-core.S
ghash-ce-glue.c crypto: ghash-ce - Fix cryptd reordering 2016-06-23 18:29:54 +08:00
sha1-armv4-large.S
sha1-armv7-neon.S
sha1-ce-core.S
sha1-ce-glue.c
sha1.h
sha1_glue.c
sha1_neon_glue.c
sha2-ce-core.S
sha2-ce-glue.c
sha256-armv4.pl
sha256-core.S_shipped
sha256_glue.c
sha256_glue.h
sha256_neon_glue.c
sha512-armv4.pl
sha512-core.S_shipped
sha512-glue.c
sha512-neon-glue.c
sha512.h