]>
Commit | Line | Data |
---|---|---|
ac644614 | 1 | /** @file\r |
267669ba | 2 | TCG Service Protocol as defined in TCG_EFI_Protocol_1_20_Final\r |
ac644614 | 3 | See http://trustedcomputinggroup.org for the latest specification\r |
4 | \r | |
4ca9b6c4 | 5 | Copyright (c) 2007 - 2008, Intel Corporation \r |
ac644614 | 6 | All rights reserved. This program and the accompanying materials\r |
7 | are licensed and made available under the terms and conditions of the BSD License\r | |
8 | which accompanies this distribution. The full text of the license may be found at\r | |
9 | http://opensource.org/licenses/bsd-license.php\r | |
10 | \r | |
11 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r | |
12 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r | |
13 | \r | |
8069d49e | 14 | **/\r |
267669ba LG |
15 | \r |
16 | #ifndef _TCG_SERVICE_PROTOCOL_H_\r | |
17 | #define _TCG_SERVICE_PROTOCOL_H_\r | |
18 | \r | |
19 | #include <Uefi/UefiTcgPlatform.h>\r | |
20 | \r | |
21 | #define EFI_TCG_PROTOCOL_GUID \\r | |
22 | {0xf541796d, 0xa62e, 0x4954, { 0xa7, 0x75, 0x95, 0x84, 0xf6, 0x1b, 0x9c, 0xdd } } \r | |
23 | \r | |
24 | typedef struct _EFI_TCG_PROTOCOL EFI_TCG_PROTOCOL;\r | |
25 | \r | |
26 | //\r | |
27 | // Set structure alignment to 1-byte\r | |
28 | //\r | |
267669ba LG |
29 | typedef struct {\r |
30 | UINT8 Major;\r | |
31 | UINT8 Minor;\r | |
32 | UINT8 RevMajor;\r | |
33 | UINT8 RevMinor;\r | |
34 | } TCG_VERSION;\r | |
35 | \r | |
36 | typedef struct _TCG_EFI_BOOT_SERVICE_CAPABILITY {\r | |
37 | UINT8 Size; // Size of this structure\r | |
38 | TCG_VERSION StructureVersion; \r | |
39 | TCG_VERSION ProtocolSpecVersion;\r | |
40 | UINT8 HashAlgorithmBitmap; // Hash algorithms \r | |
41 | // this protocol is capable of : 01=SHA-1\r | |
42 | BOOLEAN TPMPresentFlag; // 00h = TPM not present\r | |
43 | BOOLEAN TPMDeactivatedFlag; // 01h = TPM currently deactivated\r | |
44 | } TCG_EFI_BOOT_SERVICE_CAPABILITY;\r | |
45 | \r | |
46 | typedef UINT32 TCG_ALGORITHM_ID;\r | |
47 | \r | |
8069d49e LG |
48 | /**\r |
49 | This service provides EFI protocol capability information, state information \r | |
50 | about the TPM, and Event Log state information.\r | |
51 | \r | |
52 | @param This Indicates the calling context\r | |
53 | @param ProtocolCapability The callee allocates memory for a TCG_BOOT_SERVICE_CAPABILITY \r | |
54 | structure and fills in the fields with the EFI protocol \r | |
55 | capability information and the current TPM state information.\r | |
56 | @param TCGFeatureFlags This is a pointer to the feature flags. No feature \r | |
57 | flags are currently defined so this parameter \r | |
58 | MUST be set to 0. However, in the future, \r | |
59 | feature flags may be defined that, for example, \r | |
60 | enable hash algorithm agility.\r | |
61 | @param EventLogLocation This is a pointer to the address of the event log in memory.\r | |
62 | @param EventLogLastEntry If the Event Log contains more than one entry, \r | |
63 | this is a pointer to the address of the start of \r | |
64 | the last entry in the event log in memory. \r | |
65 | \r | |
66 | @retval EFI_SUCCESS Operation completed successfully.\r | |
67 | @retval EFI_DEVICE_ERROR The command was unsuccessful.\r | |
68 | @retval EFI_INVALID_PARAMETER One or more of the parameters are incorrect.\r | |
69 | @retval EFI_BUFFER_TOO_SMALL The receive buffer is too small.\r | |
70 | @retval EFI_NOT_FOUND The component was not running\r | |
71 | \r | |
72 | **/\r | |
267669ba LG |
73 | typedef\r |
74 | EFI_STATUS\r | |
8b13229b | 75 | (EFIAPI *EFI_TCG_STATUS_CHECK)(\r |
267669ba LG |
76 | IN EFI_TCG_PROTOCOL *This,\r |
77 | OUT TCG_EFI_BOOT_SERVICE_CAPABILITY\r | |
78 | *ProtocolCapability,\r | |
79 | OUT UINT32 *TCGFeatureFlags,\r | |
80 | OUT EFI_PHYSICAL_ADDRESS *EventLogLocation,\r | |
81 | OUT EFI_PHYSICAL_ADDRESS *EventLogLastEntry\r | |
82 | );\r | |
83 | \r | |
8069d49e LG |
84 | /**\r |
85 | This service abstracts the capability to do a hash operation on a data buffer.\r | |
86 | \r | |
87 | @param This Indicates the calling context\r | |
88 | @param HashData Pointer to the data buffer to be hashed\r | |
89 | @param HashDataLen Length of the data buffer to be hashed\r | |
90 | @param AlgorithmId Identification of the Algorithm to use for the hashing operation\r | |
91 | @param HashedDataLen Resultant length of the hashed data\r | |
92 | @param HashedDataResult Resultant buffer of the hashed data \r | |
93 | \r | |
94 | @retval EFI_SUCCESS Operation completed successfully.\r | |
95 | @retval EFI_DEVICE_ERROR The command was unsuccessful.\r | |
96 | @retval EFI_INVALID_PARAMETER One or more of the parameters are incorrect.\r | |
97 | @retval EFI_BUFFER_TOO_SMALL The receive buffer is too small.\r | |
98 | @retval EFI_NOT_FOUND The component was not running\r | |
99 | \r | |
100 | **/\r | |
267669ba LG |
101 | typedef\r |
102 | EFI_STATUS\r | |
8b13229b | 103 | (EFIAPI *EFI_TCG_HASH_ALL)(\r |
267669ba LG |
104 | IN EFI_TCG_PROTOCOL *This,\r |
105 | IN UINT8 *HashData,\r | |
106 | IN UINT64 HashDataLen,\r | |
107 | IN TCG_ALGORITHM_ID AlgorithmId,\r | |
108 | IN OUT UINT64 *HashedDataLen,\r | |
109 | IN OUT UINT8 **HashedDataResult\r | |
110 | );\r | |
111 | \r | |
8069d49e LG |
112 | /**\r |
113 | This service abstracts the capability to add an entry to the Event Log.\r | |
114 | \r | |
115 | @param This Indicates the calling context\r | |
116 | @param TCGLogData Pointer to the start of the data buffer containing \r | |
117 | the TCG_PCR_EVENT data structure. All fields in \r | |
118 | this structure are properly filled by the caller.\r | |
119 | @param EventNumber The event number of the event just logged\r | |
120 | @param Flags Indicate additional flags. Only one flag has been \r | |
121 | defined at this time, which is 0x01 and means the \r | |
122 | extend operation should not be performed. All \r | |
123 | other bits are reserved. \r | |
124 | \r | |
125 | @retval EFI_SUCCESS Operation completed successfully.\r | |
126 | @retval EFI_DEVICE_ERROR The command was unsuccessful.\r | |
127 | @retval EFI_INVALID_PARAMETER One or more of the parameters are incorrect.\r | |
128 | @retval EFI_BUFFER_TOO_SMALL The receive buffer is too small.\r | |
129 | @retval EFI_NOT_FOUND The component was not running\r | |
130 | **/\r | |
267669ba LG |
131 | typedef\r |
132 | EFI_STATUS\r | |
8b13229b | 133 | (EFIAPI *EFI_TCG_LOG_EVENT)(\r |
267669ba LG |
134 | IN EFI_TCG_PROTOCOL *This,\r |
135 | IN TCG_PCR_EVENT *TCGLogData,\r | |
136 | IN OUT UINT32 *EventNumber,\r | |
137 | IN UINT32 Flags\r | |
138 | );\r | |
139 | \r | |
8069d49e LG |
140 | /**\r |
141 | This service is a proxy for commands to the TPM.\r | |
142 | \r | |
143 | @param This Indicates the calling context\r | |
144 | @param TpmInputParameterBlockSize Size of the TPM input parameter block\r | |
145 | @param TpmInputParameterBlock Pointer to the TPM input parameter block\r | |
146 | @param TpmOutputParameterBlockSize Size of the TPM output parameter block\r | |
147 | @param TpmOutputParameterBlock Pointer to the TPM output parameter block\r | |
148 | \r | |
149 | @retval EFI_SUCCESS Operation completed successfully.\r | |
150 | @retval EFI_DEVICE_ERROR The command was unsuccessful.\r | |
151 | @retval EFI_INVALID_PARAMETER One or more of the parameters are incorrect.\r | |
152 | @retval EFI_BUFFER_TOO_SMALL The receive buffer is too small.\r | |
153 | @retval EFI_NOT_FOUND The component was not running\r | |
154 | **/\r | |
267669ba LG |
155 | typedef\r |
156 | EFI_STATUS\r | |
8b13229b | 157 | (EFIAPI *EFI_TCG_PASS_THROUGH_TO_TPM)(\r |
267669ba LG |
158 | IN EFI_TCG_PROTOCOL *This,\r |
159 | IN UINT32 TpmInputParamterBlockSize,\r | |
160 | IN UINT8 *TpmInputParamterBlock,\r | |
161 | IN UINT32 TpmOutputParameterBlockSize,\r | |
162 | IN UINT8 *TpmOutputParameterBlock\r | |
163 | );\r | |
164 | \r | |
8069d49e LG |
165 | /**\r |
166 | This service abstracts the capability to do a hash operation on a data buffer, extend a specific TPM PCR with the hash result, and add an entry to the Event Log\r | |
167 | \r | |
168 | @param This Indicates the calling context\r | |
169 | @param HashData Physical address of the start of the data buffer \r | |
170 | to be hashed, extended, and logged.\r | |
171 | @param HashDataLen The length, in bytes, of the buffer referenced by HashData\r | |
172 | @param AlgorithmId Identification of the Algorithm to use for the hashing operation\r | |
173 | @param TCGLogData The physical address of the start of the data \r | |
174 | buffer containing the TCG_PCR_EVENT data structure.\r | |
175 | @param EventNumber The event number of the event just logged.\r | |
176 | @param EventLogLastEntry Physical address of the first byte of the entry \r | |
177 | just placed in the Event Log. If the Event Log was \r | |
178 | empty when this function was called then this physical \r | |
179 | address will be the same as the physical address of \r | |
180 | the start of the Event Log.\r | |
181 | \r | |
182 | @retval EFI_SUCCESS Operation completed successfully.\r | |
183 | @retval EFI_DEVICE_ERROR The command was unsuccessful.\r | |
184 | @retval EFI_INVALID_PARAMETER One or more of the parameters are incorrect.\r | |
185 | @retval EFI_BUFFER_TOO_SMALL The receive buffer is too small.\r | |
186 | @retval EFI_NOT_FOUND The component was not running\r | |
187 | **/\r | |
267669ba LG |
188 | typedef\r |
189 | EFI_STATUS\r | |
8b13229b | 190 | (EFIAPI *EFI_TCG_HASH_LOG_EXTEND_EVENT)(\r |
267669ba | 191 | IN EFI_TCG_PROTOCOL *This,\r |
5397fc66 | 192 | IN EFI_PHYSICAL_ADDRESS HashData,\r |
267669ba LG |
193 | IN UINT64 HashDataLen,\r |
194 | IN TCG_ALGORITHM_ID AlgorithmId,\r | |
195 | IN OUT TCG_PCR_EVENT *TCGLogData,\r | |
196 | IN OUT UINT32 *EventNumber,\r | |
197 | OUT EFI_PHYSICAL_ADDRESS *EventLogLastEntry\r | |
198 | );\r | |
199 | \r | |
44717a39 | 200 | ///\r |
201 | /// The EFI_TCG Protocol abstracts TCG activity.\r | |
202 | ///\r | |
c28a5554 | 203 | struct _EFI_TCG_PROTOCOL {\r |
267669ba LG |
204 | EFI_TCG_STATUS_CHECK StatusCheck;\r |
205 | EFI_TCG_HASH_ALL HashAll;\r | |
206 | EFI_TCG_LOG_EVENT LogEvent;\r | |
207 | EFI_TCG_PASS_THROUGH_TO_TPM PassThroughToTpm;\r | |
208 | EFI_TCG_HASH_LOG_EXTEND_EVENT HashLogExtendEvent;\r | |
c28a5554 | 209 | };\r |
267669ba LG |
210 | \r |
211 | extern EFI_GUID gEfiTcgProtocolGuid;\r | |
212 | \r | |
213 | #endif\r |