Skip to content

Commit 9188715

Browse files
committed
TPM (Windows): use system headers
1 parent bf1cd33 commit 9188715

File tree

1 file changed

+3
-32
lines changed

1 file changed

+3
-32
lines changed

src/detection/tpm/tpm_windows.c

Lines changed: 3 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,8 @@
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

367
const 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

Comments
 (0)