Skip to content

Figure out which Kyber primitives ML-KEM can reuse #8

Closed

Description

@Zikithezikit

ML-KEM uses the same NTT, Keccak, CBD and polynomial encoding as Kyber, so we shouldn't write them twice. But changing shared code risks changing Kyber output.

  • Go through fips202, ntt, reduce, cbd, poly encoding and compression, and list which ones ML-KEM can use as they are
  • Add a parameter type generic over k (const generic or a trait) for the new code. I don't want a fourth copy of the _512/_768/_1024 functions
  • Leave the legacy code alone apart from moving things around

Done when: the golden vectors from #6 still pass and the PR has a short write-up of what's shared and what isn't.

Depends on: #6. Plan: WP-2.

Part of #3.

Activity

  1. added this to the 2.0.0 milestone on Oct 29, 2026
  2. added
    ml-kemML-KEM (FIPS 203) work
    refactorCode restructuring without behavior change
    on Oct 29, 2026
  3. Zikithezikit commented on Oct 30, 2026

    @Zikithezikit
    OwnerAuthor

    Done in #28, merged into dev-v2. The golden vectors still pass, and the write-up of what is shared and what is not is the module documentation at the top of src/mlkem/mod.rs (summary in the PR description).

    Short version: Keccak, reduce, ntt, cbd2/cbd3, poly_tobytes, Compress/Decompress for d = 1, 4, 5, 10 (and Decompress for 11) and rej_uniform are shared as they are. Not shared: poly_frombytes (no mod q reduction), the legacy d = 11 compression (off by one at 1875 and 3125, logged on #18), poly_frommsg, verify/cmov and poly_getnoise_*. Added: ParamSet, PolyVec, sample_ntt, and an exact Compress_11 for ML-KEM-1024.

    Open findings from this work are on #18. Next is #9.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    ml-kemML-KEM (FIPS 203) workrefactorCode restructuring without behavior change

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions