[PATCH v3 1/2] lib/crypto: arm64: Fix lost Poly1305 carry when resuming NEON state
Eric Biggers
ebiggers at kernel.org
Fri Oct 9 09:13:28 PDT 2026
On Fri, Oct 09, 2026 at 02:53:53PM +0200, Eric Biggers wrote:
> represents 2^128 + 4, so the conversion must produce the base 2^64 limbs
> h0 = 4, h1 = 0, h2 = 1. The low 64-bit word sums to 2^64 + 4 and the
> middle 64-bit word (including the carry from the low word) sums to 2^64,
> so both carry out. However, the carry out of the middle word goes to
> d2, leaving h2 = 0 and the value 4 instead of 2^128 + 4.
Going to change it to this instead, which should be clearer:
represents 4 + 2^26*2^26 + (2^26-1)*2^52 + (2^26-1)*2^78 +
(2^24-1)*2^104 = 2^128 + 4, despite the bit representing the 2^128
term (bit 24 of h4) not being set; the extra comes from the h1 limb
being above the normal base 2^26 range. When this value is
converted into the non-redundant base 2^64 form, a carry into the
new 2^128 bit (in bit 0 of h2) is necessary to preserve the value.
> [EB: Rewrote the commit message to more clearly describe the bug and
> its impact, and removed a lot of pointless LLM-generated text.]
Changed to
[EB: Rewrote the commit message to more clearly describe the bug and
its impact, and simplified explanation about why there's a carry bit.]
since Jérémy said it actually wasn't LLM generated.
- Eric
More information about the linux-arm-kernel
mailing list