Skip to content

Commit f2d3f00

Browse files
tomchyde-nordic
authored andcommitted
loader: Unify image check API.
Rename boot_image_check(..) to boot_check_image(..). Most of boot APIs use verb as the second part of the function name. The fap and hdr arguments are misleading - they should always point to the same slot. Change the function signature to use slot number instead. Signed-off-by: Tomasz Chyrowicz <tomasz.chyrowicz@nordicsemi.no>
1 parent dcc66e5 commit f2d3f00

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

boot/bootutil/src/loader.c

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -621,16 +621,18 @@ boot_write_status(const struct boot_loader_state *state, struct boot_status *bs)
621621
* Validate image hash/signature and optionally the security counter in a slot.
622622
*/
623623
static fih_ret
624-
boot_image_check(struct boot_loader_state *state, struct image_header *hdr,
625-
const struct flash_area *fap, struct boot_status *bs)
624+
boot_check_image(struct boot_loader_state *state, struct boot_status *bs, int slot)
626625
{
627626
TARGET_STATIC uint8_t tmpbuf[BOOT_TMPBUF_SZ];
628627
int rc;
629628
FIH_DECLARE(fih_rc, FIH_FAILURE);
629+
const struct flash_area *fap = NULL;
630+
struct image_header *hdr;
630631

631-
#if (BOOT_IMAGE_NUMBER == 1)
632-
(void)state;
633-
#endif
632+
fap = BOOT_IMG_AREA(state, slot);
633+
assert(fap != NULL);
634+
635+
hdr = boot_img_hdr(state, slot);
634636

635637
(void)bs;
636638
(void)rc;
@@ -919,7 +921,7 @@ boot_validate_slot(struct boot_loader_state *state, int slot,
919921
BOOT_HOOK_CALL_FIH(boot_image_check_hook, FIH_BOOT_HOOK_REGULAR,
920922
fih_rc, BOOT_CURR_IMG(state), slot);
921923
if (FIH_EQ(fih_rc, FIH_BOOT_HOOK_REGULAR)) {
922-
FIH_CALL(boot_image_check, fih_rc, state, hdr, fap, bs);
924+
FIH_CALL(boot_check_image, fih_rc, state, bs, slot);
923925
}
924926
}
925927
#if defined(MCUBOOT_SWAP_USING_OFFSET)

0 commit comments

Comments
 (0)