From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from out-179.mta0.migadu.com (out-179.mta0.migadu.com [91.218.175.179]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 03B57267729 for ; Wed, 10 Dec 2025 09:22:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.179 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765358548; cv=none; b=Q+R2kfgi34vmh33vnx2Yc33e4k5sJCX02wEETij8uBXbMB9cbhyFthvzZiB9AK1DA8j4Iu/aVwESMZAcRQhemwjbAmULcmbdwjLKnP0UfJJYVfrxgEh8GUz+rpUDfsxhoZu83vYlzoX9xn1wckv7Kr7UJCr0eTHyLVJl6nAdDqM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765358548; c=relaxed/simple; bh=xDn6vgH0y+81dV1xaEzoN5dR3FfdGbOvHNtaRBpYzz8=; h=Mime-Version:Content-Type:Date:Message-Id:Subject:From:To:Cc: References:In-Reply-To; b=P5Ra7ayvCIG7AAav648jQP59MgRXzDPkApZ40Tvy/dQfE/0GRC3aYro25p0+H+n9CncGIWOrqI2g+3rQWzPd2GG8ebwjtB/Y69Hdp2QdCYBhEEIWWCVvhCTvQZVTAmYQDAaUWe8RFtqC8ZyVvqrOUgYqCph48kUI0QOjy0zb72g= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=cknow-tech.com; spf=pass smtp.mailfrom=cknow-tech.com; dkim=pass (2048-bit key) header.d=cknow-tech.com header.i=@cknow-tech.com header.b=WRWSPyLe; arc=none smtp.client-ip=91.218.175.179 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=cknow-tech.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=cknow-tech.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=cknow-tech.com header.i=@cknow-tech.com header.b="WRWSPyLe" Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cknow-tech.com; s=key1; t=1765358541; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=PklN9qjVdwXRT0hpbQhT8EuFAzT1yIiMNZYzqBnPsj4=; b=WRWSPyLejzpcnsjbUS08zjmJcLC7hMYcMhs/SL9T6pBBLDpre9306yWY4ZjEpr9h/NvvSR R8lfjIeYm5jwRb+9NMQqme1ADcMJ14BBnEXRTSCA8WUD3g20jXDNuS8TYQW8+WMYrl0XSN rGw6LAcn0QbZQPjeW9wUmrBDEX9gBEDCx2diLWpqH12+PuKUYQmrWNdRUeD1L5x4LG3WZS xIVvfOicoUi7UXQn1EW2NL58PN9XRSthDATP82JQtOodLZjootXhCdaHr7GAvNuZ9A8d4w TysBhi/Rk4lS6OlUG2WCKMTD2hU6Nn37kW5aYYHLqE8XnxKYM05y8lYrvS9hOQ== Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=UTF-8 Date: Wed, 10 Dec 2025 10:22:19 +0100 Message-Id: Subject: Re: [PATCH] crypto: arm64/ghash - Fix incorrect output from ghash-neon X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: "Diederik de Haas" To: "Eric Biggers" , Cc: , "Ard Biesheuvel" , "Jason A . Donenfeld" , "Herbert Xu" , , , "Diederik de Haas" References: <20251209223417.112294-1-ebiggers@kernel.org> In-Reply-To: <20251209223417.112294-1-ebiggers@kernel.org> X-Migadu-Flow: FLOW_OUT On Tue Dec 9, 2025 at 11:34 PM CET, Eric Biggers wrote: > 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 was hoping to not have to do a 'git bisect', but this is much better :-D I can confirm that this patch fixes the error I was seeing, so Tested-by: Diederik de Haas > (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.) https://www.qemu.org/docs/master/system/arm/raspi.html indicates it can emulate various Raspberry Pi models. I've only tested it with RPi 3B+ (bc of its wifi+bt chip), but I wouldn't be surprised if all RPi models would have this problem? Dunno if QEMU emulates that though. Thanks for the quick fix! Cheers, Diederik > Fixes: 9a7c987fb92b ("crypto: arm64/ghash - Use API partial block handlin= g") > Cc: stable@vger.kernel.org > Reported-by: Diederik de Haas > Closes: https://lore.kernel.org/linux-crypto/DETXT7QI62KE.F3CGH2VWX1SC@ck= now-tech.com/ > Signed-off-by: Eric Biggers > --- > > If it's okay, I'd like to just take this via libcrypto-fixes. > > arch/arm64/crypto/ghash-ce-glue.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/arch/arm64/crypto/ghash-ce-glue.c b/arch/arm64/crypto/ghash-= ce-glue.c > index 7951557a285a..ef249d06c92c 100644 > --- a/arch/arm64/crypto/ghash-ce-glue.c > +++ b/arch/arm64/crypto/ghash-ce-glue.c > @@ -131,11 +131,11 @@ static int ghash_finup(struct shash_desc *desc, con= st u8 *src, > =20 > if (len) { > u8 buf[GHASH_BLOCK_SIZE] =3D {}; > =20 > 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)); > } > return ghash_export(desc, dst); > } > > base-commit: 7a3984bbd69055898add0fe22445f99435f33450