mirror of
https://github.com/stefanberger/libtpms
synced 2026-08-08 10:06:32 +00:00
Support for TPMEstablished flag in TPM2 code
Resolve a few TPMEstablishment bit related FIXMEs by implementing supporting functions. Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
This commit is contained in:
parent
0eaae34cc5
commit
00f85ac180
@ -196,5 +196,10 @@ main(
|
||||
int argc,
|
||||
char *argv[]
|
||||
);
|
||||
// Extensions:
|
||||
void _rpc__Signal_SetTPMEstablished(void);
|
||||
BOOL _rpc__Signal_GetTPMEstablished(void);
|
||||
void _rpc__Signal_ResetTPMEstablished(void);
|
||||
|
||||
#endif // _SIMULATOR_FP_H_
|
||||
|
||||
|
||||
@ -333,3 +333,26 @@ _rpc__Shutdown(
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// Extensions
|
||||
static BOOL tpmEstablished;
|
||||
|
||||
void
|
||||
_rpc__Signal_SetTPMEstablished(void)
|
||||
{
|
||||
tpmEstablished = TRUE;
|
||||
}
|
||||
|
||||
void
|
||||
_rpc__Signal_ResetTPMEstablished(void)
|
||||
{
|
||||
/* check for locality 3 or 4 already done by caller */
|
||||
tpmEstablished = FALSE;
|
||||
}
|
||||
|
||||
BOOL
|
||||
_rpc__Signal_GetTPMEstablished(void)
|
||||
{
|
||||
return tpmEstablished;
|
||||
}
|
||||
|
||||
@ -49,25 +49,45 @@ typedef uint32_t UINT32;
|
||||
#include "tpm2/_TPM_Hash_Start_fp.h"
|
||||
#include "tpm2/_TPM_Hash_Data_fp.h"
|
||||
#include "tpm2/_TPM_Hash_End_fp.h"
|
||||
#include "tpm2/TpmTcpProtocol.h"
|
||||
#include "tpm2/Platform_fp.h"
|
||||
#include "tpm2/Simulator_fp.h"
|
||||
|
||||
TPM_RESULT TPM2_IO_TpmEstablished_Get(TPM_BOOL *tpmEstablished)
|
||||
{
|
||||
// FIXME: Missing
|
||||
*tpmEstablished = FALSE;
|
||||
*tpmEstablished = _rpc__Signal_GetTPMEstablished();
|
||||
|
||||
return TPM_SUCCESS;
|
||||
}
|
||||
|
||||
TPM_RESULT TPM2_IO_TpmEstablished_Reset(void)
|
||||
{
|
||||
// FIXME: Missing
|
||||
return TPM_SUCCESS;
|
||||
TPM_RESULT ret = TPM_SUCCESS;
|
||||
struct libtpms_callbacks *cbs = TPMLIB_GetCallbacks();
|
||||
TPM_MODIFIER_INDICATOR locality = 0;
|
||||
uint32_t tpm_number = 0;
|
||||
|
||||
if (cbs->tpm_io_getlocality) {
|
||||
cbs->tpm_io_getlocality(&locality, tpm_number);
|
||||
}
|
||||
|
||||
_plat__LocalitySet(locality);
|
||||
|
||||
if (locality == 3 || locality == 4) {
|
||||
_rpc__Signal_ResetTPMEstablished();
|
||||
} else {
|
||||
ret = TPM_BAD_LOCALITY;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
TPM_RESULT TPM2_IO_Hash_Start(void)
|
||||
{
|
||||
_TPM_Hash_Start();
|
||||
|
||||
_rpc__Signal_SetTPMEstablished();
|
||||
|
||||
return TPM_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user