1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-12-16 03:18:09 +00:00

Bugfix: Unlock flash when copying sector header.

This commit is contained in:
andrew 2019-01-31 17:52:51 +01:00
parent 840f7461ee
commit 2888c11095

View File

@ -118,9 +118,11 @@ static void erase_sector(uint8_t sector, secbool set_magic)
#if NORCOW_HEADER_LEN > 0
// Copy the sector header back.
ensure(flash_unlock_write(), NULL);
for (uint32_t i = 0; i < NORCOW_HEADER_LEN/sizeof(uint32_t); ++i) {
ensure(flash_write_word(norcow_sectors[sector], i*sizeof(uint32_t), header_backup[i]), NULL);
}
ensure(flash_lock_write(), NULL);
#endif
if (sectrue == set_magic) {