]>
Commit | Line | Data |
---|---|---|
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 | |
5 | Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>\r | |
6 | SPDX-License-Identifier: BSD-2-Clause-Patent\r | |
7 | \r | |
8 | **/\r | |
9 | \r | |
10 | #ifndef _TCG_SERVICE_PROTOCOL_H_\r | |
11 | #define _TCG_SERVICE_PROTOCOL_H_\r | |
12 | \r | |
13 | #include <IndustryStandard/UefiTcgPlatform.h>\r | |
14 | \r | |
15 | #define EFI_TCG_PROTOCOL_GUID \\r | |
16 | {0xf541796d, 0xa62e, 0x4954, { 0xa7, 0x75, 0x95, 0x84, 0xf6, 0x1b, 0x9c, 0xdd } }\r | |
17 | \r | |
18 | typedef struct _EFI_TCG_PROTOCOL EFI_TCG_PROTOCOL;\r | |
19 | \r | |
20 | typedef struct {\r | |
21 | UINT8 Major;\r | |
22 | UINT8 Minor;\r | |
23 | UINT8 RevMajor;\r | |
24 | UINT8 RevMinor;\r | |
25 | } TCG_VERSION;\r | |
26 | \r | |
27 | typedef struct _TCG_EFI_BOOT_SERVICE_CAPABILITY {\r | |
28 | UINT8 Size; /// Size of this structure.\r | |
29 | TCG_VERSION StructureVersion;\r | |
30 | TCG_VERSION ProtocolSpecVersion;\r | |
31 | UINT8 HashAlgorithmBitmap; /// Hash algorithms .\r | |
32 | /// This protocol is capable of : 01=SHA-1.\r | |
33 | BOOLEAN TPMPresentFlag; /// 00h = TPM not present.\r | |
34 | BOOLEAN TPMDeactivatedFlag; /// 01h = TPM currently deactivated.\r | |
35 | } TCG_EFI_BOOT_SERVICE_CAPABILITY;\r | |
36 | \r | |
37 | typedef UINT32 TCG_ALGORITHM_ID;\r | |
38 | \r | |
39 | /**\r | |
40 | This service provides EFI protocol capability information, state information\r | |
41 | about the TPM, and Event Log state information.\r | |
42 | \r | |
43 | @param This Indicates the calling context\r | |
44 | @param ProtocolCapability The callee allocates memory for a TCG_BOOT_SERVICE_CAPABILITY\r | |
45 | structure and fills in the fields with the EFI protocol\r | |
46 | capability information and the current TPM state information.\r | |
47 | @param TCGFeatureFlags This is a pointer to the feature flags. No feature\r | |
48 | flags are currently defined so this parameter\r | |
49 | MUST be set to 0. However, in the future,\r | |
50 | feature flags may be defined that, for example,\r | |
51 | enable hash algorithm agility.\r | |
52 | @param EventLogLocation This is a pointer to the address of the event log in memory.\r | |
53 | @param EventLogLastEntry If the Event Log contains more than one entry,\r | |
54 | this is a pointer to the address of the start of\r | |
55 | the last entry in the event log in memory.\r | |
56 | \r | |
57 | @retval EFI_SUCCESS The operation completed successfully.\r | |
58 | @retval EFI_INVALID_PARAMETER ProtocolCapability does not match TCG capability.\r | |
59 | **/\r | |
60 | typedef\r | |
61 | EFI_STATUS\r | |
62 | (EFIAPI *EFI_TCG_STATUS_CHECK)(\r | |
63 | IN EFI_TCG_PROTOCOL *This,\r | |
64 | OUT TCG_EFI_BOOT_SERVICE_CAPABILITY\r | |
65 | *ProtocolCapability,\r | |
66 | OUT UINT32 *TCGFeatureFlags,\r | |
67 | OUT EFI_PHYSICAL_ADDRESS *EventLogLocation,\r | |
68 | OUT EFI_PHYSICAL_ADDRESS *EventLogLastEntry\r | |
69 | );\r | |
70 | \r | |
71 | /**\r | |
72 | This service abstracts the capability to do a hash operation on a data buffer.\r | |
73 | \r | |
74 | @param This Indicates the calling context.\r | |
75 | @param HashData The pointer to the data buffer to be hashed.\r | |
76 | @param HashDataLen The length of the data buffer to be hashed.\r | |
77 | @param AlgorithmId Identification of the Algorithm to use for the hashing operation.\r | |
78 | @param HashedDataLen Resultant length of the hashed data.\r | |
79 | @param HashedDataResult Resultant buffer of the hashed data.\r | |
80 | \r | |
81 | @retval EFI_SUCCESS The operation completed successfully.\r | |
82 | @retval EFI_INVALID_PARAMETER HashDataLen is NULL.\r | |
83 | @retval EFI_INVALID_PARAMETER HashDataLenResult is NULL.\r | |
84 | @retval EFI_OUT_OF_RESOURCES Cannot allocate buffer of size *HashedDataLen.\r | |
85 | @retval EFI_UNSUPPORTED AlgorithmId not supported.\r | |
86 | @retval EFI_BUFFER_TOO_SMALL *HashedDataLen < sizeof (TCG_DIGEST).\r | |
87 | **/\r | |
88 | typedef\r | |
89 | EFI_STATUS\r | |
90 | (EFIAPI *EFI_TCG_HASH_ALL)(\r | |
91 | IN EFI_TCG_PROTOCOL *This,\r | |
92 | IN UINT8 *HashData,\r | |
93 | IN UINT64 HashDataLen,\r | |
94 | IN TCG_ALGORITHM_ID AlgorithmId,\r | |
95 | IN OUT UINT64 *HashedDataLen,\r | |
96 | IN OUT UINT8 **HashedDataResult\r | |
97 | );\r | |
98 | \r | |
99 | /**\r | |
100 | This service abstracts the capability to add an entry to the Event Log.\r | |
101 | \r | |
102 | @param This Indicates the calling context\r | |
103 | @param TCGLogData The pointer to the start of the data buffer containing\r | |
104 | the TCG_PCR_EVENT data structure. All fields in\r | |
105 | this structure are properly filled by the caller.\r | |
106 | @param EventNumber The event number of the event just logged.\r | |
107 | @param Flags Indicates additional flags. Only one flag has been\r | |
108 | defined at this time, which is 0x01 and means the\r | |
109 | extend operation should not be performed. All\r | |
110 | other bits are reserved.\r | |
111 | \r | |
112 | @retval EFI_SUCCESS The operation completed successfully.\r | |
113 | @retval EFI_OUT_OF_RESOURCES Insufficient memory in the event log to complete this action.\r | |
114 | **/\r | |
115 | typedef\r | |
116 | EFI_STATUS\r | |
117 | (EFIAPI *EFI_TCG_LOG_EVENT)(\r | |
118 | IN EFI_TCG_PROTOCOL *This,\r | |
119 | IN TCG_PCR_EVENT *TCGLogData,\r | |
120 | IN OUT UINT32 *EventNumber,\r | |
121 | IN UINT32 Flags\r | |
122 | );\r | |
123 | \r | |
124 | /**\r | |
125 | This service is a proxy for commands to the TPM.\r | |
126 | \r | |
127 | @param This Indicates the calling context.\r | |
128 | @param TpmInputParameterBlockSize Size of the TPM input parameter block.\r | |
129 | @param TpmInputParameterBlock The pointer to the TPM input parameter block.\r | |
130 | @param TpmOutputParameterBlockSize Size of the TPM output parameter block.\r | |
131 | @param TpmOutputParameterBlock The pointer to the TPM output parameter block.\r | |
132 | \r | |
133 | @retval EFI_SUCCESS The operation completed successfully.\r | |
134 | @retval EFI_INVALID_PARAMETER Invalid ordinal.\r | |
135 | @retval EFI_UNSUPPORTED Current Task Priority Level >= EFI_TPL_CALLBACK.\r | |
136 | @retval EFI_TIMEOUT The TIS timed-out.\r | |
137 | **/\r | |
138 | typedef\r | |
139 | EFI_STATUS\r | |
140 | (EFIAPI *EFI_TCG_PASS_THROUGH_TO_TPM)(\r | |
141 | IN EFI_TCG_PROTOCOL *This,\r | |
142 | IN UINT32 TpmInputParameterBlockSize,\r | |
143 | IN UINT8 *TpmInputParameterBlock,\r | |
144 | IN UINT32 TpmOutputParameterBlockSize,\r | |
145 | IN UINT8 *TpmOutputParameterBlock\r | |
146 | );\r | |
147 | \r | |
148 | /**\r | |
149 | 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 | |
150 | \r | |
151 | @param This Indicates the calling context\r | |
152 | @param HashData The physical address of the start of the data buffer\r | |
153 | to be hashed, extended, and logged.\r | |
154 | @param HashDataLen The length, in bytes, of the buffer referenced by HashData\r | |
155 | @param AlgorithmId Identification of the Algorithm to use for the hashing operation\r | |
156 | @param TCGLogData The physical address of the start of the data\r | |
157 | buffer containing the TCG_PCR_EVENT data structure.\r | |
158 | @param EventNumber The event number of the event just logged.\r | |
159 | @param EventLogLastEntry The physical address of the first byte of the entry\r | |
160 | just placed in the Event Log. If the Event Log was\r | |
161 | empty when this function was called then this physical\r | |
162 | address will be the same as the physical address of\r | |
163 | the start of the Event Log.\r | |
164 | \r | |
165 | @retval EFI_SUCCESS The operation completed successfully.\r | |
166 | @retval EFI_UNSUPPORTED AlgorithmId != TPM_ALG_SHA.\r | |
167 | @retval EFI_UNSUPPORTED Current TPL >= EFI_TPL_CALLBACK.\r | |
168 | @retval EFI_DEVICE_ERROR The command was unsuccessful.\r | |
169 | **/\r | |
170 | typedef\r | |
171 | EFI_STATUS\r | |
172 | (EFIAPI *EFI_TCG_HASH_LOG_EXTEND_EVENT)(\r | |
173 | IN EFI_TCG_PROTOCOL *This,\r | |
174 | IN EFI_PHYSICAL_ADDRESS HashData,\r | |
175 | IN UINT64 HashDataLen,\r | |
176 | IN TCG_ALGORITHM_ID AlgorithmId,\r | |
177 | IN OUT TCG_PCR_EVENT *TCGLogData,\r | |
178 | IN OUT UINT32 *EventNumber,\r | |
179 | OUT EFI_PHYSICAL_ADDRESS *EventLogLastEntry\r | |
180 | );\r | |
181 | \r | |
182 | ///\r | |
183 | /// The EFI_TCG Protocol abstracts TCG activity.\r | |
184 | ///\r | |
185 | struct _EFI_TCG_PROTOCOL {\r | |
186 | EFI_TCG_STATUS_CHECK StatusCheck;\r | |
187 | EFI_TCG_HASH_ALL HashAll;\r | |
188 | EFI_TCG_LOG_EVENT LogEvent;\r | |
189 | EFI_TCG_PASS_THROUGH_TO_TPM PassThroughToTpm;\r | |
190 | EFI_TCG_HASH_LOG_EXTEND_EVENT HashLogExtendEvent;\r | |
191 | };\r | |
192 | \r | |
193 | extern EFI_GUID gEfiTcgProtocolGuid;\r | |
194 | \r | |
195 | #endif\r |