From 9fa6bb3ade3b2a118a6c978292d16517a27b79fa Mon Sep 17 00:00:00 2001 From: John Bland Date: Tue, 15 Aug 2023 17:06:48 -0400 Subject: [PATCH] add combinations of NVM_FLASH_WRITEONCE config tests --- .../workflows/test-powerfail-simulator.yml | 149 ++++++++++++++++-- ...-writeonce-flags-home-invert-update.config | 24 +++ ...ypt-nvm-writeonce-flags-home-update.config | 21 +++ ...sim-nvm-writeonce-flags-home-invert.config | 22 +++ .../sim-nvm-writeonce-flags-home.config | 18 +++ 5 files changed, 225 insertions(+), 9 deletions(-) create mode 100644 config/examples/sim-encrypt-nvm-writeonce-flags-home-invert-update.config create mode 100644 config/examples/sim-encrypt-nvm-writeonce-flags-home-update.config create mode 100644 config/examples/sim-nvm-writeonce-flags-home-invert.config create mode 100644 config/examples/sim-nvm-writeonce-flags-home.config diff --git a/.github/workflows/test-powerfail-simulator.yml b/.github/workflows/test-powerfail-simulator.yml index f1ff2377..5daa9277 100644 --- a/.github/workflows/test-powerfail-simulator.yml +++ b/.github/workflows/test-powerfail-simulator.yml @@ -33,7 +33,7 @@ jobs: - name: Build wolfboot.elf run: | - make && make test-sim-internal-flash-with-update + make clean && make test-sim-internal-flash-with-update - name: Run sunny day update test run: | @@ -41,7 +41,7 @@ jobs: - name: Rebuild wolfboot.elf run: | - make test-sim-internal-flash-with-update + make clean && make test-sim-internal-flash-with-update - name: Run update-revert test run: | @@ -49,13 +49,12 @@ jobs: - name: Rebuild wolfboot.elf run: | - make test-sim-internal-flash-with-update + make clean && make test-sim-internal-flash-with-update - name: Run update-revert test with power failures run: | tools/scripts/sim-update-powerfail-resume.sh - # TEST with NVM_WRITEONCE enabled - name: make clean @@ -76,7 +75,7 @@ jobs: - name: Build wolfboot.elf run: | - make && make test-sim-internal-flash-with-update + make clean && make test-sim-internal-flash-with-update - name: Run sunny day update test (NVM_WRITEONCE) run: | @@ -84,7 +83,7 @@ jobs: - name: Rebuild wolfboot.elf run: | - make test-sim-internal-flash-with-update + make clean && make test-sim-internal-flash-with-update - name: Run update-revert test (NVM_WRITEONCE) run: | @@ -92,12 +91,78 @@ jobs: - name: Rebuild wolfboot.elf run: | - make test-sim-internal-flash-with-update + make clean && make test-sim-internal-flash-with-update - name: Run update-revert test with power failures (NVM_WRITEONCE) run: | tools/scripts/sim-update-powerfail-resume.sh + # TEST with NVM_WRITEONCE AND FLAGS_HOME enabled + + - name: make clean + run: | + make keysclean && make -C tools/keytools clean && rm -f include/target.h + - name: Select config with NVM_WRITEONCE and FLAGS_HOME + run: | + cp config/examples/sim-nvm-writeonce-flags-home.config .config + - name: Build key tools + run: | + make -C tools/keytools + - name: Build bin assemble + run: | + make -C tools/bin-assemble + - name: Build wolfboot.elf + run: | + make clean && make test-sim-internal-flash-with-update + - name: Run sunny day update test (NVM_WRITEONCE FLAGS_HOME) + run: | + tools/scripts/sim-sunnyday-update.sh + - name: Rebuild wolfboot.elf + run: | + make clean && make test-sim-internal-flash-with-update + - name: Run update-revert test (NVM_WRITEONCE FLAGS_HOME) + run: | + tools/scripts/sim-update-fallback.sh + - name: Rebuild wolfboot.elf + run: | + make clean && make test-sim-internal-flash-with-update + - name: Run update-revert test with power failures (NVM_WRITEONCE FLAGS_HOME) + run: | + tools/scripts/sim-update-powerfail-resume.sh + + # TEST with NVM_WRITEONCE AND FLAGS_HOME AND FLAGS_INVERT enabled + + - name: make clean + run: | + make keysclean && make -C tools/keytools clean && rm -f include/target.h + - name: Select config with NVM_WRITEONCE and FLAGS_HOME and FLAGS_INVERT + run: | + cp config/examples/sim-nvm-writeonce-flags-home-invert.config .config + - name: Build key tools + run: | + make -C tools/keytools + - name: Build bin assemble + run: | + make -C tools/bin-assemble + - name: Build wolfboot.elf + run: | + make clean && make test-sim-external-flash-with-update + - name: Run sunny day update test (NVM_WRITEONCE FLAGS_HOME FLAGS_INVERT) + run: | + tools/scripts/sim-sunnyday-update.sh + - name: Rebuild wolfboot.elf + run: | + make clean && make test-sim-external-flash-with-update + - name: Run update-revert test (NVM_WRITEONCE FLAGS_HOME) + run: | + tools/scripts/sim-update-fallback.sh + - name: Rebuild wolfboot.elf + run: | + make clean && make test-sim-external-flash-with-update + - name: Run update-revert test with power failures (NVM_WRITEONCE FLAGS_HOME FLAGS_INVERT) + run: | + tools/scripts/sim-update-powerfail-resume.sh + # TEST with DELTA updates - name: make clean @@ -161,7 +226,7 @@ jobs: - name: Build wolfboot.elf run: | - make test-sim-external-flash-with-enc-update + make clean && make test-sim-external-flash-with-enc-update - name: Run sunny day update test (AES128) run: | @@ -203,7 +268,7 @@ jobs: - name: Build wolfboot.elf run: | - make test-sim-external-flash-with-enc-delta-update + make clean && make test-sim-external-flash-with-enc-delta-update - name: Run sunny day update test (AES128 DELTA) run: | @@ -257,3 +322,69 @@ jobs: - name: Run update-revert test with power failures (AES128 NVM_WRITEONCE) run: | tools/scripts/sim-update-powerfail-resume.sh + + # TEST with encryption (aes128) and NVM_WRITEONCE and FLAGS_HOME + + - name: make clean + run: | + make keysclean && make -C tools/keytools clean && rm -f include/target.h + - name: Select config with encrypted updates + run: | + cp config/examples/sim-encrypt-nvm-writeonce-flags-home-update.config .config + - name: Build key tools + run: | + make -C tools/keytools + - name: Build bin assemble + run: | + make -C tools/bin-assemble + - name: Build wolfboot.elf + run: | + make clean && make test-sim-external-flash-with-enc-update + - name: Run sunny day update test (AES128 NVM_WRITEONCE FLAGS_HOME) + run: | + tools/scripts/sim-sunnyday-update.sh + - name: Rebuild wolfboot.elf + run: | + make clean && make test-sim-external-flash-with-enc-update + - name: Run update-revert test (AES128 NVM_WRITEONCE FLAGS_HOME) + run: | + tools/scripts/sim-update-fallback.sh + - name: Rebuild wolfboot.elf + run: | + make clean && make test-sim-external-flash-with-enc-update + - name: Run update-revert test with power failures (AES128 NVM_WRITEONCE FLAGS_HOME) + run: | + tools/scripts/sim-update-powerfail-resume.sh + + # TEST with encryption (aes128) and NVM_WRITEONCE and FLAGS_HOME and FLAGS_INVERT + + - name: make clean + run: | + make keysclean && make -C tools/keytools clean && rm -f include/target.h + - name: Select config with encrypted updates + run: | + cp config/examples/sim-encrypt-nvm-writeonce-flags-home-invert-update.config .config + - name: Build key tools + run: | + make -C tools/keytools + - name: Build bin assemble + run: | + make -C tools/bin-assemble + - name: Build wolfboot.elf + run: | + make clean && make test-sim-external-flash-with-enc-update + - name: Run sunny day update test (AES128 NVM_WRITEONCE FLAGS_HOME FLAGS_INVERT) + run: | + tools/scripts/sim-sunnyday-update.sh + - name: Rebuild wolfboot.elf + run: | + make clean && make test-sim-external-flash-with-enc-update + - name: Run update-revert test (AES128 NVM_WRITEONCE FLAGS_HOME FLAGS_INVERT) + run: | + tools/scripts/sim-update-fallback.sh + - name: Rebuild wolfboot.elf + run: | + make clean && make test-sim-external-flash-with-enc-update + - name: Run update-revert test with power failures (AES128 NVM_WRITEONCE FLAGS_HOME FLAGS_INVERT) + run: | + tools/scripts/sim-update-powerfail-resume.sh diff --git a/config/examples/sim-encrypt-nvm-writeonce-flags-home-invert-update.config b/config/examples/sim-encrypt-nvm-writeonce-flags-home-invert-update.config new file mode 100644 index 00000000..3a485749 --- /dev/null +++ b/config/examples/sim-encrypt-nvm-writeonce-flags-home-invert-update.config @@ -0,0 +1,24 @@ +ARCH=sim +TARGET=sim +SIGN?=ED25519 +HASH?=SHA256 +WOLFBOOT_SMALL_STACK=1 +SPI_FLASH=0 +EXT_FLASH=1 +ENCRYPT=1 +ENCRYPT_WITH_AES128=1 +DEBUG=1 +# it should be multiple of system page size +NVM_FLASH_WRITEONCE=1 +FLAGS_HOME=1 +ALLOW_DOWNGRADE?=0 +FLAGS_INVERT?=1 +FILL_BYTE?=0x00 +WOLFBOOT_PARTITION_SIZE=0x40000 +WOLFBOOT_SECTOR_SIZE=0x1000 +WOLFBOOT_PARTITION_BOOT_ADDRESS=0x20000 +# if on external flash, it should be multiple of system page size +WOLFBOOT_PARTITION_UPDATE_ADDRESS=0x00000 +WOLFBOOT_PARTITION_SWAP_ADDRESS=0x40000 +# required for keytools +WOLFBOOT_FIXED_PARTITIONS=1 diff --git a/config/examples/sim-encrypt-nvm-writeonce-flags-home-update.config b/config/examples/sim-encrypt-nvm-writeonce-flags-home-update.config new file mode 100644 index 00000000..97d2f439 --- /dev/null +++ b/config/examples/sim-encrypt-nvm-writeonce-flags-home-update.config @@ -0,0 +1,21 @@ +ARCH=sim +TARGET=sim +SIGN?=ED25519 +HASH?=SHA256 +WOLFBOOT_SMALL_STACK=1 +SPI_FLASH=0 +EXT_FLASH=1 +ENCRYPT=1 +ENCRYPT_WITH_AES128=1 +DEBUG=1 +# it should be multiple of system page size +NVM_FLASH_WRITEONCE=1 +FLAGS_HOME=1 +WOLFBOOT_PARTITION_SIZE=0x40000 +WOLFBOOT_SECTOR_SIZE=0x1000 +WOLFBOOT_PARTITION_BOOT_ADDRESS=0x20000 +# if on external flash, it should be multiple of system page size +WOLFBOOT_PARTITION_UPDATE_ADDRESS=0x00000 +WOLFBOOT_PARTITION_SWAP_ADDRESS=0x40000 +# required for keytools +WOLFBOOT_FIXED_PARTITIONS=1 diff --git a/config/examples/sim-nvm-writeonce-flags-home-invert.config b/config/examples/sim-nvm-writeonce-flags-home-invert.config new file mode 100644 index 00000000..6b56e485 --- /dev/null +++ b/config/examples/sim-nvm-writeonce-flags-home-invert.config @@ -0,0 +1,22 @@ +ARCH=sim +TARGET=sim +SIGN?=ED25519 +HASH?=SHA256 +WOLFBOOT_SMALL_STACK=1 +SPI_FLASH=0 +EXT_FLASH=1 +DEBUG=1 +# it should be multiple of system page size +NVM_FLASH_WRITEONCE=1 +FLAGS_HOME=1 +ALLOW_DOWNGRADE?=0 +FLAGS_INVERT?=1 +FILL_BYTE?=0x00 +WOLFBOOT_PARTITION_SIZE=0x40000 +WOLFBOOT_SECTOR_SIZE=0x1000 +WOLFBOOT_PARTITION_BOOT_ADDRESS=0x20000 +# if on external flash, it should be multiple of system page size +WOLFBOOT_PARTITION_UPDATE_ADDRESS=0x00000 +WOLFBOOT_PARTITION_SWAP_ADDRESS=0x40000 +# required for keytools +WOLFBOOT_FIXED_PARTITIONS=1 diff --git a/config/examples/sim-nvm-writeonce-flags-home.config b/config/examples/sim-nvm-writeonce-flags-home.config new file mode 100644 index 00000000..5aebb2d8 --- /dev/null +++ b/config/examples/sim-nvm-writeonce-flags-home.config @@ -0,0 +1,18 @@ +ARCH=sim +TARGET=sim +SIGN?=ED25519 +HASH?=SHA256 +WOLFBOOT_SMALL_STACK=1 +SPI_FLASH=0 +DEBUG=1 +# it should be multiple of system page size +NVM_FLASH_WRITEONCE=1 +FLAGS_HOME=1 +WOLFBOOT_PARTITION_SIZE=0x40000 +WOLFBOOT_SECTOR_SIZE=0x1000 +WOLFBOOT_PARTITION_BOOT_ADDRESS=0x20000 +# if on external flash, it should be multiple of system page size +WOLFBOOT_PARTITION_UPDATE_ADDRESS=0x60000 +WOLFBOOT_PARTITION_SWAP_ADDRESS=0xA0000 +# required for keytools +WOLFBOOT_FIXED_PARTITIONS=1