From ffc7a435e5ec70425d39d76f29d5442c01dc58dc Mon Sep 17 00:00:00 2001 From: John Bland Date: Tue, 22 Aug 2023 21:44:31 -0400 Subject: [PATCH] add powerfail during final sector erase, exposing the problems of losing the encryption key when the power fails before the key can be written back, failing to select the correct NVM_FLASH_WRITEONCE sector when a sector is corrupt, and losing the testing state when the power fails before the partition state can be set. these issues are addressed in the next commit --- tools/scripts/sim-update-powerfail-resume.sh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tools/scripts/sim-update-powerfail-resume.sh b/tools/scripts/sim-update-powerfail-resume.sh index e3980d03..3c2d71e6 100755 --- a/tools/scripts/sim-update-powerfail-resume.sh +++ b/tools/scripts/sim-update-powerfail-resume.sh @@ -9,6 +9,9 @@ fi ./wolfboot.elf powerfail 15000 get_version 2>/dev/null ./wolfboot.elf powerfail 18000 get_version 2>/dev/null ./wolfboot.elf powerfail 1a000 get_version 2>/dev/null +# fail on the last sector to stop the encrypt key save and state update +./wolfboot.elf powerfail 3e000 get_version 2>/dev/null +./wolfboot.elf powerfail 3f000 get_version 2>/dev/null V=`./wolfboot.elf get_version 2>/dev/null` if [ "x$V" != "x2" ]; then @@ -20,6 +23,8 @@ fi ./wolfboot.elf powerfail 11000 get_version 2>/dev/null ./wolfboot.elf powerfail 14000 get_version 2>/dev/null ./wolfboot.elf powerfail 1e000 get_version 2>/dev/null +./wolfboot.elf powerfail 3e000 get_version 2>/dev/null +./wolfboot.elf powerfail 3f000 get_version 2>/dev/null V=`./wolfboot.elf get_version 2>/dev/null` if [ "x$V" != "x1" ]; then