HAL: Apply FIH to tfm_hal_platform_init
This patch applies Fault Inject Harden to the tfm_hal_platform_init
API.
And restore the FIH on init_debug() on AN521.
Change-Id: Ib6a640631d6e0ab592d83802158adf5bc4c93ec5
Signed-off-by: Kevin Peng <kevin.peng@arm.com>
diff --git a/secure_fw/spm/cmsis_func/main.c b/secure_fw/spm/cmsis_func/main.c
index a50767f..0ea1911 100644
--- a/secure_fw/spm/cmsis_func/main.c
+++ b/secure_fw/spm/cmsis_func/main.c
@@ -65,10 +65,17 @@
}
#endif /* TFM_FIH_PROFILE_ON */
- hal_status = tfm_hal_platform_init();
- if (hal_status != TFM_HAL_SUCCESS) {
+#ifdef TFM_FIH_PROFILE_ON
+ FIH_CALL(tfm_hal_platform_init, fih_rc);
+ if (fih_not_eq(fih_rc, fih_int_encode(TFM_HAL_SUCCESS))) {
FIH_RET(fih_int_encode(TFM_ERROR_GENERIC));
}
+#else /* TFM_FIH_PROFILE_ON */
+ hal_status = tfm_hal_platform_init();
+ if (hal_status != TFM_HAL_SUCCESS) {
+ return TFM_ERROR_GENERIC;
+ }
+#endif /* TFM_FIH_PROFILE_ON */
plat_err = tfm_plat_otp_init();
if (plat_err != TFM_PLAT_ERR_SUCCESS) {