]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
crypto: arm64/ghash - Fix incorrect output from ghash-neon
authorEric Biggers <ebiggers@kernel.org>
Tue, 9 Dec 2025 22:34:17 +0000 (14:34 -0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 2 Jan 2026 11:57:27 +0000 (12:57 +0100)
commit f6a458746f905adb7d70e50e8b9383dc9e3fd75f upstream.

Commit 9a7c987fb92b ("crypto: arm64/ghash - Use API partial block
handling") made ghash_finup() pass the wrong buffer to
ghash_do_simd_update().  As a result, ghash-neon now produces incorrect
outputs when the message length isn't divisible by 16 bytes.  Fix this.

(I didn't notice this earlier because this code is reached only on CPUs
that support NEON but not PMULL.  I haven't yet found a way to get
qemu-system-aarch64 to emulate that configuration.)

Fixes: 9a7c987fb92b ("crypto: arm64/ghash - Use API partial block handling")
Cc: stable@vger.kernel.org
Reported-by: Diederik de Haas <diederik@cknow-tech.com>
Closes: https://lore.kernel.org/linux-crypto/DETXT7QI62KE.F3CGH2VWX1SC@cknow-tech.com/
Tested-by: Diederik de Haas <diederik@cknow-tech.com>
Acked-by: Herbert Xu <herbert@gondor.apana.org.au>
Link: https://lore.kernel.org/r/20251209223417.112294-1-ebiggers@kernel.org
Signed-off-by: Eric Biggers <ebiggers@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
arch/arm64/crypto/ghash-ce-glue.c

index 4995b6e2233501b2bb62b48c34eac2b6d35a2a56..9625570dc35359359b826dda727adc88acfaa1af 100644 (file)
@@ -133,7 +133,7 @@ static int ghash_finup(struct shash_desc *desc, const u8 *src,
                u8 buf[GHASH_BLOCK_SIZE] = {};
 
                memcpy(buf, src, len);
-               ghash_do_simd_update(1, ctx->digest, src, key, NULL,
+               ghash_do_simd_update(1, ctx->digest, buf, key, NULL,
                                     pmull_ghash_update_p8);
                memzero_explicit(buf, sizeof(buf));
        }