Commit 820e9cce authored by Roland Mikhel's avatar Roland Mikhel Committed by Dávid Vincze
Browse files

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: default avatarRoland Mikhel <roland.mikhel@arm.com>
Change-Id: I4ac9f332434a95d140c5572096b8a9161db2d217
parent 34d5a691
Loading
Loading
Loading
Loading
+5 −2
Original line number Diff line number Diff line
@@ -1835,8 +1835,11 @@ fn install_image(flash: &mut SimMultiFlash, slot: &SlotInfo, len: ImageSize,
    // 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 {