Fix mcxn build by providing the RNG for TZ_PSA builds#785
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates the test application build and wolfCrypt/wolfSSL user settings to ensure TrustZone PSA (WOLFCRYPT_TZ_PSA) builds on MCX targets (notably mcxn) have a functional RNG source, instead of defaulting to WC_NO_RNG.
Changes:
- Add a PSA-mode RNG hook in
test-app/wcs/user_settings.hby wiringCUSTOM_RAND_GENERATE_BLOCKtohal_trng_get_entropy(). - Adjust
test-app/Makefileso MCX targets only default toTEST_APP_NO_RNG=1when not building withWOLFCRYPT_TZ_PSA=1.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| test-app/wcs/user_settings.h | Adds a PSA-specific CUSTOM_RAND_GENERATE_BLOCK implementation using hal_trng_get_entropy(). |
| test-app/Makefile | Avoids forcing WC_NO_RNG defaults on MCX targets when WOLFCRYPT_TZ_PSA=1 is enabled. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
42a4317 to
90cc1e0
Compare
danielinux
approved these changes
May 26, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes the
nxp_mcxn_tz_psa_testandnxp_mcxn_tz_psa_hw_testbuilds, which started failing after the wolfSSL submodule bump to 5.8.2. The new release added a compile-time check that refusesWC_NO_RNGtogether with any blinding macro (WC_RSA_BLINDING/WOLFSSL_CURVE25519_BLINDING/WOLFSSL_ECC_BLIND_K) — and the MCXN TZ-PSA test-app build was hitting exactly that combination.Changes
test-app/Makefile: stop defaultingTEST_APP_NO_RNG=1formcxnwhenWOLFCRYPT_TZ_PSA=1. The TZ-PSA build already has a PSA-backed entropy source on the NS side (hal_trng_psa.c→psa_generate_random), so there's no reason to force-disable the RNG. The default is unchanged formcxa/mcxwand for the non-PSAmcxnconfigs.test-app/wcs/user_settings.h: whenWOLFCRYPT_TZ_PSAis set, wireCUSTOM_RAND_GENERATE_BLOCKto a thin shim overhal_trng_get_entropy(). This gives wolfCrypt a working RNG without pulling in HASHDRBG, and routes every random byte through the PSA TRNG.Note
I don't have the hardware to test this change