diff mbox

[1/2] arm64/crypto: fix data corruption bug in GHASH algorithm

Message ID 1402912936-9137-1-git-send-email-ard.biesheuvel@linaro.org
State Accepted
Commit 6aa8b209f5ef3610d470c519ddd6e6b47e9f6248
Headers show

Commit Message

Ard Biesheuvel June 16, 2014, 10:02 a.m. UTC
This fixes a bug in the GHASH algorithm resulting in the calculated hash to be
incorrect if the input is presented in chunks whose size is not a multiple of
16 bytes.

Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Fixes: fdd2389457b2 ("arm64/crypto: GHASH secure hash using ARMv8 Crypto Extensions")
---
 arch/arm64/crypto/ghash-ce-glue.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Catalin Marinas June 18, 2014, 9:46 a.m. UTC | #1
On Mon, Jun 16, 2014 at 11:02:15AM +0100, Ard Biesheuvel wrote:
> This fixes a bug in the GHASH algorithm resulting in the calculated hash to be
> incorrect if the input is presented in chunks whose size is not a multiple of
> 16 bytes.
> 
> Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
> Fixes: fdd2389457b2 ("arm64/crypto: GHASH secure hash using ARMv8 Crypto Extensions")

Both applied. Thanks.
diff mbox

Patch

diff --git a/arch/arm64/crypto/ghash-ce-glue.c b/arch/arm64/crypto/ghash-ce-glue.c
index b92baf3f68c7..ef6aa69c4e0c 100644
--- a/arch/arm64/crypto/ghash-ce-glue.c
+++ b/arch/arm64/crypto/ghash-ce-glue.c
@@ -72,6 +72,7 @@  static int ghash_update(struct shash_desc *desc, const u8 *src,
 				   partial ? ctx->buf : NULL);
 		kernel_neon_end();
 		src += blocks * GHASH_BLOCK_SIZE;
+		partial = 0;
 	}
 	if (len)
 		memcpy(ctx->buf + partial, src, len);