11#include "tpm.h"
22#include "common/library.h"
33
4- // #include <tbs.h>
5-
6- typedef UINT32 TBS_RESULT ;
7- #define TBS_SUCCESS 0u
8- #define TBS_E_TPM_NOT_FOUND ((TBS_RESULT) 0x8028400Fu)
9-
10- #define TPM_VERSION_UNKNOWN 0
11- #define TPM_VERSION_12 1
12- #define TPM_VERSION_20 2
13-
14- #define TPM_IFTYPE_UNKNOWN 0
15- #define TPM_IFTYPE_1 1 // for 1.2 - use I/O-port or MMIO
16- #define TPM_IFTYPE_TRUSTZONE 2 // 2.0: Trustzone
17- #define TPM_IFTYPE_HW 3 // 2.0: HW TPM
18- #define TPM_IFTYPE_EMULATOR 4 // 2.0: SW-emulator
19- #define TPM_IFTYPE_SPB 5 // 2.0: SPB attached
20-
21- typedef struct _TPM_DEVICE_INFO
22- {
23- UINT32 structVersion ; // = 1 for now
24- UINT32 tpmVersion ; // 1.2 / 2.0
25- UINT32 tpmInterfaceType ; // HW, simulator, ...
26- UINT32 tpmImpRevision ; // code-drop revision,
27- // implenmentation-specific
28- } TPM_DEVICE_INFO , * PTPM_DEVICE_INFO ;
29- typedef const TPM_DEVICE_INFO * PCTPM_DEVICE_INFO ;
30-
31- TBS_RESULT WINAPI
32- Tbsi_GetDeviceInfo (
33- _In_ UINT32 Size ,
34- _Out_writes_bytes_ (Size ) PVOID Info );
4+ #include <tbs.h>
5+ #include <winerror.h>
356
367const char * ffDetectTPM (FFTPMResult * result )
378{
@@ -41,7 +12,7 @@ const char* ffDetectTPM(FFTPMResult* result)
4112 TPM_DEVICE_INFO deviceInfo = {};
4213 TBS_RESULT code = ffTbsi_GetDeviceInfo (sizeof (deviceInfo ), & deviceInfo );
4314 if (code != TBS_SUCCESS )
44- return code == TBS_E_TPM_NOT_FOUND ? "TPM device is not found" : "Tbsi_GetDeviceInfo() failed" ;
15+ return code == ( TBS_RESULT ) TBS_E_TPM_NOT_FOUND ? "TPM device is not found" : "Tbsi_GetDeviceInfo() failed" ;
4516
4617 switch (deviceInfo .tpmVersion )
4718 {
0 commit comments