Test: BL2: Fix to support encrypted image
This fix applies for boards supporting encrypted image, and
initializing board with an encrypted image in secondary slot.
Change-Id: I2f802e22e6ed581a6cd0110e6ba5dccfc1f1092f
Signed-off-by: Michel Jaouen <michel.jaouen@st.com>
diff --git a/test/bl2/mcuboot/suites/integration/mcuboot_integration_tests.c b/test/bl2/mcuboot/suites/integration/mcuboot_integration_tests.c
index da11fdd..c326fd9 100644
--- a/test/bl2/mcuboot/suites/integration/mcuboot_integration_tests.c
+++ b/test/bl2/mcuboot/suites/integration/mcuboot_integration_tests.c
@@ -156,9 +156,11 @@
} else {
return 0;
}
- } else if (hdr_1.ih_magic == IMAGE_MAGIC) {
+ } else if ((hdr_1.ih_magic == IMAGE_MAGIC) &&
+ !(hdr_1.ih_flags & (IMAGE_F_ENCRYPTED_AES128 | IMAGE_F_ENCRYPTED_AES256))) {
/* Else copy slot 1 to slot 0. We assume that one of the slots has a
- * valid image.
+ * valid image, but if image is valid but encrypted , it cannot be
+ * recopied in primary slot.
*/
*original_image_idx = 1;
rc = copy_image_to_slot(1, 0);
@@ -168,7 +170,7 @@
return 0;
}
} else {
- /* No valid images are loaded, error */
+ /* No valid unencrypted images are loaded, error */
return 1;
}
}