]> git.proxmox.com Git - mirror_edk2.git/blame_incremental - MdePkg/Include/Protocol/TcgService.h
MdePkg: Add definition for new warning code EFI_WARN_FILE_SYSTEM.
[mirror_edk2.git] / MdePkg / Include / Protocol / TcgService.h
... / ...
CommitLineData
1/** @file\r
2 TCG Service Protocol as defined in TCG_EFI_Protocol_1_22_Final\r
3 See http://trustedcomputinggroup.org for the latest specification\r
4\r
5Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.<BR>\r
6This program and the accompanying materials are licensed and made available under \r
7the terms and conditions of the BSD License that accompanies this distribution. \r
8The full text of the license may be found at\r
9http://opensource.org/licenses/bsd-license.php. \r
10 \r
11THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r
12WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
13\r
14**/\r
15\r
16#ifndef _TCG_SERVICE_PROTOCOL_H_\r
17#define _TCG_SERVICE_PROTOCOL_H_\r
18\r
19#include <IndustryStandard/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
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
34 UINT8 Size; /// Size of this structure.\r
35 TCG_VERSION StructureVersion; \r
36 TCG_VERSION ProtocolSpecVersion;\r
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
41} TCG_EFI_BOOT_SERVICE_CAPABILITY;\r
42\r
43typedef UINT32 TCG_ALGORITHM_ID;\r
44\r
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 The operation completed successfully.\r
64 @retval EFI_INVALID_PARAMETER ProtocolCapability does not match TCG capability.\r
65**/\r
66typedef\r
67EFI_STATUS\r
68(EFIAPI *EFI_TCG_STATUS_CHECK)(\r
69 IN EFI_TCG_PROTOCOL *This,\r
70 OUT TCG_EFI_BOOT_SERVICE_CAPABILITY\r
71 *ProtocolCapability,\r
72 OUT UINT32 *TCGFeatureFlags,\r
73 OUT EFI_PHYSICAL_ADDRESS *EventLogLocation,\r
74 OUT EFI_PHYSICAL_ADDRESS *EventLogLastEntry\r
75 );\r
76\r
77/**\r
78 This service abstracts the capability to do a hash operation on a data buffer.\r
79 \r
80 @param This Indicates the calling context.\r
81 @param HashData The pointer to the data buffer to be hashed.\r
82 @param HashDataLen The length of the data buffer to be hashed.\r
83 @param AlgorithmId Identification of the Algorithm to use for the hashing operation.\r
84 @param HashedDataLen Resultant length of the hashed data.\r
85 @param HashedDataResult Resultant buffer of the hashed data.\r
86 \r
87 @retval EFI_SUCCESS The operation completed successfully.\r
88 @retval EFI_INVALID_PARAMETER HashDataLen is NULL.\r
89 @retval EFI_INVALID_PARAMETER HashDataLenResult is NULL.\r
90 @retval EFI_OUT_OF_RESOURCES Cannot allocate buffer of size *HashedDataLen.\r
91 @retval EFI_UNSUPPORTED AlgorithmId not supported.\r
92 @retval EFI_BUFFER_TOO_SMALL *HashedDataLen < sizeof (TCG_DIGEST).\r
93**/\r
94typedef\r
95EFI_STATUS\r
96(EFIAPI *EFI_TCG_HASH_ALL)(\r
97 IN EFI_TCG_PROTOCOL *This,\r
98 IN UINT8 *HashData,\r
99 IN UINT64 HashDataLen,\r
100 IN TCG_ALGORITHM_ID AlgorithmId,\r
101 IN OUT UINT64 *HashedDataLen,\r
102 IN OUT UINT8 **HashedDataResult\r
103 );\r
104\r
105/**\r
106 This service abstracts the capability to add an entry to the Event Log.\r
107\r
108 @param This Indicates the calling context\r
109 @param TCGLogData The pointer to the start of the data buffer containing \r
110 the TCG_PCR_EVENT data structure. All fields in \r
111 this structure are properly filled by the caller.\r
112 @param EventNumber The event number of the event just logged.\r
113 @param Flags Indicates additional flags. Only one flag has been \r
114 defined at this time, which is 0x01 and means the \r
115 extend operation should not be performed. All \r
116 other bits are reserved. \r
117 \r
118 @retval EFI_SUCCESS The operation completed successfully.\r
119 @retval EFI_OUT_OF_RESOURCES Insufficient memory in the event log to complete this action.\r
120**/\r
121typedef\r
122EFI_STATUS\r
123(EFIAPI *EFI_TCG_LOG_EVENT)(\r
124 IN EFI_TCG_PROTOCOL *This,\r
125 IN TCG_PCR_EVENT *TCGLogData,\r
126 IN OUT UINT32 *EventNumber,\r
127 IN UINT32 Flags\r
128 );\r
129\r
130/**\r
131 This service is a proxy for commands to the TPM.\r
132\r
133 @param This Indicates the calling context.\r
134 @param TpmInputParameterBlockSize Size of the TPM input parameter block.\r
135 @param TpmInputParameterBlock The pointer to the TPM input parameter block.\r
136 @param TpmOutputParameterBlockSize Size of the TPM output parameter block.\r
137 @param TpmOutputParameterBlock The pointer to the TPM output parameter block.\r
138\r
139 @retval EFI_SUCCESS The operation completed successfully.\r
140 @retval EFI_INVALID_PARAMETER Invalid ordinal.\r
141 @retval EFI_UNSUPPORTED Current Task Priority Level >= EFI_TPL_CALLBACK.\r
142 @retval EFI_TIMEOUT The TIS timed-out.\r
143**/\r
144typedef\r
145EFI_STATUS\r
146(EFIAPI *EFI_TCG_PASS_THROUGH_TO_TPM)(\r
147 IN EFI_TCG_PROTOCOL *This,\r
148 IN UINT32 TpmInputParameterBlockSize,\r
149 IN UINT8 *TpmInputParameterBlock,\r
150 IN UINT32 TpmOutputParameterBlockSize,\r
151 IN UINT8 *TpmOutputParameterBlock\r
152 );\r
153\r
154/**\r
155 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
156\r
157 @param This Indicates the calling context\r
158 @param HashData The physical address of the start of the data buffer \r
159 to be hashed, extended, and logged.\r
160 @param HashDataLen The length, in bytes, of the buffer referenced by HashData\r
161 @param AlgorithmId Identification of the Algorithm to use for the hashing operation\r
162 @param TCGLogData The physical address of the start of the data \r
163 buffer containing the TCG_PCR_EVENT data structure.\r
164 @param EventNumber The event number of the event just logged.\r
165 @param EventLogLastEntry The physical address of the first byte of the entry \r
166 just placed in the Event Log. If the Event Log was \r
167 empty when this function was called then this physical \r
168 address will be the same as the physical address of \r
169 the start of the Event Log.\r
170\r
171 @retval EFI_SUCCESS The operation completed successfully.\r
172 @retval EFI_UNSUPPORTED AlgorithmId != TPM_ALG_SHA.\r
173 @retval EFI_UNSUPPORTED Current TPL >= EFI_TPL_CALLBACK.\r
174 @retval EFI_DEVICE_ERROR The command was unsuccessful.\r
175**/\r
176typedef\r
177EFI_STATUS\r
178(EFIAPI *EFI_TCG_HASH_LOG_EXTEND_EVENT)(\r
179 IN EFI_TCG_PROTOCOL *This,\r
180 IN EFI_PHYSICAL_ADDRESS HashData,\r
181 IN UINT64 HashDataLen,\r
182 IN TCG_ALGORITHM_ID AlgorithmId,\r
183 IN OUT TCG_PCR_EVENT *TCGLogData,\r
184 IN OUT UINT32 *EventNumber,\r
185 OUT EFI_PHYSICAL_ADDRESS *EventLogLastEntry\r
186 );\r
187\r
188///\r
189/// The EFI_TCG Protocol abstracts TCG activity.\r
190///\r
191struct _EFI_TCG_PROTOCOL {\r
192 EFI_TCG_STATUS_CHECK StatusCheck;\r
193 EFI_TCG_HASH_ALL HashAll;\r
194 EFI_TCG_LOG_EVENT LogEvent;\r
195 EFI_TCG_PASS_THROUGH_TO_TPM PassThroughToTpm;\r
196 EFI_TCG_HASH_LOG_EXTEND_EVENT HashLogExtendEvent;\r
197};\r
198\r
199extern EFI_GUID gEfiTcgProtocolGuid;\r
200\r
201#endif\r