Skip to content

Async crypto: RNG#344

Open
bigbrett wants to merge 1 commit intowolfSSL:mainfrom
bigbrett:async-crypto-rng
Open

Async crypto: RNG#344
bigbrett wants to merge 1 commit intowolfSSL:mainfrom
bigbrett:async-crypto-rng

Conversation

@bigbrett
Copy link
Copy Markdown
Contributor

@bigbrett bigbrett commented Apr 22, 2026

Async support for RNG.

  • Adds the non-blocking Request() / Response() split to RNG generate, following the pattern established by the SHA async PR.
  • Blocking wh_Client_RngGenerate{,Dma} are retained as thin wrappers over the new primitives, so existing callers (including the wolfCrypt RNG callback path) are unchanged.

Copy link
Copy Markdown

@wolfSSL-Fenrir-bot wolfSSL-Fenrir-bot left a comment

Choose a reason for hiding this comment

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

Fenrir Automated Review — PR #344

Scan targets checked: wolfhsm-crypto-bugs, wolfhsm-src

Findings: 1
1 finding(s) posted as inline comments (see file-level comments below)

This review was generated automatically by Fenrir. Findings are non-blocking.

Comment thread src/wh_client_crypto.c Outdated
Copy link
Copy Markdown
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

Note

Copilot was unable to run its full agentic suite in this review.

Adds asynchronous (split Request/Response) APIs for RNG generation, including a DMA variant, and updates docs/tests to cover the new async behavior.

Changes:

  • Introduces async RNG Request/Response APIs (non-DMA and DMA) and refactors blocking wrappers to use them.
  • Defines a max inline RNG payload size for single comm-buffer replies and documents caller-driven chunking.
  • Extends crypto tests to directly exercise async RNG flows (including DMA).

Reviewed changes

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

Show a summary per file
File Description
wolfhsm/wh_message_crypto.h Adds inline payload size cap macro for RNG responses.
wolfhsm/wh_client_crypto.h Declares new async RNG APIs and documents usage/constraints.
wolfhsm/wh_client.h Adds per-operation async DMA stash for RNG to support POST cleanup.
src/wh_client_crypto.c Implements async RNG APIs, refactors blocking wrappers; adds DMA async request/response split.
test/wh_test_crypto.c Adds direct async RNG and async DMA RNG tests.
docs/draft/async-crypto.md Documents RNG async design, chunking policy, and API reference.

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

Comment thread wolfhsm/wh_message_crypto.h
Comment thread src/wh_client_crypto.c
Comment thread src/wh_client_crypto.c
Comment thread src/wh_client_crypto.c
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.

6 participants