Skip to content

Fix benchmark guard macros#418

Open
miyazakh wants to merge 5 commits into
wolfSSL:mainfrom
miyazakh:bench_no_mldsa87_guard
Open

Fix benchmark guard macros#418
miyazakh wants to merge 5 commits into
wolfSSL:mainfrom
miyazakh:bench_no_mldsa87_guard

Conversation

@miyazakh

@miyazakh miyazakh commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

Fix benchmark guard macros

Summary

  • Fix incorrect preprocessor guard for ML-DSA 87 benchmark functions in wh_bench_mod_mldsa.c
  • Add missing WOLFHSM_CFG_ENABLE_SERVER guard around wh_Bench_ServerCfgLoop() in wh_bench.c

Changes

File Description
benchmark/bench_modules/wh_bench_mod_mldsa.c Replace incorrect guard WOLFSSL_MLDSA_NO_SIGN with WOLFSSL_NO_ML_DSA_87 for ML-DSA 87 benchmark section
benchmark/wh_bench.c Wrap wh_Bench_ServerCfgLoop() with #if defined(WOLFHSM_CFG_ENABLE_SERVER) guard

Details

Fix typo in ML-DSA 87 guard (wh_bench_mod_mldsa.c)

The wrong macro WOLFSSL_MLDSA_NO_SIGN was used to guard the ML-DSA 87 benchmark section. The correct macro is WOLFSSL_NO_ML_DSA_87, consistent with the guards used for ML-DSA 44 and ML-DSA 65 in the same file.

  • Before: #if !defined(WOLFSSL_MLDSA_NO_SIGN)
  • After: #if !defined(WOLFSSL_NO_ML_DSA_87)

Without this fix, defining WOLFSSL_NO_ML_DSA_87 to disable ML-DSA 87 support would not exclude the corresponding benchmark functions from compilation.

Guard server benchmark loop (wh_bench.c)

wh_Bench_ServerCfgLoop() uses server APIs (wh_Server_Init, wh_Server_HandleRequestMessage, etc.) and must not be compiled in configurations where server support is disabled. A stub implementation is provided under #else so that callers such as _whBenchServerTask() link cleanly without server support.

  • Before: No guard
  • After: Full implementation wrapped with #if defined(WOLFHSM_CFG_ENABLE_SERVER); stub (returns WH_ERROR_OK) provided under #else

Impact

  • No logic changes; preprocessor guard fixes only.
  • Builds with WOLFSSL_NO_ML_DSA_87 will now correctly exclude ML-DSA 87 benchmark functions.
  • Builds without WOLFHSM_CFG_ENABLE_SERVER will now link cleanly via the stub implementation.

@miyazakh miyazakh self-assigned this Jun 23, 2026
Copilot AI review requested due to automatic review settings June 23, 2026 21:52

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 the preprocessor guard that controls compilation of the ML-DSA 87 benchmark functions so it correctly honors the WOLFSSL_NO_ML_DSA_87 feature-disable macro (consistent with the ML-DSA 44/65 benchmark sections and benchmark/wh_bench.c’s registration guards).

Changes:

  • Replace #if !defined(WOLFSSL_MLDSA_NO_SIGN) with #if !defined(WOLFSSL_NO_ML_DSA_87) at the start of the ML-DSA 87 benchmark section.
  • Align the ML-DSA 87 section’s opening guard with its existing #endif /* !defined(WOLFSSL_NO_ML_DSA_87) */ and with other code that references ML-DSA 87.

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

@miyazakh miyazakh changed the title Fixes a typo in the preprocessor guard for NO_ML_DSA_87 Fix benchmark guard macros Jun 24, 2026
@miyazakh miyazakh requested a review from Copilot June 24, 2026 05:34

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

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

Comment thread benchmark/wh_bench.c
@miyazakh miyazakh marked this pull request as draft June 24, 2026 05:41

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

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

Comment thread benchmark/wh_bench.c Outdated

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

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

Comment thread benchmark/wh_bench.c Outdated

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

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

Comment thread benchmark/wh_bench.h
Comment thread benchmark/wh_bench.c
Comment thread benchmark/wh_bench.c
@miyazakh miyazakh assigned wolfSSL-Bot and unassigned miyazakh Jun 25, 2026
@miyazakh miyazakh marked this pull request as ready for review June 25, 2026 01:32
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