]>
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 | |
956f71b6 | 5 | Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.<BR>\r |
af2dc6a7 | 6 | This program and the accompanying materials are licensed and made available under \r |
7 | the terms and conditions of the BSD License that accompanies this distribution. \r | |
8 | 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 | |
ac644614 | 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 | |
f6d2bcc6 | 19 | #include <IndustryStandard/UefiTcgPlatform.h>\r |
267669ba LG |
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 | |
267669ba LG |
26 | typedef struct {\r |
27 | UINT8 Major;\r | |
28 | UINT8 Minor;\r | |
29 | UINT8 RevMajor;\r | |
30 | UINT8 RevMinor;\r | |
31 | } TCG_VERSION;\r | |
32 | \r | |
33 | typedef struct _TCG_EFI_BOOT_SERVICE_CAPABILITY {\r | |
af2dc6a7 | 34 | UINT8 Size; /// Size of this structure.\r |
267669ba LG |
35 | TCG_VERSION StructureVersion; \r |
36 | TCG_VERSION ProtocolSpecVersion;\r | |
af2dc6a7 | 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 | |
43 | typedef 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 | |
af2dc6a7 | 63 | @retval EFI_SUCCESS The operation completed successfully.\r |
65d02573 | 64 | @retval EFI_INVALID_PARAMETER ProtocolCapability does not match TCG capability.\r |
8069d49e | 65 | **/\r |
267669ba LG |
66 | typedef\r |
67 | EFI_STATUS\r | |
8b13229b | 68 | (EFIAPI *EFI_TCG_STATUS_CHECK)(\r |
267669ba LG |
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 | |
8069d49e LG |
77 | /**\r |
78 | This service abstracts the capability to do a hash operation on a data buffer.\r | |
79 | \r | |
af2dc6a7 | 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 | |
8069d49e | 86 | \r |
af2dc6a7 | 87 | @retval EFI_SUCCESS The operation completed successfully.\r |
65d02573 | 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 | |
8069d49e | 93 | **/\r |
267669ba LG |
94 | typedef\r |
95 | EFI_STATUS\r | |
8b13229b | 96 | (EFIAPI *EFI_TCG_HASH_ALL)(\r |
267669ba LG |
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 | |
8069d49e LG |
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 | |
af2dc6a7 | 109 | @param TCGLogData The pointer to the start of the data buffer containing \r |
8069d49e LG |
110 | the TCG_PCR_EVENT data structure. All fields in \r |
111 | this structure are properly filled by the caller.\r | |
af2dc6a7 | 112 | @param EventNumber The event number of the event just logged.\r |
113 | @param Flags Indicates additional flags. Only one flag has been \r | |
8069d49e LG |
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 | |
af2dc6a7 | 118 | @retval EFI_SUCCESS The operation completed successfully.\r |
65d02573 | 119 | @retval EFI_OUT_OF_RESOURCES Insufficient memory in the event log to complete this action.\r |
8069d49e | 120 | **/\r |
267669ba LG |
121 | typedef\r |
122 | EFI_STATUS\r | |
8b13229b | 123 | (EFIAPI *EFI_TCG_LOG_EVENT)(\r |
267669ba LG |
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 | |
8069d49e LG |
130 | /**\r |
131 | This service is a proxy for commands to the TPM.\r | |
132 | \r | |
af2dc6a7 | 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 | |
8069d49e | 138 | \r |
af2dc6a7 | 139 | @retval EFI_SUCCESS The operation completed successfully.\r |
65d02573 | 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 | |
8069d49e | 143 | **/\r |
267669ba LG |
144 | typedef\r |
145 | EFI_STATUS\r | |
8b13229b | 146 | (EFIAPI *EFI_TCG_PASS_THROUGH_TO_TPM)(\r |
267669ba | 147 | IN EFI_TCG_PROTOCOL *This,\r |
b36e4814 | 148 | IN UINT32 TpmInputParameterBlockSize,\r |
149 | IN UINT8 *TpmInputParameterBlock,\r | |
267669ba LG |
150 | IN UINT32 TpmOutputParameterBlockSize,\r |
151 | IN UINT8 *TpmOutputParameterBlock\r | |
152 | );\r | |
153 | \r | |
8069d49e LG |
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 | |
af2dc6a7 | 158 | @param HashData The physical address of the start of the data buffer \r |
8069d49e LG |
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 | |
af2dc6a7 | 165 | @param EventLogLastEntry The physical address of the first byte of the entry \r |
8069d49e LG |
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 | |
af2dc6a7 | 171 | @retval EFI_SUCCESS The operation completed successfully.\r |
65d02573 | 172 | @retval EFI_UNSUPPORTED AlgorithmId != TPM_ALG_SHA.\r |
173 | @retval EFI_UNSUPPORTED Current TPL >= EFI_TPL_CALLBACK.\r | |
8069d49e | 174 | @retval EFI_DEVICE_ERROR The command was unsuccessful.\r |
8069d49e | 175 | **/\r |
267669ba LG |
176 | typedef\r |
177 | EFI_STATUS\r | |
8b13229b | 178 | (EFIAPI *EFI_TCG_HASH_LOG_EXTEND_EVENT)(\r |
267669ba | 179 | IN EFI_TCG_PROTOCOL *This,\r |
5397fc66 | 180 | IN EFI_PHYSICAL_ADDRESS HashData,\r |
267669ba LG |
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 | |
44717a39 | 188 | ///\r |
189 | /// The EFI_TCG Protocol abstracts TCG activity.\r | |
190 | ///\r | |
c28a5554 | 191 | struct _EFI_TCG_PROTOCOL {\r |
267669ba LG |
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 | |
c28a5554 | 197 | };\r |
267669ba LG |
198 | \r |
199 | extern EFI_GUID gEfiTcgProtocolGuid;\r | |
200 | \r | |
201 | #endif\r |