]>
Commit | Line | Data |
---|---|---|
ac644614 | 1 | /** @file\r |
956f71b6 | 2 | TCG Service Protocol as defined in TCG_EFI_Protocol_1_22_Final\r |
ac644614 | 3 | See http://trustedcomputinggroup.org for the latest specification\r |
4 | \r | |
9095d37b | 5 | Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>\r |
9344f092 | 6 | SPDX-License-Identifier: BSD-2-Clause-Patent\r |
ac644614 | 7 | \r |
8069d49e | 8 | **/\r |
267669ba LG |
9 | \r |
10 | #ifndef _TCG_SERVICE_PROTOCOL_H_\r | |
11 | #define _TCG_SERVICE_PROTOCOL_H_\r | |
12 | \r | |
f6d2bcc6 | 13 | #include <IndustryStandard/UefiTcgPlatform.h>\r |
267669ba LG |
14 | \r |
15 | #define EFI_TCG_PROTOCOL_GUID \\r | |
9095d37b | 16 | {0xf541796d, 0xa62e, 0x4954, { 0xa7, 0x75, 0x95, 0x84, 0xf6, 0x1b, 0x9c, 0xdd } }\r |
267669ba LG |
17 | \r |
18 | typedef struct _EFI_TCG_PROTOCOL EFI_TCG_PROTOCOL;\r | |
19 | \r | |
267669ba | 20 | typedef struct {\r |
2f88bd3a MK |
21 | UINT8 Major;\r |
22 | UINT8 Minor;\r | |
23 | UINT8 RevMajor;\r | |
24 | UINT8 RevMinor;\r | |
267669ba LG |
25 | } TCG_VERSION;\r |
26 | \r | |
27 | typedef struct _TCG_EFI_BOOT_SERVICE_CAPABILITY {\r | |
af2dc6a7 | 28 | UINT8 Size; /// Size of this structure.\r |
9095d37b | 29 | TCG_VERSION StructureVersion;\r |
267669ba | 30 | TCG_VERSION ProtocolSpecVersion;\r |
9095d37b | 31 | UINT8 HashAlgorithmBitmap; /// Hash algorithms .\r |
af2dc6a7 | 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 | |
267669ba LG |
35 | } TCG_EFI_BOOT_SERVICE_CAPABILITY;\r |
36 | \r | |
2f88bd3a | 37 | typedef UINT32 TCG_ALGORITHM_ID;\r |
267669ba | 38 | \r |
8069d49e | 39 | /**\r |
9095d37b | 40 | This service provides EFI protocol capability information, state information\r |
8069d49e LG |
41 | about the TPM, and Event Log state information.\r |
42 | \r | |
43 | @param This Indicates the calling context\r | |
9095d37b LG |
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 | |
8069d49e | 46 | capability information and the current TPM state information.\r |
9095d37b LG |
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 | |
8069d49e LG |
51 | enable hash algorithm agility.\r |
52 | @param EventLogLocation This is a pointer to the address of the event log in memory.\r | |
9095d37b LG |
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 | |
8069d49e | 56 | \r |
af2dc6a7 | 57 | @retval EFI_SUCCESS The operation completed successfully.\r |
65d02573 | 58 | @retval EFI_INVALID_PARAMETER ProtocolCapability does not match TCG capability.\r |
8069d49e | 59 | **/\r |
267669ba LG |
60 | typedef\r |
61 | EFI_STATUS\r | |
8b13229b | 62 | (EFIAPI *EFI_TCG_STATUS_CHECK)(\r |
267669ba LG |
63 | IN EFI_TCG_PROTOCOL *This,\r |
64 | OUT TCG_EFI_BOOT_SERVICE_CAPABILITY\r | |
2f88bd3a | 65 | *ProtocolCapability,\r |
267669ba LG |
66 | OUT UINT32 *TCGFeatureFlags,\r |
67 | OUT EFI_PHYSICAL_ADDRESS *EventLogLocation,\r | |
68 | OUT EFI_PHYSICAL_ADDRESS *EventLogLastEntry\r | |
69 | );\r | |
70 | \r | |
8069d49e LG |
71 | /**\r |
72 | This service abstracts the capability to do a hash operation on a data buffer.\r | |
9095d37b | 73 | \r |
af2dc6a7 | 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 | |
9095d37b | 80 | \r |
af2dc6a7 | 81 | @retval EFI_SUCCESS The operation completed successfully.\r |
65d02573 | 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 | |
8069d49e | 87 | **/\r |
267669ba LG |
88 | typedef\r |
89 | EFI_STATUS\r | |
8b13229b | 90 | (EFIAPI *EFI_TCG_HASH_ALL)(\r |
267669ba LG |
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 | |
8069d49e LG |
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 | |
9095d37b LG |
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 | |
8069d49e | 105 | this structure are properly filled by the caller.\r |
af2dc6a7 | 106 | @param EventNumber The event number of the event just logged.\r |
9095d37b LG |
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 | |
af2dc6a7 | 112 | @retval EFI_SUCCESS The operation completed successfully.\r |
65d02573 | 113 | @retval EFI_OUT_OF_RESOURCES Insufficient memory in the event log to complete this action.\r |
8069d49e | 114 | **/\r |
267669ba LG |
115 | typedef\r |
116 | EFI_STATUS\r | |
8b13229b | 117 | (EFIAPI *EFI_TCG_LOG_EVENT)(\r |
267669ba LG |
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 | |
8069d49e LG |
124 | /**\r |
125 | This service is a proxy for commands to the TPM.\r | |
126 | \r | |
af2dc6a7 | 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 | |
8069d49e | 132 | \r |
af2dc6a7 | 133 | @retval EFI_SUCCESS The operation completed successfully.\r |
65d02573 | 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 | |
8069d49e | 137 | **/\r |
267669ba LG |
138 | typedef\r |
139 | EFI_STATUS\r | |
8b13229b | 140 | (EFIAPI *EFI_TCG_PASS_THROUGH_TO_TPM)(\r |
267669ba | 141 | IN EFI_TCG_PROTOCOL *This,\r |
b36e4814 | 142 | IN UINT32 TpmInputParameterBlockSize,\r |
143 | IN UINT8 *TpmInputParameterBlock,\r | |
267669ba LG |
144 | IN UINT32 TpmOutputParameterBlockSize,\r |
145 | IN UINT8 *TpmOutputParameterBlock\r | |
146 | );\r | |
147 | \r | |
8069d49e LG |
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 | |
9095d37b | 152 | @param HashData The physical address of the start of the data buffer\r |
8069d49e LG |
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 | |
9095d37b | 156 | @param TCGLogData The physical address of the start of the data\r |
8069d49e LG |
157 | buffer containing the TCG_PCR_EVENT data structure.\r |
158 | @param EventNumber The event number of the event just logged.\r | |
9095d37b LG |
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 | |
8069d49e LG |
163 | the start of the Event Log.\r |
164 | \r | |
af2dc6a7 | 165 | @retval EFI_SUCCESS The operation completed successfully.\r |
65d02573 | 166 | @retval EFI_UNSUPPORTED AlgorithmId != TPM_ALG_SHA.\r |
167 | @retval EFI_UNSUPPORTED Current TPL >= EFI_TPL_CALLBACK.\r | |
8069d49e | 168 | @retval EFI_DEVICE_ERROR The command was unsuccessful.\r |
8069d49e | 169 | **/\r |
267669ba LG |
170 | typedef\r |
171 | EFI_STATUS\r | |
8b13229b | 172 | (EFIAPI *EFI_TCG_HASH_LOG_EXTEND_EVENT)(\r |
267669ba | 173 | IN EFI_TCG_PROTOCOL *This,\r |
5397fc66 | 174 | IN EFI_PHYSICAL_ADDRESS HashData,\r |
267669ba LG |
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 | |
2f88bd3a | 179 | OUT EFI_PHYSICAL_ADDRESS *EventLogLastEntry\r |
267669ba LG |
180 | );\r |
181 | \r | |
44717a39 | 182 | ///\r |
183 | /// The EFI_TCG Protocol abstracts TCG activity.\r | |
184 | ///\r | |
c28a5554 | 185 | struct _EFI_TCG_PROTOCOL {\r |
2f88bd3a MK |
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 | |
c28a5554 | 191 | };\r |
267669ba | 192 | \r |
2f88bd3a | 193 | extern EFI_GUID gEfiTcgProtocolGuid;\r |
267669ba LG |
194 | \r |
195 | #endif\r |