diff --git a/config/examples/lpc55s69-tz.config b/config/examples/lpc55s69-tz.config index ce4b1df3..19b47cc7 100644 --- a/config/examples/lpc55s69-tz.config +++ b/config/examples/lpc55s69-tz.config @@ -31,10 +31,11 @@ FLASH_MULTI_SECTOR_ERASE?=1 WOLFCRYPT_TZ?=1 WOLFCRYPT_TZ_PKCS11?=1 -# 1024-byte sector to accomodate RSA4096 -WOLFBOOT_SECTOR_SIZE?=0x400 +# use 1024-byte sector to accomodate RSA4096 signature +# WOLFBOOT_SECTOR_SIZE?=0x400 +WOLFBOOT_SECTOR_SIZE?=0x200 -# 200KB boot, 80KB keyvault, 8KB NSC, 56KB partitions, 1024 swap +# 200KB boot, 80KB keyvault, 8KB NSC, 56KB partitions, 512/1024 swap WOLFBOOT_KEYVAULT_ADDRESS?=0x10032000 WOLFBOOT_KEYVAULT_SIZE?=0x14000 WOLFBOOT_NSC_ADDRESS?=0x10046000 diff --git a/config/examples/lpc55s69.config b/config/examples/lpc55s69.config index b1446e41..87877738 100644 --- a/config/examples/lpc55s69.config +++ b/config/examples/lpc55s69.config @@ -29,21 +29,22 @@ DUALBANK_SWAP?=0 PKA?=1 FLASH_MULTI_SECTOR_ERASE?=1 -# 1024-byte sector to accomodate RSA4096 -WOLFBOOT_SECTOR_SIZE?=0x400 +# use 1024-byte sector to accomodate RSA4096 signature +# WOLFBOOT_SECTOR_SIZE?=0x400 +WOLFBOOT_SECTOR_SIZE?=0x200 # Default configuration -# 40KB boot, 44KB partitions, 1024 swap -#WOLFBOOT_PARTITION_SIZE?=0xB000 -#WOLFBOOT_PARTITION_BOOT_ADDRESS?=0xD000 -#WOLFBOOT_PARTITION_UPDATE_ADDRESS?=0x18000 -#WOLFBOOT_PARTITION_SWAP_ADDRESS?=0x23000 +# 44KB boot, 52KB partitions, 512/1024 swap +WOLFBOOT_PARTITION_SIZE?=0xB000 +WOLFBOOT_PARTITION_BOOT_ADDRESS?=0xD000 +WOLFBOOT_PARTITION_UPDATE_ADDRESS?=0x18000 +WOLFBOOT_PARTITION_SWAP_ADDRESS?=0x23000 # use these for test/benchmark -WOLFBOOT_PARTITION_SIZE?=0x26000 -WOLFBOOT_PARTITION_BOOT_ADDRESS?=0x10000 -WOLFBOOT_PARTITION_UPDATE_ADDRESS?=0x36000 -WOLFBOOT_PARTITION_SWAP_ADDRESS?=0x5C000 +#WOLFBOOT_PARTITION_SIZE?=0x2b000 +#WOLFBOOT_PARTITION_BOOT_ADDRESS?=0x10000 +#WOLFBOOT_PARTITION_UPDATE_ADDRESS?=0x3b000 +#WOLFBOOT_PARTITION_SWAP_ADDRESS?=0x66000 -WOLFCRYPT_TEST?=1 -WOLFCRYPT_BENCHMARK?=1 +#WOLFCRYPT_TEST?=1 +#WOLFCRYPT_BENCHMARK?=1 diff --git a/include/user_settings.h b/include/user_settings.h index 56715fec..aee60869 100644 --- a/include/user_settings.h +++ b/include/user_settings.h @@ -505,13 +505,17 @@ extern int tolower(int c); #define CUSTOM_RAND_GENERATE_BLOCK my_rng_seed_gen extern int my_rng_seed_gen(unsigned char* output, unsigned int sz); #endif - + #define HAVE_AESGCM #define GCM_TABLE - #define HAVE_AES_ECB - #define WOLFSSL_AES_OFB - #define WOLFSSL_AES_CFB - #define WOLFSSL_AES_COUNTER + + #if defined(WOLFSSL_NXP_LPC55S69) || defined(WOLFSSL_NXP_LPC55S69_NO_HWACCEL) + #define HAVE_AES_ECB + #define WOLFSSL_AES_OFB + #define WOLFSSL_AES_CFB + #define WOLFSSL_AES_COUNTER + #define WOLFSSL_STATIC_MEMORY_TEST_SZ (30 * 1024) + #endif #else #define HAVE_HASHDRBG #define WOLFSSL_AES_CFB diff --git a/test-app/ARM-lpc55s69.ld b/test-app/ARM-lpc55s69.ld index 959c5699..078c125e 100644 --- a/test-app/ARM-lpc55s69.ld +++ b/test-app/ARM-lpc55s69.ld @@ -1,10 +1,10 @@ -_Min_Heap_Size = 0x00008000; /* minimal heap (not using malloc) */ +_Min_Heap_Size = 0x00000100; /* minimal heap (not using malloc) */ _Min_Stack_Size = 0x00008000; /* required amount of stack */ MEMORY { FLASH (rx) : ORIGIN = @WOLFBOOT_TEST_APP_ADDRESS@, LENGTH = @WOLFBOOT_TEST_APP_SIZE@ - RAM (rwx) : ORIGIN = 0x20020000, LENGTH = 96K + RAM (rwx) : ORIGIN = 0x20020000, LENGTH = 160K } SECTIONS diff --git a/test-app/Makefile b/test-app/Makefile index 3ef95a11..6c31ebc6 100644 --- a/test-app/Makefile +++ b/test-app/Makefile @@ -182,6 +182,9 @@ ifeq ($(WOLFCRYPT_SUPPORT),1) # Add SP C math (all architectures) APP_OBJS+=$(WOLFBOOT_LIB_WOLFSSL)/wolfcrypt/src/sp_c32.o + # Add RSA support (needed by test suite) + APP_OBJS+=$(WOLFBOOT_LIB_WOLFSSL)/wolfcrypt/src/rsa.o + ifneq ($(NO_ASM),1) # SP Cortex M ifneq ($(filter ARM ARM_BE,$(ARCH)),) @@ -738,10 +741,8 @@ ifeq ($(TARGET),lpc55s69) else CFLAGS+=-DWOLFSSL_NXP_LPC55S69_NO_HWACCEL endif - LIBS+=--specs=nano.specs - ifneq ($(WOLFCRYPT_SUPPORT),1) - # Only use nosys stubs when not providing our own syscalls - LDFLAGS+=--specs=nosys.specs + ifeq ($(WOLFCRYPT_SUPPORT),1) + LIBS+=--specs=nano.specs endif ifeq ($(WOLFCRYPT_BENCHMARK),1) # Benchmark needs float printf for results diff --git a/test-app/app_lpc55s69.c b/test-app/app_lpc55s69.c index 766d7ca5..c64df98b 100644 --- a/test-app/app_lpc55s69.c +++ b/test-app/app_lpc55s69.c @@ -133,9 +133,11 @@ void main(void) uint8_t boot_state, update_state; hal_init(); - systick_init(); leds_init(); +#ifndef TZEN + systick_init(); __enable_irq(); +#endif wolfBoot_printf("\n==================================\n"); wolfBoot_printf("LPC55S69 wolfBoot demo Application\n"); @@ -205,63 +207,69 @@ void main(void) } -// #include "sys/stat.h" -// int _getpid(void) -// { -// return 1; -// } +#include "sys/stat.h" +int WEAKFUNCTION _getpid(void) +{ + return 1; +} -// int _kill(int pid, int sig) -// { -// (void)pid; -// (void)sig; -// return -1; -// } +int WEAKFUNCTION _kill(int pid, int sig) +{ + (void)pid; + (void)sig; + return -1; +} -// void _exit(int status) -// { -// _kill(status, -1); -// while (1) {} -// } +void WEAKFUNCTION _exit(int status) +{ + _kill(status, -1); + while (1) {} +} -// int _read(int file, char *ptr, int len) -// { -// (void)file; -// (void)ptr; -// (void)len; -// return -1; -// } +int WEAKFUNCTION _read(int file, char *ptr, int len) +{ + (void)file; + (void)ptr; + (void)len; + return -1; +} -// int _write(int file, char *ptr, int len) -// { -// (void)file; -// (void)ptr; -// return len; -// } +int WEAKFUNCTION _write(int file, char *ptr, int len) +{ + (void)file; + (void)ptr; + return len; +} -// int _close(int file) -// { -// (void)file; -// return -1; -// } +int WEAKFUNCTION _close(int file) +{ + (void)file; + return -1; +} -// int _isatty(int file) -// { -// (void)file; -// return 1; -// } +int WEAKFUNCTION _isatty(int file) +{ + (void)file; + return 1; +} -// int _lseek(int file, int ptr, int dir) -// { -// (void)file; -// (void)ptr; -// (void)dir; -// return 0; -// } +int WEAKFUNCTION _lseek(int file, int ptr, int dir) +{ + (void)file; + (void)ptr; + (void)dir; + return 0; +} -// int _fstat(int file, struct stat *st) -// { -// (void)file; -// st->st_mode = S_IFCHR; -// return 0; -// } +int WEAKFUNCTION _fstat(int file, struct stat *st) +{ + (void)file; + st->st_mode = S_IFCHR; + return 0; +} + +void WEAKFUNCTION *_sbrk(int incr) +{ + (void)incr; + return 0; +}