Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions boot/bootutil/src/loader_manifest_xip.c
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,20 @@ boot_validate_slot(struct boot_loader_state *state, int slot,
FIH_RET(fih_rc);
}

#ifdef MCUBOOT_HW_ROLLBACK_PROT
/**
* Checks if the specified image should have a security counter present on it or not
*
* @param image_index Index of the image to check.
*
* @return true if security counter should be present; false if otherwise
*/
fih_ret boot_nv_image_should_have_security_counter(uint32_t image_index)
{
return FIH_SUCCESS;
}
#endif /* MCUBOOT_HW_ROLLBACK_PROT */

/**
* Opens all flash areas and checks which contain an image with a valid header.
*
Expand Down
10 changes: 5 additions & 5 deletions boot/zephyr/ironside_counters/ironside_counters.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ fih_int boot_nv_security_counter_get(uint32_t image_id, fih_int *security_cnt)
FIH_RET(FIH_FAILURE);
}

if (image_id > IRONSIDE_COUNTER_MAX) {
if (image_id > IRONSIDE_COUNTER_NUM) {
FIH_RET(FIH_FAILURE);
}

Expand All @@ -49,7 +49,7 @@ fih_int boot_nv_security_counter_get(uint32_t image_id, fih_int *security_cnt)
}
}

if (cur_sec_cnt[0] > IRONSIDE_COUNTER_MAX_VALUE) {
if (cur_sec_cnt[0] <= IRONSIDE_COUNTER_MAX_VALUE) {
*security_cnt = fih_int_encode(cur_sec_cnt[0]);
FIH_RET(FIH_SUCCESS);
}
Expand All @@ -59,7 +59,7 @@ fih_int boot_nv_security_counter_get(uint32_t image_id, fih_int *security_cnt)

int32_t boot_nv_security_counter_update(uint32_t image_id, uint32_t img_security_cnt)
{
if ((img_security_cnt > IRONSIDE_COUNTER_MAX_VALUE) || (image_id > IRONSIDE_COUNTER_MAX)) {
if ((img_security_cnt > IRONSIDE_COUNTER_MAX_VALUE) || (image_id > IRONSIDE_COUNTER_NUM)) {
return -BOOT_EBADARGS;
}

Expand All @@ -72,7 +72,7 @@ int32_t boot_nv_security_counter_update(uint32_t image_id, uint32_t img_security

fih_int boot_nv_security_counter_is_update_possible(uint32_t image_id, uint32_t img_security_cnt)
{
fih_int security_cnt;
fih_int security_cnt = FIH_FAILURE;
fih_int fih_err;

FIH_CALL(boot_nv_security_counter_get, fih_err, image_id, &security_cnt);
Expand All @@ -89,7 +89,7 @@ fih_int boot_nv_security_counter_is_update_possible(uint32_t image_id, uint32_t

int32_t boot_nv_security_counter_lock(uint32_t image_id)
{
if (image_id > IRONSIDE_COUNTER_MAX) {
if (image_id > IRONSIDE_COUNTER_NUM) {
return -BOOT_EBADARGS;
}

Expand Down