Skip to content

ML-KEM Wconversion fixes#9969

Merged
douzzer merged 1 commit intowolfSSL:masterfrom
Frauschi:mlkem_wconversion
Mar 16, 2026
Merged

ML-KEM Wconversion fixes#9969
douzzer merged 1 commit intowolfSSL:masterfrom
Frauschi:mlkem_wconversion

Conversation

@Frauschi
Copy link
Contributor

Extracted from #9732:

  • fix -Wconversion warnings for ML-KEM C code
  • allow ML-KEM APIs without RNG usage in case WC_NO_RNG is defined

These changes have already been reviewed and approved by @SparkiDev as part of #9732.

@Frauschi Frauschi added the For This Release Release version 5.9.0 label Mar 13, 2026
@Frauschi
Copy link
Contributor Author

Jenkins retest this please

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR improves ML-KEM (Kyber) build/test compatibility under stricter conversion-warning builds and RNG-less configurations by tightening type conversions, adding an ML-KEM configure variant, and adapting tests to run without WC_RNG.

Changes:

  • Add --enable-mlkem coverage (including small and new no-large-code variants) to the wolfCrypt-Wconversion CI workflow.
  • Update ML-KEM implementation code with explicit casts/guards to address -Wconversion-family warnings and add WC_NO_RNG compile-time handling for RNG-dependent APIs.
  • Update mlkem_test() to support WC_NO_RNG by using deterministic “with random” APIs and fixed test vectors.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
wolfcrypt/test/test.c Makes mlkem_test() work when WC_NO_RNG is set by using fixed randomness and *WithRandom APIs.
wolfcrypt/src/wc_mlkem.c Adds WC_NO_RNG guards for RNG-dependent entry points; adds explicit casts to reduce conversion warnings.
wolfcrypt/src/wc_mlkem_poly.c Adds explicit casts and type adjustments to address conversion warnings in polynomial/matrix code paths.
configure.ac Extends --enable-mlkem= comma-options with no-large-code to define WOLFSSL_MLKEM_NO_LARGE_CODE.
.github/workflows/wolfCrypt-Wconversion.yml Expands the conversion-warning CI matrix to include ML-KEM build permutations.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

* fix -Wconversion warnings
* allow APIs without RNG usage in case WC_NO_RNG is defined
@Frauschi Frauschi force-pushed the mlkem_wconversion branch from 8ce6d9d to 3b4e51c Compare March 13, 2026 20:22
@Frauschi
Copy link
Contributor Author

The Copilot issue is fixed now

Copy link
Contributor

@douzzer douzzer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tested with

wolfssl-multi-test.sh ...
'.*all.*Wconversion.*'
'quantum-safe.*clang-tidy.*'
linuxkm-defaults-all-quantum-safe-fips-dev-clang-tidy
linuxkm-defaults-all-quantum-safe-fips-dev-noasm-clang-tidy

with --enable-mlkem added to '.*all.*Wconversion.*' scenarios.

@douzzer douzzer merged commit 416072f into wolfSSL:master Mar 16, 2026
473 of 476 checks passed
@Frauschi Frauschi deleted the mlkem_wconversion branch March 17, 2026 09:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

For This Release Release version 5.9.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants