Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@bigbrett
Copy link
Contributor

@bigbrett bigbrett commented May 8, 2025

Adds a configurable module-based benchmarking framework to wolfHSM. Tested on POSIX and TC3xx.

Consists of:

  • High level driver with module registration
  • benchmark modules that can perform their own specific benchmarks
  • pretty-printed stats reporting

Check out benchmark/README.md for more details and docs.

Future work:

  • Support for WOLFHSM_CFG_NO_CRYPTO
  • SHE benchmark module
  • Figure out more generic or uniform way to handle data buffers and deal with allocation for some algorithms like PQ that are huge

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 introduces a configurable, module‐based benchmarking framework for wolfHSM that supports a variety of cryptographic operations and configurations (including DMA support and SHE extensions). Key changes include the addition of high‐level benchmark drivers and modules, new configuration files to control benchmark parameters, and documentation updates in the benchmark README.

Reviewed Changes

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

File Description
benchmark/wh_bench_data.h Defines benchmark data buffers; contains duplicate macro definitions
benchmark/settings/user_settings.h Contains configuration settings; minor spelling correction needed
benchmark/bench_modules/wh_bench_mod_echo.c Implements the echo benchmark module with potential output formatting improvements
benchmark/others New benchmark modules and corresponding Makefile configurations supporting various crypto operations
Comments suppressed due to low confidence (2)

benchmark/settings/user_settings.h:81

  • Typo in comment: 'unneded' should be corrected to 'unneeded'.
/* Remove unneded namespace */

benchmark/bench_modules/wh_bench_mod_echo.c:80

  • [nitpick] Since the buffers may contain binary data that are not null-terminated, consider printing the output in hexadecimal format rather than as a string to avoid potential misinterpretation of non-printable characters.
WH_BENCH_PRINTF("Echo response mismatch! Expected: %.*s, Received: %.*s\n", send_len, send_buffer, recv_len, recv_buffer);

bigbrett added 2 commits May 8, 2025 09:46
WOLFHSM_CFG_BENCH_CUSTOM_PRINTF and remove from every module file
Copy link
Contributor

@billphipps billphipps left a comment

Choose a reason for hiding this comment

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

Looks really good. A few notes and minor changes. I initially thought we'd be adding benchmarking to wolfHSM-examples, but I do think it should be in the main library. Consider adding a giant compile-time protection to all of the .c files (WH_CFG_HAVE_BENCH or something) to allow directory wildcard inclusion for IDE's.

@bigbrett bigbrett requested a review from billphipps May 12, 2025 22:43
@bigbrett
Copy link
Contributor Author

@billphipps addressed most of your feedback and punted a few things. Please merge if you are okay with it.

@billphipps billphipps merged commit 1754d8a into wolfSSL:main May 13, 2025
3 checks passed
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.

2 participants