linux-stable/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 crypto: arm - ignore generated SHA2 assembly files 2015-07-06 16:32:03 +08:00
aes-armv4.S ARM: convert all "mov.* pc, reg" to "bx reg" for ARMv6+ 2014-07-18 12:29:04 +01:00
aes-ce-core.S crypto: arm/aes - streamline AES-192 code path 2015-05-11 15:08:01 +08:00
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 crypto: prefix module autoloading with "crypto-" 2014-11-24 22:43:57 +08:00
aes_glue.h ARM: move AES typedefs and function prototypes to separate header 2013-10-04 09:26:54 +02:00
aesbs-core.S_shipped crypto: arm/aes update NEON AES module to latest OpenSSL version 2015-03-02 23:18:26 +13:00
aesbs-glue.c crypto: xts - fix compile errors 2016-02-17 15:53:02 +08:00
bsaes-armv7.pl crypto: arm/aes update NEON AES module to latest OpenSSL version 2015-03-02 23:18:26 +13:00
ghash-ce-core.S crypto: arm/ghash - fix big-endian bug in ghash 2015-03-24 22:24:56 +11:00
ghash-ce-glue.c crypto: ghash-ce - Fix cryptd reordering 2016-06-23 18:29:54 +08:00
Kconfig crypto: arm/sha512 - accelerated SHA-512 using ARM generic ASM and NEON 2015-05-11 15:08:01 +08:00
Makefile crypto: arm/sha512 - accelerated SHA-512 using ARM generic ASM and NEON 2015-05-11 15:08:01 +08:00
sha1-armv4-large.S ARM: 7723/1: crypto: sha1-armv4-large.S: fix SP handling 2013-05-22 22:01:35 +01:00
sha1-armv7-neon.S ARM: 8125/1: crypto: enable NEON SHA-1 for big endian 2014-08-27 15:44:11 +01:00
sha1-ce-core.S crypto: arm/sha1-ce - move SHA-1 ARMv8 implementation to base layer 2015-04-10 21:39:44 +08:00
sha1-ce-glue.c crypto: arm/sha1-ce - move SHA-1 ARMv8 implementation to base layer 2015-04-10 21:39:44 +08:00
sha1.h crypto: arm/sha1 - move SHA-1 ARM asm implementation to base layer 2015-04-10 21:39:42 +08:00
sha1_glue.c crypto: arm/sha1 - move SHA-1 ARM asm implementation to base layer 2015-04-10 21:39:42 +08:00
sha1_neon_glue.c crypto: arm/sha1_neon - move SHA-1 NEON implementation to base layer 2015-04-10 21:39:43 +08:00
sha2-ce-core.S crypto: arm/sha2-ce - move SHA-224/256 ARMv8 implementation to base layer 2015-04-10 21:39:45 +08:00
sha2-ce-glue.c crypto: arm/sha2-ce - move SHA-224/256 ARMv8 implementation to base layer 2015-04-10 21:39:45 +08:00
sha256-armv4.pl crypto: arm/sha256 - Add optimized SHA-256/224 2015-04-03 18:03:40 +08:00
sha256-core.S_shipped crypto: arm/sha256 - Add optimized SHA-256/224 2015-04-03 18:03:40 +08:00
sha256_glue.c crypto: arm/sha256 - move SHA-224/256 ASM/NEON implementation to base layer 2015-04-10 21:39:44 +08:00
sha256_glue.h crypto: arm/sha256 - move SHA-224/256 ASM/NEON implementation to base layer 2015-04-10 21:39:44 +08:00
sha256_neon_glue.c crypto: arm/sha256 - move SHA-224/256 ASM/NEON implementation to base layer 2015-04-10 21:39:44 +08:00
sha512-armv4.pl crypto: arm/sha512 - accelerated SHA-512 using ARM generic ASM and NEON 2015-05-11 15:08:01 +08:00
sha512-core.S_shipped crypto: arm/sha512 - accelerated SHA-512 using ARM generic ASM and NEON 2015-05-11 15:08:01 +08:00
sha512-glue.c crypto: arm/sha512 - accelerated SHA-512 using ARM generic ASM and NEON 2015-05-11 15:08:01 +08:00
sha512-neon-glue.c crypto: arm/sha512 - accelerated SHA-512 using ARM generic ASM and NEON 2015-05-11 15:08:01 +08:00
sha512.h crypto: arm/sha512 - accelerated SHA-512 using ARM generic ASM and NEON 2015-05-11 15:08:01 +08:00