Replace flash partitioning terminology
This change replaces the slot 0/1 terminology with primary/secondary
slot and replaces FLASH_AREA_IMAGE_0/1 with
FLASH_AREA_IMAGE_PRIMARY/SECONDARY. This naming convention may be more
understandable, fits better to MCUs with multiple images and it is an
architecture agnostic alternative as well.
Change-Id: I655a585f6ae023852c671ee6635399efe25209c9
Signed-off-by: David Vincze <david.vincze@arm.com>
Signed-off-by: David Brown <david.brown@linaro.org>
diff --git a/boot/bootutil/src/image_validate.c b/boot/bootutil/src/image_validate.c
index de2aa0e..9a5fe57 100644
--- a/boot/bootutil/src/image_validate.c
+++ b/boot/bootutil/src/image_validate.c
@@ -70,8 +70,10 @@
}
#ifdef MCUBOOT_ENC_IMAGES
- /* Encrypted images only exist in slot1 */
- if (fap->fa_id == FLASH_AREA_IMAGE_1 && IS_ENCRYPTED(hdr) && !boot_enc_valid(fap)) {
+ /* Encrypted images only exist in the secondary slot */
+ if (fap->fa_id == FLASH_AREA_IMAGE_SECONDARY &&
+ IS_ENCRYPTED(hdr) &&
+ !boot_enc_valid(fap)) {
return -1;
}
#endif
@@ -101,7 +103,9 @@
return rc;
}
#ifdef MCUBOOT_ENC_IMAGES
- if (fap->fa_id == FLASH_AREA_IMAGE_1 && IS_ENCRYPTED(hdr) && off >= hdr_size) {
+ if (fap->fa_id == FLASH_AREA_IMAGE_SECONDARY &&
+ IS_ENCRYPTED(hdr) &&
+ off >= hdr_size) {
blk_off = (off - hdr_size) & 0xf;
boot_encrypt(fap, off - hdr_size, blk_sz, blk_off, tmp_buf);
}