Skip to content

Fix compiling when WOLFSSH_NO_NISTP256_MLKEM768_SHA256 is defined.#887

Open
tjko wants to merge 1 commit intowolfSSL:masterfrom
tjko:mlkem_fix
Open

Fix compiling when WOLFSSH_NO_NISTP256_MLKEM768_SHA256 is defined.#887
tjko wants to merge 1 commit intowolfSSL:masterfrom
tjko:mlkem_fix

Conversation

@tjko
Copy link
Contributor

@tjko tjko commented Mar 5, 2026

See #886

Copilot AI review requested due to automatic review settings March 5, 2026 06:59
@wolfSSL-Bot
Copy link

Can one of the admins verify this patch?

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

Fixes a compile-time guard so KEXKEM message IDs remain available when only one of the ML-KEM768 SHA256 KEX variants is enabled (e.g., NIST P-256 disabled but Curve25519 still enabled), addressing build failures reported in #886.

Changes:

  • Update #ifndef WOLFSSH_NO_NISTP256_MLKEM768_SHA256 to a combined preprocessor condition that accounts for both NISTP256 and Curve25519 ML-KEM768 SHA256 KEX options.
  • Apply the same guard update for both MSGID_KEXKEM_INIT and MSGID_KEXKEM_REPLY.

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

Comment on lines +1226 to +1227
#if !defined(WOLFSSH_NO_NISTP256_MLKEM768_SHA256) || \
!defined(WOLFSSH_NO_CURVE25519_MLKEM768_SHA256)
Copy link

Copilot AI Mar 5, 2026

Choose a reason for hiding this comment

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

This condition is correct but harder to read/maintain due to the negated OR and line continuation. Consider rewriting it into a more self-explanatory form (e.g., negating a combined defined() expression) or centralizing it behind a single helper macro (e.g., WOLFSSH_HAVE_KEXKEM) to avoid duplicating the same multi-line condition in multiple places.

Copilot uses AI. Check for mistakes.
Comment on lines +1233 to +1234
#if !defined(WOLFSSH_NO_NISTP256_MLKEM768_SHA256) || \
!defined(WOLFSSH_NO_CURVE25519_MLKEM768_SHA256)
Copy link

Copilot AI Mar 5, 2026

Choose a reason for hiding this comment

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

The same combined preprocessor condition is duplicated here. To reduce duplication and the chance of the two guards drifting over time, consider extracting the condition into a single macro (or reusing the same macro suggested above) and referencing it in both locations.

Copilot uses AI. Check for mistakes.
@tjko
Copy link
Contributor Author

tjko commented Mar 5, 2026

Btw, seems like this check should also include WOLFSSH_NO_NISTP384_MLKEM1024_SHA384?

@tjko tjko requested a review from Copilot March 5, 2026 16:40
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.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

@ejohnstown
Copy link
Contributor

Could you remove the two guard checks and then squash the PR?

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.

4 participants