On Wed, 2 Dec 2026 05:34:59 GMT, Shawn Emery <[email protected]> wrote:
>> Volodymyr Paprotski has updated the pull request incrementally with one
>> additional commit since the last revision:
>>
>> comments from Sandhya
>
> test/jdk/sun/security/provider/pqc/ML_KEM_Intrinsic_Test.java line 299:
>
>> 297: addPolyJava.invoke(sum2, a, b, c);
>> 298:
>> 299: if (!Arrays.equals(sum1, sum2)) {
>
> These sums will not be equal on AArch64 systems if intrinsics is used given
> that only `q` is added to the result, whereas in Java `2*q` is added. The
> sums will still be congruent modulo `q` if we want to check for that instead.
>
>
> Secondly, with the broader ranges used by this test suite intrinsics could
> also generate a `-q`. During subsequent Barrett reduction this would be
> reduced to `q`, which would deviate from mlKemAddPoly()'s comments where the
> resulting output is in the range of [0, q). This boundary case would not
> occur in production call paths but is possible and reproducible with the test
> suite's broader input ranges.
>
> I'm leaning towards aligning AArch64 intrinsic with current Java behavior.
> I'll file a bug for this shortly.
Filed: JDK-8398806: Mismatch between ML-KEM's AddPoly_3 output range for
AArch64 intrinsics vs. Java
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/33444#discussion_r4766006170