From 37fb0aaa2ae7ef8512a953de8669a8dedb20bf2f Mon Sep 17 00:00:00 2001 From: Marco Oliverio Date: Wed, 20 Mar 2024 16:03:55 +0100 Subject: [PATCH] tpm: include self test wrapper --- include/tpm.h | 2 ++ src/tpm.c | 12 ++++++++++++ 2 files changed, 14 insertions(+) diff --git a/include/tpm.h b/include/tpm.h index d0043725..832fe813 100644 --- a/include/tpm.h +++ b/include/tpm.h @@ -106,6 +106,8 @@ int wolfBoot_tpm2_extend(uint8_t pcrIndex, uint8_t* hash, int line); wolfBoot_tpm2_extend(WOLFBOOT_MEASURED_PCR_A, (hash), __LINE__) #endif /* WOLFBOOT_MEASURED_BOOT */ +int wolfBoot_tpm_self_test(void); + /* debugging */ void wolfBoot_print_hexstr(const unsigned char* bin, unsigned long sz, unsigned long maxLine); diff --git a/src/tpm.c b/src/tpm.c index c5c90bfb..4f957cda 100644 --- a/src/tpm.c +++ b/src/tpm.c @@ -1320,5 +1320,17 @@ int wolfBoot_check_rot(int key_slot, uint8_t* pubkey_hint) return rc; } #endif +/** + * @brief Perform TPM2 self test. + * + * This function performs the TPM2 self test. + * + * @return TPM_RC_SUCCESS in case of success + * +*/ +int wolfBoot_tpm_self_test(void) +{ + return wolfTPM2_SelfTest(&wolftpm_dev); +} #endif /* WOLFBOOT_TPM */