Skip to content

Commit 9d3275e

Browse files
tomchyrlubos
authored andcommitted
[nrf noup] Align with IronSide APIs
Use APIs defined in the following upstream commit: f324a1540f57c7ea229fb047c542de80c4149aea Ref: NCSDK-36359 Signed-off-by: Tomasz Chyrowicz <[email protected]>
1 parent 024e7d5 commit 9d3275e

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

boot/zephyr/ironside_counters/ironside_counters.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ fih_int boot_nv_security_counter_get(uint32_t image_id, fih_int *security_cnt)
3030
FIH_RET(FIH_FAILURE);
3131
}
3232

33-
if (image_id > IRONSIDE_COUNTER_MAX) {
33+
if (image_id > IRONSIDE_COUNTER_NUM) {
3434
FIH_RET(FIH_FAILURE);
3535
}
3636

@@ -49,7 +49,7 @@ fih_int boot_nv_security_counter_get(uint32_t image_id, fih_int *security_cnt)
4949
}
5050
}
5151

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

6060
int32_t boot_nv_security_counter_update(uint32_t image_id, uint32_t img_security_cnt)
6161
{
62-
if ((img_security_cnt > IRONSIDE_COUNTER_MAX_VALUE) || (image_id > IRONSIDE_COUNTER_MAX)) {
62+
if ((img_security_cnt > IRONSIDE_COUNTER_MAX_VALUE) || (image_id > IRONSIDE_COUNTER_NUM)) {
6363
return -BOOT_EBADARGS;
6464
}
6565

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

7373
fih_int boot_nv_security_counter_is_update_possible(uint32_t image_id, uint32_t img_security_cnt)
7474
{
75-
fih_int security_cnt;
75+
fih_int security_cnt = FIH_FAILURE;
7676
fih_int fih_err;
7777

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

9090
int32_t boot_nv_security_counter_lock(uint32_t image_id)
9191
{
92-
if (image_id > IRONSIDE_COUNTER_MAX) {
92+
if (image_id > IRONSIDE_COUNTER_NUM) {
9393
return -BOOT_EBADARGS;
9494
}
9595

0 commit comments

Comments
 (0)