]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blame - releases/4.19.31/crypto-arm64-aes-ccm-fix-bugs-in-non-neon-fallback-routine.patch
Linux 4.19.31
[thirdparty/kernel/stable-queue.git] / releases / 4.19.31 / crypto-arm64-aes-ccm-fix-bugs-in-non-neon-fallback-routine.patch
CommitLineData
128027b5
GKH
1From 969e2f59d589c15f6aaf306e590dde16f12ea4b3 Mon Sep 17 00:00:00 2001
2From: Ard Biesheuvel <ard.biesheuvel@linaro.org>
3Date: Thu, 24 Jan 2019 17:33:46 +0100
4Subject: crypto: arm64/aes-ccm - fix bugs in non-NEON fallback routine
5
6From: Ard Biesheuvel <ard.biesheuvel@linaro.org>
7
8commit 969e2f59d589c15f6aaf306e590dde16f12ea4b3 upstream.
9
10Commit 5092fcf34908 ("crypto: arm64/aes-ce-ccm: add non-SIMD generic
11fallback") introduced C fallback code to replace the NEON routines
12when invoked from a context where the NEON is not available (i.e.,
13from the context of a softirq taken while the NEON is already being
14used in kernel process context)
15
16Fix two logical flaws in the MAC calculation of the associated data.
17
18Reported-by: Eric Biggers <ebiggers@kernel.org>
19Fixes: 5092fcf34908 ("crypto: arm64/aes-ce-ccm: add non-SIMD generic fallback")
20Cc: stable@vger.kernel.org
21Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
22Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
23Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
24
25---
26 arch/arm64/crypto/aes-ce-ccm-glue.c | 4 +---
27 1 file changed, 1 insertion(+), 3 deletions(-)
28
29--- a/arch/arm64/crypto/aes-ce-ccm-glue.c
30+++ b/arch/arm64/crypto/aes-ce-ccm-glue.c
31@@ -125,7 +125,7 @@ static void ccm_update_mac(struct crypto
32 abytes -= added;
33 }
34
35- while (abytes > AES_BLOCK_SIZE) {
36+ while (abytes >= AES_BLOCK_SIZE) {
37 __aes_arm64_encrypt(key->key_enc, mac, mac,
38 num_rounds(key));
39 crypto_xor(mac, in, AES_BLOCK_SIZE);
40@@ -139,8 +139,6 @@ static void ccm_update_mac(struct crypto
41 num_rounds(key));
42 crypto_xor(mac, in, abytes);
43 *macp = abytes;
44- } else {
45- *macp = 0;
46 }
47 }
48 }