This bug fix brings into parity the offset for the sums of 3 polynomials for 
ML-KEM AArch64 intrinsics with Java and x86_64 intrinsics.  By offsetting by 
`2*q` instead of `q`, this fix guarantees that the sum will be greater than 
`-q`, which aligns with output ranges [0, q) as commented in methods such as 
`mlKemAddPoly()`.  After Barrett reduction, `-q` is reduced out of range to 
`q`. 

---------
- [X] I confirm that I make this contribution in accordance with the [OpenJDK 
Interim AI Policy](https://openjdk.org/legal/ai).

-------------

Commit messages:
 - 8398806: Mismatch between ML-KEM's AddPoly_3 output range for AArch64 
intrinsics vs. Java

Changes: https://git.openjdk.org/jdk/pull/34178/files
  Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=34178&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8398806
  Stats: 2 lines in 1 file changed: 2 ins; 0 del; 0 mod
  Patch: https://git.openjdk.org/jdk/pull/34178.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/34178/head:pull/34178

PR: https://git.openjdk.org/jdk/pull/34178

Reply via email to