1 /* 2 * Copyright (c) 2023, Arm Limited. All rights reserved. 3 * 4 * SPDX-License-Identifier: BSD-3-Clause 5 * 6 */ 7 8 #include <stdint.h> 9 #ifdef CRYPTO_HW_ACCELERATOR 10 #include "crypto_hw.h" 11 #include "fih.h" 12 #endif /* CRYPTO_HW_ACCELERATOR */ 13 14 #include "bootutil/bootutil_log.h" 15 #include "microsecond_timer.h" 16 #include "psa_adac_platform.h" 17 #include "tfm_plat_otp.h" 18 #include "tfm_plat_defs.h" 19 20 static uint8_t rotpk_p256[32]; 21 boot_platform_post_init(void)22int32_t boot_platform_post_init(void) 23 { 24 int32_t result; 25 enum tfm_plat_err_t plat_err; 26 #ifdef CRYPTO_HW_ACCELERATOR 27 28 result = crypto_hw_accelerator_init(); 29 if (result) { 30 return 1; 31 } 32 33 (void)fih_delay_init(); 34 #endif /* CRYPTO_HW_ACCELERATOR */ 35 36 microsecond_timer_init(); 37 38 plat_err = tfm_plat_otp_read(PLAT_OTP_ID_SECURE_DEBUG_PK, 32, rotpk_p256); 39 if (plat_err != TFM_PLAT_ERR_SUCCESS) { 40 return plat_err; 41 } 42 43 result = tfm_to_psa_adac_musca_b1_secure_debug(rotpk_p256, 32); 44 BOOT_LOG_INF("%s: Musca-B1 secure_debug is a %s.\r\n", __func__, 45 (result == 0) ? "success" : "failure"); 46 47 return 0; 48 } 49