mirror of https://github.com/wolfSSL/wolfBoot.git
Better hook rng into wolfCrypt
parent
f40b01d362
commit
8c6d6e2fc6
11
arch.mk
11
arch.mk
|
|
@ -1244,15 +1244,16 @@ ifeq ($(TARGET),lpc55s69)
|
|||
$(MCUXPRESSO)/drivers/flexcomm/usart/fsl_usart.o
|
||||
endif
|
||||
ifeq ($(PKA),1)
|
||||
CFLAGS+=-DWOLFSSL_NXP_CASPER -DWOLFSSL_NXP_HASHCRYPT
|
||||
CFLAGS+=-DWOLFSSL_NXP_LPC55S69
|
||||
OBJS+=\
|
||||
$(MCUXPRESSO)/drivers/casper/fsl_casper.o \
|
||||
$(MCUXPRESSO)/drivers/hashcrypt/fsl_hashcrypt.o \
|
||||
$(MCUXPRESSO)/drivers/rng_1/fsl_rng.o \
|
||||
$(WOLFBOOT_LIB_WOLFSSL)/wolfcrypt/src/port/nxp/casper_port.o \
|
||||
$(WOLFBOOT_LIB_WOLFSSL)/wolfcrypt/src/port/nxp/hashcrypt_port.o
|
||||
endif
|
||||
ifeq ($(WOLFCRYPT_TZ),1)
|
||||
OBJS+=$(MCUXPRESSO)/drivers/rng_1/fsl_rng.o
|
||||
$(WOLFBOOT_LIB_WOLFSSL)/wolfcrypt/src/port/nxp/hashcrypt_port.o \
|
||||
$(WOLFBOOT_LIB_WOLFSSL)/wolfcrypt/src/port/nxp/rng_port.o
|
||||
else
|
||||
CFLAGS+=-DWOLFSSL_NXP_LPC55S69_NO_HWACCEL
|
||||
endif
|
||||
endif
|
||||
|
||||
|
|
|
|||
|
|
@ -71,6 +71,10 @@ static void hal_sau_init(void)
|
|||
|
||||
static void periph_unsecure(void)
|
||||
{
|
||||
#ifdef WOLFSSL_NXP_RNG_1
|
||||
CLOCK_EnableClock(kCLOCK_Rng);
|
||||
RESET_PeripheralReset(kRNG_RST_SHIFT_RSTn);
|
||||
#endif
|
||||
CLOCK_EnableClock(kCLOCK_Iocon);
|
||||
CLOCK_EnableClock(kCLOCK_Gpio1);
|
||||
}
|
||||
|
|
@ -225,11 +229,13 @@ int RAMFUNCTION hal_flash_erase(uint32_t address, int len)
|
|||
#ifdef WOLFCRYPT_SECURE_MODE
|
||||
void hal_trng_init(void)
|
||||
{
|
||||
#ifdef __WOLFBOOT
|
||||
#ifdef WOLFSSL_NXP_RNG_1
|
||||
# ifdef __WOLFBOOT
|
||||
CLOCK_EnableClock(kCLOCK_Rng);
|
||||
RESET_PeripheralReset(kRNG_RST_SHIFT_RSTn);
|
||||
#endif
|
||||
# endif
|
||||
RNG_Init(RNG);
|
||||
#endif
|
||||
}
|
||||
|
||||
void hal_trng_fini(void)
|
||||
|
|
@ -238,8 +244,10 @@ void hal_trng_fini(void)
|
|||
|
||||
int hal_trng_get_entropy(unsigned char *out, unsigned int len)
|
||||
{
|
||||
#ifdef WOLFSSL_NXP_RNG_1
|
||||
if (RNG_GetRandomData(RNG, out, len) == kStatus_Success)
|
||||
return 0;
|
||||
#endif
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -725,8 +725,17 @@ ifeq ($(TARGET),lpc55s69)
|
|||
$(MCUXPRESSO)/drivers/flexcomm/usart/fsl_usart.o \
|
||||
$(MCUXPRESSO)/drivers/iap1/fsl_iap.o \
|
||||
$(MCUXPRESSO)/drivers/lpc_gpio/fsl_gpio.o
|
||||
ifeq ($(WOLFCRYPT_TZ),1)
|
||||
APP_OBJS+=$(MCUXPRESSO)/drivers/rng_1/fsl_rng.o
|
||||
ifeq ($(PKA),1)
|
||||
CFLAGS+=-DWOLFSSL_NXP_LPC55S69
|
||||
APP_OBJS+=\
|
||||
$(MCUXPRESSO)/drivers/casper/fsl_casper.o \
|
||||
$(MCUXPRESSO)/drivers/hashcrypt/fsl_hashcrypt.o \
|
||||
$(MCUXPRESSO)/drivers/rng_1/fsl_rng.o \
|
||||
$(WOLFBOOT_LIB_WOLFSSL)/wolfcrypt/src/port/nxp/casper_port.o \
|
||||
$(WOLFBOOT_LIB_WOLFSSL)/wolfcrypt/src/port/nxp/hashcrypt_port.o \
|
||||
$(WOLFBOOT_LIB_WOLFSSL)/wolfcrypt/src/port/nxp/rng_port.o
|
||||
else
|
||||
CFLAGS+=-DWOLFSSL_NXP_LPC55S69_NO_HWACCEL
|
||||
endif
|
||||
ifeq (,$(findstring nosys.specs,$(LDFLAGS)))
|
||||
LDFLAGS+=--specs=nosys.specs
|
||||
|
|
|
|||
Loading…
Reference in New Issue