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