Browse Source

feat(fwu): avoid NV counter upgrade in trial run state

Avoided NV counter update when the system is running in
trial run state.

Change-Id: I5da6a6760f8a9faff777f2ff879156e9c3c76726
Signed-off-by: Manish V Badarkhe <Manish.Badarkhe@arm.com>
pull/1943/head
Manish V Badarkhe 3 years ago
parent
commit
c0bfc88f8e
  1. 9
      drivers/auth/auth_mod.c

9
drivers/auth/auth_mod.c

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2015-2020, ARM Limited and Contributors. All rights reserved. * Copyright (c) 2015-2021, ARM Limited and Contributors. All rights reserved.
* *
* SPDX-License-Identifier: BSD-3-Clause * SPDX-License-Identifier: BSD-3-Clause
*/ */
@ -16,6 +16,7 @@
#include <drivers/auth/auth_mod.h> #include <drivers/auth/auth_mod.h>
#include <drivers/auth/crypto_mod.h> #include <drivers/auth/crypto_mod.h>
#include <drivers/auth/img_parser_mod.h> #include <drivers/auth/img_parser_mod.h>
#include <drivers/fwu/fwu.h>
#include <lib/fconf/fconf_tbbr_getter.h> #include <lib/fconf/fconf_tbbr_getter.h>
#include <plat/common/platform.h> #include <plat/common/platform.h>
@ -242,6 +243,7 @@ static int auth_nvctr(const auth_method_param_nv_ctr_t *param,
unsigned int data_len, len, i; unsigned int data_len, len, i;
unsigned int plat_nv_ctr; unsigned int plat_nv_ctr;
int rc = 0; int rc = 0;
bool is_trial_run = false;
/* Get the counter value from current image. The AM expects the IPM /* Get the counter value from current image. The AM expects the IPM
* to return the counter value as a DER encoded integer */ * to return the counter value as a DER encoded integer */
@ -284,7 +286,10 @@ static int auth_nvctr(const auth_method_param_nv_ctr_t *param,
/* Invalid NV-counter */ /* Invalid NV-counter */
return 1; return 1;
} else if (*cert_nv_ctr > plat_nv_ctr) { } else if (*cert_nv_ctr > plat_nv_ctr) {
*need_nv_ctr_upgrade = true; #if PSA_FWU_SUPPORT && IMAGE_BL2
is_trial_run = fwu_is_trial_run_state();
#endif /* PSA_FWU_SUPPORT && IMAGE_BL2 */
*need_nv_ctr_upgrade = !is_trial_run;
} }
return 0; return 0;

Loading…
Cancel
Save