Add hw support for SHA1 and SHA256

pull/765/head
Thomas Cook 2026-03-26 16:56:31 -04:00 committed by Daniele Lacamera
parent 284a1d5eb9
commit 1f99a356e9
4 changed files with 28 additions and 8 deletions

16
arch.mk
View File

@ -1214,9 +1214,11 @@ ifeq ($(TARGET),lpc55s69)
-I$(MCUXPRESSO_DRIVERS)/drivers \
-I$(MCUXPRESSO_DRIVERS)/../periph \
-I$(MCUXPRESSO)/drivers \
-I$(MCUXPRESSO)/drivers/casper \
-I$(MCUXPRESSO)/drivers/common \
-I$(MCUXPRESSO)/drivers/flexcomm \
-I$(MCUXPRESSO)/drivers/flexcomm/usart \
-I$(MCUXPRESSO)/drivers/hashcrypt \
-I$(MCUXPRESSO)/drivers/iap1 \
-I$(MCUXPRESSO)/drivers/lpc_gpio \
-I$(MCUXPRESSO)/drivers/lpc_iocon \
@ -1235,15 +1237,23 @@ ifeq ($(TARGET),lpc55s69)
$(MCUXPRESSO)/drivers/common/fsl_common_arm.o \
$(MCUXPRESSO)/drivers/iap1/fsl_iap.o \
$(MCUXPRESSO)/drivers/lpc_gpio/fsl_gpio.o
ifeq ($(WOLFCRYPT_TZ),1)
OBJS+=$(MCUXPRESSO)/drivers/rng_1/fsl_rng.o
endif
ifeq ($(DEBUG_UART),1)
OBJS+=\
$(MCUXPRESSO_DRIVERS)/drivers/fsl_reset.o \
$(MCUXPRESSO)/drivers/flexcomm/fsl_flexcomm.o \
$(MCUXPRESSO)/drivers/flexcomm/usart/fsl_usart.o
endif
ifeq ($(PKA),1)
CFLAGS+=-DWOLFSSL_NXP_CASPER -DWOLFSSL_NXP_HASHCRYPT
OBJS+=\
$(MCUXPRESSO)/drivers/casper/fsl_casper.o \
$(MCUXPRESSO)/drivers/hashcrypt/fsl_hashcrypt.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
endif
endif
ifeq ($(TARGET),psoc6)

View File

@ -2,7 +2,7 @@ ARCH?=ARM
TZEN?=1
TARGET?=lpc55s69
SIGN?=ECC384
HASH?=SHA384
HASH?=SHA256
MCUXSDK?=1
MCUXPRESSO?=$(PWD)/../NXP/mcuxpresso-sdk/mcuxsdk
MCUXPRESSO_CMSIS?=$(PWD)/../NXP/CMSIS_5/CMSIS

View File

@ -2,7 +2,7 @@ ARCH?=ARM
TZEN?=0
TARGET?=lpc55s69
SIGN?=ECC384
HASH?=SHA384
HASH?=SHA256
MCUXSDK?=1
MCUXPRESSO?=$(PWD)/../NXP/mcuxpresso-sdk/mcuxsdk
MCUXPRESSO_CMSIS?=$(PWD)/../NXP/CMSIS_5/CMSIS

View File

@ -93,17 +93,27 @@ static void hal_flash_fix_ecc(void)
}
}
extern int wc_hashcrypt_init(void);
void hal_init(void)
{
#ifdef __WOLFBOOT
/* lpc55s69 must run < 100 MHz for flash write/erase to work */
BOARD_BootClockFROHF96M();
// BOARD_BootClockPLL150M();
#ifdef DEBUG_UART
# ifdef WOLFSSL_NXP_HASHCRYPT
CLOCK_EnableClock(kCLOCK_HashCrypt);
wc_hashcrypt_init();
# endif
# ifdef DEBUG_UART
uart_init();
uart_write("lpc55s69 init\n", 14);
#endif
#endif
# endif
#endif /* __WOLFBOOT */
#if defined(__WOLFBOOT) || !defined(TZEN)
memset(&pflash, 0, sizeof(pflash));