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