sim: fix encryption for ram-load related tests
If ram-load is being used with encryption and
the higher version image is loaded from the primary slot the
verification will fail as the image is always non-encrypted
and will produce an invalid hash. This fix puts encrypted images
into both slots to prevent this issue.
Signed-off-by: Roland Mikhel <roland.mikhel@arm.com>
Change-Id: I4ac9f332434a95d140c5572096b8a9161db2d217
diff --git a/sim/src/image.rs b/sim/src/image.rs
index 9b46ca0..71f2d3c 100644
--- a/sim/src/image.rs
+++ b/sim/src/image.rs
@@ -1835,8 +1835,11 @@
// an encrypted image, re-read to use for verification, erase + flash
// un-encrypted. In the secondary slot the image is written un-encrypted,
// and if encryption is requested, it follows an erase + flash encrypted.
-
- if slot.index == 0 {
+ //
+ // In the case of ram-load when encryption is enabled both slots have to
+ // be encrypted so in the event when the image is in the primary slot
+ // the verification will fail as the image is not encrypted.
+ if slot.index == 0 && !Caps::RamLoad.present() {
let enc_copy: Option<Vec<u8>>;
if is_encrypted {