1 /** @file
2   TCG PPI services.
3 
4 Copyright (c) 2020, Intel Corporation. All rights reserved.<BR>
5 SPDX-License-Identifier: BSD-2-Clause-Patent
6 
7 **/
8 
9 #ifndef _TCG_PPI_H_
10 #define _TCG_PPI_H_
11 
12 #include <IndustryStandard/UefiTcgPlatform.h>
13 
14 typedef struct _EDKII_TCG_PPI EDKII_TCG_PPI;
15 
16 //
17 // This bit is shall be set when HashData is the pre-hash digest.
18 //
19 #define EDKII_TCG_PRE_HASH  0x0000000000000001
20 
21 //
22 // This bit is shall be set when HashData is the pre-hash digest and log only.
23 //
24 #define EDKII_TCG_PRE_HASH_LOG_ONLY  0x0000000000000002
25 
26 /**
27   Tpm measure and log data, and extend the measurement result into a specific PCR.
28 
29   @param[in]      This          Indicates the calling context
30   @param[in]      Flags         Bitmap providing additional information
31   @param[in]      HashData      If BIT0 of Flags is 0, it is physical address of the
32                                 start of the data buffer to be hashed, extended, and logged.
33                                 If BIT0 of Flags is 1, it is physical address of the
34                                 start of the pre-hash data buffter to be extended, and logged.
35                                 The pre-hash data format is TPML_DIGEST_VALUES.
36   @param[in]      HashDataLen   The length, in bytes, of the buffer referenced by HashData.
37   @param[in]      NewEventHdr   Pointer to a TCG_PCR_EVENT_HDR data structure.
38   @param[in]      NewEventData  Pointer to the new event data.
39 
40   @retval EFI_SUCCESS           Operation completed successfully.
41   @retval EFI_UNSUPPORTED       TPM device not available.
42   @retval EFI_OUT_OF_RESOURCES  Out of memory.
43   @retval EFI_DEVICE_ERROR      The operation was unsuccessful.
44 **/
45 typedef
46 EFI_STATUS
47 (EFIAPI *EDKII_TCG_HASH_LOG_EXTEND_EVENT)(
48   IN      EDKII_TCG_PPI             *This,
49   IN      UINT64                    Flags,
50   IN      UINT8                     *HashData,
51   IN      UINTN                     HashDataLen,
52   IN      TCG_PCR_EVENT_HDR         *NewEventHdr,
53   IN      UINT8                     *NewEventData
54   );
55 
56 ///
57 /// The EFI_TCG Protocol abstracts TCG activity.
58 ///
59 struct _EDKII_TCG_PPI {
60   EDKII_TCG_HASH_LOG_EXTEND_EVENT     HashLogExtendEvent;
61 };
62 
63 extern EFI_GUID gEdkiiTcgPpiGuid;
64 
65 #endif
66