Skip to content

KEX Fix#889

Open
ejohnstown wants to merge 1 commit intowolfSSL:masterfrom
ejohnstown:kex-fix
Open

KEX Fix#889
ejohnstown wants to merge 1 commit intowolfSSL:masterfrom
ejohnstown:kex-fix

Conversation

@ejohnstown
Copy link
Contributor

  1. When disabling mlkem768nistp256-sha256, there's a crash when doing a mlkem768x25519-sha256 KEX. It tries to do a DH key exchange instead of x25519 with ML-KEM. Modified the check.
  2. Fixed a guard where the build was treating not having mlkem768nistp256-sha256 like a FIPS build disallowing using ML-KEM when generating sesssion keys. It shouldn't make that check.
  3. Added a test case to the KEM test.

1. When disabling mlkem768nistp256-sha256, there's a crash when doing a
   mlkem768x25519-sha256 KEX. It tries to do a DH key exchange instead
   of x25519 with ML-KEM. Modified the check.
2. Fixed a guard where the build was treating not having
   mlkem768nistp256-sha256 like a FIPS build disallowing using ML-KEM
   when generating sesssion keys. It shouldn't make that check.
3. Added a test case to the KEM test.
Copy link

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 fixes two bugs related to ML-KEM key exchange (KEX) handling in wolfSSH and adds a corresponding test case.

Changes:

  • Fixed a crash when performing mlkem768x25519-sha256 KEX while mlkem768nistp256-sha256 is disabled, by replacing a complex negated condition with a direct useDh flag check.
  • Removed an incorrect guard in GenerateKey that was treating the absence of WOLFSSH_NO_NISTP256_MLKEM768_SHA256 like a FIPS build, preventing ML-KEM session key generation.
  • Added a test case for the mlkem768nistp256-sha256 KEX algorithm.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
src/internal.c Fixes the flawed DH condition check and the incorrect GenerateKey preprocessor guard
tests/kex.c Adds a test case for mlkem768nistp256-sha256 KEX

💡 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.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants