blob: 3ba4ab17bbc9d67d1ba8869bf4a7be835ecd5f60 (
plain)
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
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
|
//**********************************************************************
//**********************************************************************
//** **
//** (C)Copyright 1985-2010, American Megatrends, Inc. **
//** **
//** All Rights Reserved. **
//** **
//** 5555 Oakbrook Pkwy, Suite 200, Norcross, GA 30093 **
//** **
//** Phone: (770)-246-8600 **
//** **
//**********************************************************************
//**********************************************************************
//*************************************************************************
// $Header: /Alaska/SOURCE/Modules/TCG2/Common/AmiTcgNvflagSample/AmiTcgNvflagSample.h 1 4/21/14 2:17p Fredericko $Revision:
//
// $Date:
//*************************************************************************
// Revision History
// ----------------
//
//*************************************************************************
//*************************************************************************
//<AMI_FHDR_START>
//
// Name: AmiTcgNvflagSample
//
// Description: This is a sample file for support TCG Ppi. It creates and installed
// a protocal to access the persistent bios tpm flags in Tpm NV 0x50010000.
// See Ppi Spec 1.2
//
//<AMI_FHDR_END>
//************************************************************************
#include <AmiDxeLib.h>
#include "token.h"
#include "protocol\TcgService\TcgService.h"
#include <Protocol\TpmDevice\TpmDevice.h>
#include "TCGMisc.h"
#pragma pack(1)
typedef struct TPM_NV_READ_CMD
{
TPM_TAG tag;
UINT32 paramSize;
TPM_COMMAND_CODE ordinal;
TPM_NV_INDEX nvIndex;
UINT32 offset;
UINT32 dataSize;
} TPM_NV_READ_CMD;
typedef struct TPM_NV_READ_RET
{
TPM_TAG tag;
UINT32 paramSize;
TPM_RESULT returnCode;
UINT32 dataSize;
UINT8 data[NV_DATA_SIZE];
UINT8 nonceEven[20];
UINT8 nonceOdd[20];
BOOLEAN ContinueAuthSession;
UINT8 ownerAuth[20];
} TPM_NV_READ_RET;
typedef struct TPM_NV_WRITE_CMD_HDR
{
TPM_TAG tag;
UINT32 paramSize;
TPM_COMMAND_CODE ordinal;
TPM_NV_INDEX nvIndex;
UINT32 offset;
UINT32 dataSize;
} TPM_NV_WRITE_CMD_HDR;
typedef struct TPM_NV_WRITE_CMD
{
TPM_NV_WRITE_CMD_HDR writeHeader;
UINT8 data[NV_DATA_SIZE];
} TPM_NV_WRITE_CMD;
typedef struct TPM_NV_WRITE_RET
{
TPM_TAG tag;
UINT32 paramSize;
TPM_RESULT returnCode;
UINT8 nonceEven[20];
UINT8 nonceOdd[20];
BOOLEAN ContinueAuthSession;
UINT8 ownerAuth[20];
} TPM_NV_WRITE_RET;
typedef struct _TCPA_DIGEST {
UINT8 digest[20];
} TCPA_DIGEST;
typedef struct _TPM_PCR_SELECTION {
UINT16 sizeOfSelect;
UINT8 pcrSelect[3];
} NV_PCR_SELECTION;
typedef struct _TPM_PCR_INFO_SHORT {
UINT16 sizeOfSelect;
UINT8 pcrSelect[3];
UINT8 localityAtRelease;
TCPA_DIGEST digestAtRelease;
} NV_PCR_INFO_SHORT;
typedef struct _TPM_NV_ATTRIBUTES {
UINT16 tag;
UINT32 attributes;
} NV_ATTRIBUTES;
typedef struct _TPM_NV_DATA_PUBLIC1 {
UINT16 Tag_;
UINT32 NvIndex;
NV_PCR_INFO_SHORT PcrInfoRead;
} NV_DATA_PUBLIC1;
typedef struct _TPM_NV_DATA_PUBLIC2 {
NV_PCR_INFO_SHORT PcrInfoWrite;
NV_ATTRIBUTES PerMission;
UINT8 bReadSTClear;
UINT8 bWriteSTClear;
UINT8 bWriteDefine;
UINT32 DataSize;
} NV_DATA_PUBLIC2;
typedef struct _TPM_DEF_NV_DATA {
NV_DATA_PUBLIC1 TpmDefineSpaceIn_pubinfo1;
NV_DATA_PUBLIC2 TpmDefineSpaceIn_pubinfo2;
TCPA_DIGEST TpmDefineSpaceIn_encAuth;
} TPM_DEF_NV_DATA;
typedef struct TPM_NV_PUBLIC_DATA
{
UINT16 tag;
UINT32 Index;
UINT16 InfoReadsizeOfSelect;
UINT16 InfoReadpcrSelect;
UINT8 InfoReadlocalityAtRelease;
UINT8 InfoReaddigestAtRelease[20];
UINT16 InfoWritesizeOfSelect;
UINT16 InfoWritepcrSelect;
UINT8 InfoWritelocalityAtRelease;
UINT8 InfoWritedigestAtRelease[20];
UINT16 AttribTag;
UINT32 Attributes;
BOOLEAN bReadSTClear;
BOOLEAN bWriteSTClear;
BOOLEAN bWriteDefine;
UINT32 dataSize;
}TPM_NV_PUBLIC_DATA;
typedef struct TPM_NV_DEFINESPCE_CMD
{
TPM_TAG tag;
UINT32 paramSize;
TPM_COMMAND_CODE ordinal;
TPM_NV_PUBLIC_DATA pubInfo;
UINT8 encAuth[20];
} TPM_NV_DEFINESPCE_CMD;
typedef struct TPM_NV_DEFINESPCE_RET
{
TPM_TAG tag;
UINT32 paramSize;
TPM_RESULT returnCode;
UINT8 nonceEven[20];
UINT8 nonceOdd[20];
BOOLEAN ContinueAuthSession;
UINT8 ownerAuth[20];
} TPM_NV_DEFINESPCE_RET;
#define INTERNAL_TPM_BADINDEX 0x00000002
#define INTERNAL_TPM_DOING_SELFTEST 0x00000802
#pragma pack()
#define EFI_MAX_BIT 0x80000000
//**********************************************************************
//**********************************************************************
//** **
//** (C)Copyright 1985-2010, American Megatrends, Inc. **
//** **
//** All Rights Reserved. **
//** **
//** 5555 Oakbrook Pkwy, Suite 200, Norcross, GA 30093 **
//** **
//** Phone: (770)-246-8600 **
//** **
//**********************************************************************
//**********************************************************************
|