Skip to content

Commit 55396ed

Browse files
committed
Restore erase in update_trigger.
Caveat: in case of powerfail during wolfBoot_update_trigger, the key previously set may be lost. This is OK assuming that the update process can resume from the previous step in the application (setting the key before triggering the update).
1 parent d313806 commit 55396ed

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

src/libwolfboot.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -754,6 +754,7 @@ void RAMFUNCTION wolfBoot_update_trigger(void)
754754
lastSector -= selSec * WOLFBOOT_SECTOR_SIZE;
755755
XMEMCPY(NVM_CACHE, (uint8_t*)lastSector, WOLFBOOT_SECTOR_SIZE);
756756
/* write to the non selected sector */
757+
hal_flash_erase(lastSector - WOLFBOOT_SECTOR_SIZE * !selSec, WOLFBOOT_SECTOR_SIZE);
757758
hal_flash_write(lastSector - WOLFBOOT_SECTOR_SIZE * !selSec, NVM_CACHE,
758759
WOLFBOOT_SECTOR_SIZE);
759760
/* erase the previously selected sector */

0 commit comments

Comments
 (0)