1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
|
// This file was extracted from the TCG Published
// Trusted Platform Module Library
// Part 4: Supporting Routines
// Family "2.0"
// Level 00 Revision 01.16
// October 30, 2014
#define GLOBAL_C
#include "InternalRoutines.h"
//
//
// Global Data Values
//
// These values are visible across multiple modules.
//
BOOL g_phEnable;
const UINT16 g_rcIndex[15] = {TPM_RC_1, TPM_RC_2, TPM_RC_3, TPM_RC_4,
TPM_RC_5, TPM_RC_6, TPM_RC_7, TPM_RC_8,
TPM_RC_9, TPM_RC_A, TPM_RC_B, TPM_RC_C,
TPM_RC_D, TPM_RC_E, TPM_RC_F
};
TPM_HANDLE g_exclusiveAuditSession;
UINT64 g_time;
BOOL g_pcrReConfig;
TPMI_DH_OBJECT g_DRTMHandle;
BOOL g_DrtmPreStartup;
BOOL g_StartupLocality3;
BOOL g_clearOrderly;
TPM_SU g_prevOrderlyState;
BOOL g_updateNV;
BOOL g_nvOk;
TPM2B_AUTH g_platformUniqueDetails;
STATE_CLEAR_DATA gc;
STATE_RESET_DATA gr;
PERSISTENT_DATA gp;
ORDERLY_DATA go;
//
//
// Private Values
//
// SessionProcess.c
//
#ifndef __IGNORE_STATE__ // DO NOT DEFINE THIS VALUE
//
// These values do not need to be retained between commands.
//
TPM_HANDLE s_sessionHandles[MAX_SESSION_NUM];
TPMA_SESSION s_attributes[MAX_SESSION_NUM];
TPM_HANDLE s_associatedHandles[MAX_SESSION_NUM];
TPM2B_NONCE s_nonceCaller[MAX_SESSION_NUM];
TPM2B_AUTH s_inputAuthValues[MAX_SESSION_NUM];
UINT32 s_encryptSessionIndex;
UINT32 s_decryptSessionIndex;
UINT32 s_auditSessionIndex;
TPM2B_DIGEST s_cpHashForAudit;
UINT32 s_sessionNum;
#endif // __IGNORE_STATE__
BOOL s_DAPendingOnNV;
#ifdef TPM_CC_GetCommandAuditDigest
TPM2B_DIGEST s_cpHashForCommandAudit;
#endif
//
//
// DA.c
//
UINT64 s_selfHealTimer;
UINT64 s_lockoutTimer;
//
//
// NV.c
//
UINT32 s_reservedAddr[NV_RESERVE_LAST];
UINT32 s_reservedSize[NV_RESERVE_LAST];
UINT32 s_ramIndexSize;
BYTE s_ramIndex[RAM_INDEX_SPACE];
UINT32 s_ramIndexSizeAddr;
UINT32 s_ramIndexAddr;
UINT32 s_maxCountAddr;
UINT32 s_evictNvStart;
UINT32 s_evictNvEnd;
TPM_RC s_NvStatus;
//
//
//
// Object.c
//
OBJECT_SLOT s_objects[MAX_LOADED_OBJECTS];
//
//
// PCR.c
//
PCR s_pcrs[IMPLEMENTATION_PCR];
//
//
// Session.c
//
SESSION_SLOT s_sessions[MAX_LOADED_SESSIONS];
UINT32 s_oldestSavedSession;
int s_freeSessionSlots;
//
//
// Manufacture.c
//
BOOL g_manufactured = FALSE;
//
//
// Power.c
//
BOOL s_initialized = FALSE;
//
//
// MemoryLib.c
//
// The s_actionOutputBuffer should not be modifiable by the host system until the TPM has returned a
// response code. The s_actionOutputBuffer should not be accessible until response parameter encryption,
// if any, is complete. This memory is not used between commands
//
#ifndef __IGNORE_STATE__ // DO NOT DEFINE THIS VALUE
#ifndef EMBEDDED_MODE
UINT32 s_actionInputBuffer[1024]; // action input buffer
UINT32 s_actionOutputBuffer[1024]; // action output buffer
#endif // EMBEDDED_MODE ^^^ not defined
BYTE s_responseBuffer[MAX_RESPONSE_SIZE];// response buffer
#endif // __IGNORE_STATE__ ^^^ not defined
//
//
// SelfTest.c
//
// Define these values here if the AlgorithmTests() project is not used
//
#ifndef SELF_TEST
ALGORITHM_VECTOR g_implementedAlgorithms;
ALGORITHM_VECTOR g_toTest;
#endif
//
//
// TpmFail.c
//
#ifndef EMBEDDED_MODE
jmp_buf g_jumpBuffer;
#endif // EMBEDDED_MODE ^^^ not defined
BOOL g_forceFailureMode;
BOOL g_inFailureMode;
UINT32 s_failFunction;
UINT32 s_failLine;
UINT32 s_failCode;
|