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