Skip to content

Commit 42a4317

Browse files
committed
Fix mcxn build by providing the RNG for TZ_PSA builds
1 parent f4d5340 commit 42a4317

2 files changed

Lines changed: 17 additions & 1 deletion

File tree

test-app/Makefile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,9 @@ TARGET?=none
1616
ARCH?=ARM
1717
MCUXPRESSO_CMSIS?=$(MCUXPRESSO)/CMSIS
1818
ifneq (,$(filter $(TARGET),mcxa mcxw mcxn))
19-
TEST_APP_NO_RNG?=1
19+
ifneq ($(WOLFCRYPT_TZ_PSA),1)
20+
TEST_APP_NO_RNG?=1
21+
endif
2022
endif
2123
ifeq ($(TZEN),1)
2224
# wcs directory contains a user_settings.h, which will conflict with

test-app/wcs/user_settings.h

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,20 @@ static inline int wcs_cmse_get_random(unsigned char* output, int sz)
166166
#define CUSTOM_RAND_GENERATE_BLOCK wcs_cmse_get_random
167167
#endif
168168

169+
#ifdef WOLFCRYPT_TZ_PSA
170+
171+
extern int hal_trng_get_entropy(unsigned char *out, unsigned int len);
172+
173+
static inline int wcs_psa_rand_block(unsigned char *output, int sz)
174+
{
175+
if (hal_trng_get_entropy(output, (unsigned int)sz) != 0)
176+
return -1;
177+
return 0;
178+
}
179+
180+
#define CUSTOM_RAND_GENERATE_BLOCK wcs_psa_rand_block
181+
#endif
182+
169183
/* Disable VLAs */
170184
#define WOLFSSL_SP_NO_DYN_STACK
171185

0 commit comments

Comments
 (0)