Skip to content

Add Vorago VA416x0 hardware TRNG support#10671

Open
dgarske wants to merge 1 commit into
wolfSSL:masterfrom
dgarske:va416xx_trng
Open

Add Vorago VA416x0 hardware TRNG support#10671
dgarske wants to merge 1 commit into
wolfSSL:masterfrom
dgarske:va416xx_trng

Conversation

@dgarske

@dgarske dgarske commented Jun 11, 2026

Copy link
Copy Markdown
Member

Add Vorago VA416x0 hardware TRNG support

Adds a wc_GenerateSeed() implementation for the Vorago VA416x0 (Cortex-M4F) on-chip True Random Number Generator, gated by a new WOLFSSL_VA416X0_TRNG build macro. The TRNG is an Arm CryptoCell-style entropy block (192-bit EHR, ring-oscillator source, Von-Neumann / CRNGT / autocorrelation health tests), accessed register-only via the VA416xx SDK (va416xx.h); no SDK HAL driver exists for it.

Because the TRNG produces only ~1.25 kb/s of entropy, it is used as a seed source for the SP800-90A Hash-DRBG (keep HAVE_HASHDRBG on), not for bulk generation.

Usage

#define WOLFSSL_VA416X0_TRNG   /* in user_settings.h; needs va416xx.h on the include path */

Optional tuning defines (with defaults): WOLFSSL_VA416X0_TRNG_SAMPLE_CNT (1000), WOLFSSL_VA416X0_TRNG_MAX_RETRY (10), WOLFSSL_VA416X0_TRNG_TIMEOUT (1000000).

Notes

  • Releases the TRNG from PERIPHERAL_RESET (active-low) before use; without this, all TRNG register writes are silently ignored.
  • Health tests stay enabled: a health-test error re-collects up to MAX_RETRY times; a per-block poll cap returns RNG_FAILURE_E instead of hanging.
  • Seed material is scrubbed from the stack with ForceZero().

Testing

Validated on the VA416XX EVK (J-Link/SWD) via the wolfBoot test-app with WOLFCRYPT_TEST=1: wolfCrypt RANDOM test passed! (DRBG instantiate + SP800-90A health checks), alongside the SHA and ECC self-tests.

@dgarske dgarske self-assigned this Jun 11, 2026
Copilot AI review requested due to automatic review settings June 11, 2026 23:42

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

Note

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

Adds a new hardware-entropy backend for Vorago VA416x0 by implementing wc_GenerateSeed() using the on-chip TRNG, gated behind WOLFSSL_VA416X0_TRNG, and documents the new build macro.

Changes:

  • Add a VA416x0 TRNG-based wc_GenerateSeed() implementation with retry/timeout behavior and stack scrubbing.
  • Document the new WOLFSSL_VA416X0_TRNG macro in random.c and register it in .wolfssl_known_macro_extras.

Reviewed changes

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

File Description
wolfcrypt/src/random.c Adds the VA416x0 TRNG seed generator implementation and documents the new macro/tuning defines.
.wolfssl_known_macro_extras Adds WOLFSSL_VA416X0_TRNG to the known macro list (and also removes two existing macros in the same hunk).

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

Comment thread wolfcrypt/src/random.c Outdated
Comment thread wolfcrypt/src/random.c
Comment thread wolfcrypt/src/random.c
Comment thread .wolfssl_known_macro_extras
@dgarske dgarske requested a review from Copilot June 12, 2026 00:11
@dgarske dgarske marked this pull request as draft June 12, 2026 00:11

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 3 comments.

Comment thread wolfcrypt/src/random.c
Comment thread wolfcrypt/src/random.c Outdated
Comment thread wolfcrypt/src/random.c Outdated
@dgarske dgarske marked this pull request as ready for review July 10, 2026 20:08
@github-actions

Copy link
Copy Markdown

retest this please

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 no new comments.

@dgarske dgarske removed their assignment Jul 10, 2026
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