Skip to content

Conversation

@miyazakh
Copy link
Contributor

@miyazakh miyazakh commented Oct 18, 2025

Add crypto timeout to RNG and AES

The changes add timeout control logic to cryptographic operations under the wolfHSM framework. The modifications allow the client to enforce a maximum allowed time for crypto operations.

Added new callback function pointers to the relevant configuration/context structures to support timeout handling. These callbacks allow the application to provide custom time-related functions, such as:

  • Getting the current time (GetCurrentTime)
  • Checking whether the timeout has expired (CheckTimeout)

When the crypt-timeout feature is enabled, the GetCurrentTime callback must be provided as a user-defined function. If the CheckTimeout callback is not defined, internal default implementation is used.

Added a new build-time configuration macro:

  • WOLFHSM_CFG_ENABLE_CLIENT_CRYPTIMEOUT

This macro enables the client-side cryptographic timeout feature.When enabled, the wolfHSM client checks for timeout conditions during cryptographic operations.

The feature has been added to RNG and AES. It will be extended to the remaining cryptographic algorithms once this PR is approved.

For testing, make CRYPTIMEOUT=1 enables the items in tests/ folder.

@douzzer
Copy link

douzzer commented Oct 31, 2025

@miyazakh conflicts to resolve

@miyazakh
Copy link
Contributor Author

miyazakh commented Nov 2, 2025

resolve conflicts and issues after rebase. Updated based on Copilot’s suggestions

Updated based on Copilot's suggestions
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