]> git.proxmox.com Git - mirror_edk2.git/blame - MdePkg/Include/Protocol/TcgService.h
Add the detailed descriptions for the structure data member in these protocol.
[mirror_edk2.git] / MdePkg / Include / Protocol / TcgService.h
CommitLineData
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
24typedef struct _EFI_TCG_PROTOCOL EFI_TCG_PROTOCOL;\r
25\r
267669ba
LG
26typedef struct {\r
27 UINT8 Major;\r
28 UINT8 Minor;\r
29 UINT8 RevMajor;\r
30 UINT8 RevMinor;\r
31} TCG_VERSION;\r
32\r
33typedef struct _TCG_EFI_BOOT_SERVICE_CAPABILITY {\r
992f22b9 34 UINT8 Size; /// Size of this structure\r
267669ba
LG
35 TCG_VERSION StructureVersion; \r
36 TCG_VERSION ProtocolSpecVersion;\r
992f22b9
LG
37 UINT8 HashAlgorithmBitmap; /// Hash algorithms \r
38 /// this protocol is capable of : 01=SHA-1\r
39 BOOLEAN TPMPresentFlag; /// 00h = TPM not present\r
40 BOOLEAN TPMDeactivatedFlag; /// 01h = TPM currently deactivated\r
267669ba
LG
41} TCG_EFI_BOOT_SERVICE_CAPABILITY;\r
42\r
43typedef UINT32 TCG_ALGORITHM_ID;\r
44\r
8069d49e
LG
45/**\r
46 This service provides EFI protocol capability information, state information \r
47 about the TPM, and Event Log state information.\r
48\r
49 @param This Indicates the calling context\r
50 @param ProtocolCapability The callee allocates memory for a TCG_BOOT_SERVICE_CAPABILITY \r
51 structure and fills in the fields with the EFI protocol \r
52 capability information and the current TPM state information.\r
53 @param TCGFeatureFlags This is a pointer to the feature flags. No feature \r
54 flags are currently defined so this parameter \r
55 MUST be set to 0. However, in the future, \r
56 feature flags may be defined that, for example, \r
57 enable hash algorithm agility.\r
58 @param EventLogLocation This is a pointer to the address of the event log in memory.\r
59 @param EventLogLastEntry If the Event Log contains more than one entry, \r
60 this is a pointer to the address of the start of \r
61 the last entry in the event log in memory. \r
62\r
63 @retval EFI_SUCCESS Operation completed successfully.\r
64 @retval EFI_DEVICE_ERROR The command was unsuccessful.\r
65 @retval EFI_INVALID_PARAMETER One or more of the parameters are incorrect.\r
66 @retval EFI_BUFFER_TOO_SMALL The receive buffer is too small.\r
67 @retval EFI_NOT_FOUND The component was not running\r
68\r
69**/\r
267669ba
LG
70typedef\r
71EFI_STATUS\r
8b13229b 72(EFIAPI *EFI_TCG_STATUS_CHECK)(\r
267669ba
LG
73 IN EFI_TCG_PROTOCOL *This,\r
74 OUT TCG_EFI_BOOT_SERVICE_CAPABILITY\r
75 *ProtocolCapability,\r
76 OUT UINT32 *TCGFeatureFlags,\r
77 OUT EFI_PHYSICAL_ADDRESS *EventLogLocation,\r
78 OUT EFI_PHYSICAL_ADDRESS *EventLogLastEntry\r
79 );\r
80\r
8069d49e
LG
81/**\r
82 This service abstracts the capability to do a hash operation on a data buffer.\r
83 \r
84 @param This Indicates the calling context\r
85 @param HashData Pointer to the data buffer to be hashed\r
86 @param HashDataLen Length of the data buffer to be hashed\r
87 @param AlgorithmId Identification of the Algorithm to use for the hashing operation\r
88 @param HashedDataLen Resultant length of the hashed data\r
89 @param HashedDataResult Resultant buffer of the hashed data \r
90 \r
91 @retval EFI_SUCCESS Operation completed successfully.\r
92 @retval EFI_DEVICE_ERROR The command was unsuccessful.\r
93 @retval EFI_INVALID_PARAMETER One or more of the parameters are incorrect.\r
94 @retval EFI_BUFFER_TOO_SMALL The receive buffer is too small.\r
95 @retval EFI_NOT_FOUND The component was not running\r
96\r
97**/\r
267669ba
LG
98typedef\r
99EFI_STATUS\r
8b13229b 100(EFIAPI *EFI_TCG_HASH_ALL)(\r
267669ba
LG
101 IN EFI_TCG_PROTOCOL *This,\r
102 IN UINT8 *HashData,\r
103 IN UINT64 HashDataLen,\r
104 IN TCG_ALGORITHM_ID AlgorithmId,\r
105 IN OUT UINT64 *HashedDataLen,\r
106 IN OUT UINT8 **HashedDataResult\r
107 );\r
108\r
8069d49e
LG
109/**\r
110 This service abstracts the capability to add an entry to the Event Log.\r
111\r
112 @param This Indicates the calling context\r
113 @param TCGLogData Pointer to the start of the data buffer containing \r
114 the TCG_PCR_EVENT data structure. All fields in \r
115 this structure are properly filled by the caller.\r
116 @param EventNumber The event number of the event just logged\r
117 @param Flags Indicate additional flags. Only one flag has been \r
118 defined at this time, which is 0x01 and means the \r
119 extend operation should not be performed. All \r
120 other bits are reserved. \r
121 \r
122 @retval EFI_SUCCESS Operation completed successfully.\r
123 @retval EFI_DEVICE_ERROR The command was unsuccessful.\r
124 @retval EFI_INVALID_PARAMETER One or more of the parameters are incorrect.\r
125 @retval EFI_BUFFER_TOO_SMALL The receive buffer is too small.\r
126 @retval EFI_NOT_FOUND The component was not running\r
127**/\r
267669ba
LG
128typedef\r
129EFI_STATUS\r
8b13229b 130(EFIAPI *EFI_TCG_LOG_EVENT)(\r
267669ba
LG
131 IN EFI_TCG_PROTOCOL *This,\r
132 IN TCG_PCR_EVENT *TCGLogData,\r
133 IN OUT UINT32 *EventNumber,\r
134 IN UINT32 Flags\r
135 );\r
136\r
8069d49e
LG
137/**\r
138 This service is a proxy for commands to the TPM.\r
139\r
140 @param This Indicates the calling context\r
141 @param TpmInputParameterBlockSize Size of the TPM input parameter block\r
142 @param TpmInputParameterBlock Pointer to the TPM input parameter block\r
143 @param TpmOutputParameterBlockSize Size of the TPM output parameter block\r
144 @param TpmOutputParameterBlock Pointer to the TPM output parameter block\r
145\r
146 @retval EFI_SUCCESS Operation completed successfully.\r
147 @retval EFI_DEVICE_ERROR The command was unsuccessful.\r
148 @retval EFI_INVALID_PARAMETER One or more of the parameters are incorrect.\r
149 @retval EFI_BUFFER_TOO_SMALL The receive buffer is too small.\r
150 @retval EFI_NOT_FOUND The component was not running\r
151**/\r
267669ba
LG
152typedef\r
153EFI_STATUS\r
8b13229b 154(EFIAPI *EFI_TCG_PASS_THROUGH_TO_TPM)(\r
267669ba
LG
155 IN EFI_TCG_PROTOCOL *This,\r
156 IN UINT32 TpmInputParamterBlockSize,\r
157 IN UINT8 *TpmInputParamterBlock,\r
158 IN UINT32 TpmOutputParameterBlockSize,\r
159 IN UINT8 *TpmOutputParameterBlock\r
160 );\r
161\r
8069d49e
LG
162/**\r
163 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
164\r
165 @param This Indicates the calling context\r
166 @param HashData Physical address of the start of the data buffer \r
167 to be hashed, extended, and logged.\r
168 @param HashDataLen The length, in bytes, of the buffer referenced by HashData\r
169 @param AlgorithmId Identification of the Algorithm to use for the hashing operation\r
170 @param TCGLogData The physical address of the start of the data \r
171 buffer containing the TCG_PCR_EVENT data structure.\r
172 @param EventNumber The event number of the event just logged.\r
173 @param EventLogLastEntry Physical address of the first byte of the entry \r
174 just placed in the Event Log. If the Event Log was \r
175 empty when this function was called then this physical \r
176 address will be the same as the physical address of \r
177 the start of the Event Log.\r
178\r
179 @retval EFI_SUCCESS Operation completed successfully.\r
180 @retval EFI_DEVICE_ERROR The command was unsuccessful.\r
181 @retval EFI_INVALID_PARAMETER One or more of the parameters are incorrect.\r
182 @retval EFI_BUFFER_TOO_SMALL The receive buffer is too small.\r
183 @retval EFI_NOT_FOUND The component was not running\r
184**/\r
267669ba
LG
185typedef\r
186EFI_STATUS\r
8b13229b 187(EFIAPI *EFI_TCG_HASH_LOG_EXTEND_EVENT)(\r
267669ba 188 IN EFI_TCG_PROTOCOL *This,\r
5397fc66 189 IN EFI_PHYSICAL_ADDRESS HashData,\r
267669ba
LG
190 IN UINT64 HashDataLen,\r
191 IN TCG_ALGORITHM_ID AlgorithmId,\r
192 IN OUT TCG_PCR_EVENT *TCGLogData,\r
193 IN OUT UINT32 *EventNumber,\r
194 OUT EFI_PHYSICAL_ADDRESS *EventLogLastEntry\r
195 );\r
196\r
44717a39 197///\r
198/// The EFI_TCG Protocol abstracts TCG activity.\r
199///\r
c28a5554 200struct _EFI_TCG_PROTOCOL {\r
267669ba
LG
201 EFI_TCG_STATUS_CHECK StatusCheck;\r
202 EFI_TCG_HASH_ALL HashAll;\r
203 EFI_TCG_LOG_EVENT LogEvent;\r
204 EFI_TCG_PASS_THROUGH_TO_TPM PassThroughToTpm;\r
205 EFI_TCG_HASH_LOG_EXTEND_EVENT HashLogExtendEvent;\r
c28a5554 206};\r
267669ba
LG
207\r
208extern EFI_GUID gEfiTcgProtocolGuid;\r
209\r
210#endif\r