diff options
author | Ard Biesheuvel <ard.biesheuvel@linaro.org> | 2016-09-13 09:48:52 +0100 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2016-09-30 10:18:34 +0200 |
commit | 9246fd26f99d70c81d3ec90a4b8dece0c2d7b930 (patch) | |
tree | 7a810d0fbd8aa0c9834278fdafa17ceea1ac6b0a /crypto/testmgr.h | |
parent | 3e2d986d8b2f95cfd4c2c0528cff74ce42a4e2a8 (diff) |
crypto: arm/aes-ctr - fix NULL dereference in tail processing
commit f82e90b28654804ab72881d577d87c3d5c65e2bc upstream.
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: 86464859cc77 ("crypto: arm - AES in ECB/CBC/CTR/XTS modes using ARMv8 Crypto Extensions")
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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'crypto/testmgr.h')
0 files changed, 0 insertions, 0 deletions