mirror of
https://github.com/stefanberger/libtpms
synced 2026-02-01 17:51:47 +00:00
tpm2: Return failure code if TPM was put into failure mode
Return a failure code to the control command initiated initialization of the TPM 2. Reset the failure move on every INIT call so that corrections can be done without having to restart the TPM emulator. Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
This commit is contained in:
parent
3cf528aaac
commit
0eaae34cc5
@ -61,6 +61,8 @@
|
||||
#include "tpm2/_TPM_Hash_Data_fp.h"
|
||||
#include "tpm2/_TPM_Init_fp.h"
|
||||
|
||||
extern BOOL g_inFailureMode;
|
||||
|
||||
/*
|
||||
* Check whether the main NVRAM file exists. Return TRUE if it doesn, FALSE otherwise
|
||||
*/
|
||||
@ -88,6 +90,8 @@ TPM_RESULT TPM2_MainInit(void)
|
||||
{
|
||||
TPM_RESULT ret = TPM_SUCCESS;
|
||||
|
||||
g_inFailureMode = FALSE;
|
||||
|
||||
#ifdef TPM_LIBTPMS_CALLBACKS
|
||||
struct libtpms_callbacks *cbs = TPMLIB_GetCallbacks();
|
||||
|
||||
@ -115,6 +119,11 @@ TPM_RESULT TPM2_MainInit(void)
|
||||
|
||||
_rpc__Signal_NvOn();
|
||||
|
||||
if (ret == TPM_SUCCESS) {
|
||||
if (g_inFailureMode)
|
||||
ret = TPM_RC_FAILURE;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user