Skip to content

Commit 480f310

Browse files
committed
Fix regression in encrypted delta updates
1 parent 68ee02d commit 480f310

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/update_flash.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -805,9 +805,11 @@ static int RAMFUNCTION wolfBoot_update(int fallback_allowed)
805805
* (UPDATING) or reverting an older image. */
806806
if (st == IMG_STATE_UPDATING) {
807807
inverse = 0;
808-
}
809-
else {
810-
inverse = 1;
808+
} else {
809+
if (cur_ver < upd_ver)
810+
inverse = 1;
811+
else
812+
inverse = 0;
811813
}
812814
}
813815
}
@@ -820,7 +822,7 @@ static int RAMFUNCTION wolfBoot_update(int fallback_allowed)
820822
#ifdef EXT_FLASH
821823
ext_flash_unlock();
822824
#endif
823-
wolfBoot_set_partition_state(PART_UPDATE, IMG_STATE_UPDATING);
825+
wolfBoot_set_partition_state(PART_UPDATE, IMG_STATE_NEW);
824826
#ifdef EXT_FLASH
825827
ext_flash_lock();
826828
#endif

0 commit comments

Comments
 (0)