Looks good to me.
For others' reference, the change has been already verified by running 
SystemReady SIE (Security Interface extension) tests on multiple SystemReady 
certified Arm systems.
Reviewed-by: Sunny Wang <sunny.w...@arm.com>

-----Original Message-----
From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Stuart Yoder via 
groups.io
Sent: Tuesday, January 9, 2024 12:21 PM
To: devel@edk2.groups.io; G Edhaya Chandran <edhaya.chand...@arm.com>; 
gao...@byosoft.com.cn
Cc: ilias.apalodi...@linaro.org; heinrich.schucha...@canonical.com; Samer 
El-Haj-Mahmoud <samer.el-haj-mahm...@arm.com>; jiewen....@intel.com
Subject: [edk2-devel] [PATCH v2 1/6] uefi-sct/SctPkg: TCG2 Protocol: add header 
with TCG2 protocol definitions

From: Joseph Hemann <joseph.hem...@arm.com>

Define constants and data structure specified in the TCG EFI Protocol
specification.

Signed-off-by: Joseph Hemann <joseph.hem...@arm.com>
Signed-off-by: Stuart Yoder <stuart.yo...@arm.com>
---
 uefi-sct/SctPkg/UEFI/Protocol/TCG2.h | 177 ++++++++++++++++++++
 1 file changed, 177 insertions(+)

diff --git a/uefi-sct/SctPkg/UEFI/Protocol/TCG2.h 
b/uefi-sct/SctPkg/UEFI/Protocol/TCG2.h
new file mode 100644
index 000000000000..e62ecd85cbe9
--- /dev/null
+++ b/uefi-sct/SctPkg/UEFI/Protocol/TCG2.h
@@ -0,0 +1,177 @@
+/** @file

+

+  Copyright 2006 - 2016 Unified EFI, Inc.<BR>

+  Copyright (c) 2013 - 2016, Intel Corporation. All rights reserved.<BR>

+  Copyright (c) 2021 - 2023, Arm Inc. All rights reserved.<BR>

+

+  This program and the accompanying materials

+  are licensed and made available under the terms and conditions of the BSD 
License

+  which accompanies this distribution.  The full text of the license may be 
found at

+  http://opensource.org/licenses/bsd-license.php

+

+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,

+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.

+

+**/

+/*++

+

+Module Name:

+

+  TCG2.h

+

+Abstract:

+

+  EFI TCG Protocol

+

+--*/

+

+

+#ifndef __TCG2_PROTOCOL_H__

+#define __TCG2_PROTOCOL_H__

+

+//

+// Global ID for the TCG2 Protocol

+//

+#define EFI_TCG2_PROTOCOL_GUID    \

+   {0x607f766c, 0x7455, 0x42be, {0x93, 0x0b, 0xe4, 0xd7, 0x6d, 0xb2, 0x72, 
0x0f}}

+

+// Following defintions come from TCG2 Efi Protocol Spec

+#define EFI_TCG2_BOOT_HASH_ALG_SHA1 0x00000001

+

+#define EFI_TCG2_BOOT_HASH_ALG_SHA256 0x00000002

+

+#define EFI_TCG2_BOOT_HASH_ALG_SHA384 0x00000004

+

+#define EFI_TCG2_BOOT_HASH_ALG_SHA512 0x00000008

+

+#define EFI_TCG2_BOOT_HASH_ALG_SM3_256 0x00000010

+

+#define EFI_TCG2_EVENT_LOG_FORMAT_TCG_1_2 0x00000001

+

+#define EFI_TCG2_EVENT_LOG_FORMAT_TCG_2 0x00000002

+

+typedef struct _EFI_TCG2_PROTOCOL EFI_TCG2_PROTOCOL;

+

+typedef UINT32 EFI_TCG2_EVENT_LOG_BITMAP;

+

+typedef UINT32 EFI_TCG2_EVENT_LOG_FORMAT;

+

+typedef UINT32 EFI_TCG2_EVENT_ALGORITHM_BITMAP;

+

+typedef UINT32 TCG_PCRINDEX;

+

+typedef UINT32 TCG_EVENTTYPE;

+

+// Following struct defintions come from TCG2 Efi Protocol Spec

+typedef struct {

+  UINT8 Major;

+  UINT8 Minor;

+} EFI_TCG2_VERSION;

+

+typedef struct {

+  UINT8 Size;

+  EFI_TCG2_VERSION StructureVersion;

+  EFI_TCG2_VERSION ProtocolVersion;

+  EFI_TCG2_EVENT_ALGORITHM_BITMAP HashAlgorithmBitmap;

+  EFI_TCG2_EVENT_LOG_BITMAP SupportedEventLogs;

+  BOOLEAN TPMPresentFlag;

+  UINT16 MaxCommandSize;

+  UINT16 MaxResponseSize;

+  UINT32 ManufacturerID;

+  UINT32 NumberOfPcrBanks;

+  EFI_TCG2_EVENT_ALGORITHM_BITMAP ActivePcrBanks;

+} EFI_TCG2_BOOT_SERVICE_CAPABILITY;

+

+typedef

+EFI_STATUS

+(EFIAPI *EFI_TCG2_GET_CAPABILITY) (

+  IN EFI_TCG2_PROTOCOL *This,

+  IN OUT EFI_TCG2_BOOT_SERVICE_CAPABILITY *ProtocolCapability

+);

+

+typedef

+EFI_STATUS

+(EFIAPI *EFI_TCG2_GET_EVENT_LOG) (

+  IN EFI_TCG2_PROTOCOL *This,

+  IN EFI_TCG2_EVENT_LOG_FORMAT EventLogFormat,

+  OUT EFI_PHYSICAL_ADDRESS *EventLogLocation,

+  OUT EFI_PHYSICAL_ADDRESS *EventLogLastEntry,

+  OUT BOOLEAN *EventLogTruncated

+);

+

+// all structs except EFI_TCG2_BOOT_SERVICE_CAPABILITY are packed

+#pragma pack(1)

+

+typedef struct tdEFI_TCG2_EVENT_HEADER {

+  UINT32 HeaderSize;

+  UINT16 HeaderVersion;

+  TCG_PCRINDEX PCRIndex;

+  TCG_EVENTTYPE EventType;

+} EFI_TCG2_EVENT_HEADER;

+

+typedef struct tdEFI_TCG2_EVENT {

+  UINT32 Size;

+  EFI_TCG2_EVENT_HEADER Header;

+  UINT8 Event[];

+} EFI_TCG2_EVENT;

+

+#pragma pack()

+

+typedef

+EFI_STATUS

+(EFIAPI * EFI_TCG2_HASH_LOG_EXTEND_EVENT) (

+  IN EFI_TCG2_PROTOCOL *This,

+  IN UINT64 Flags,

+  IN EFI_PHYSICAL_ADDRESS DataToHash,

+  IN UINT64 DataToHashLen,

+  IN EFI_TCG2_EVENT *EfiTcgEvent

+);

+

+typedef

+EFI_STATUS

+(EFIAPI *EFI_TCG2_SUBMIT_COMMAND) (

+  IN EFI_TCG2_PROTOCOL *This,

+  IN UINT32 InputParameterBlockSize,

+  IN UINT8 *InputParameterBlock,

+  IN UINT32 OutputParameterBlockSize,

+  IN UINT8 *OutputParameterBlock

+);

+

+typedef

+EFI_STATUS

+(EFIAPI *EFI_TCG2_GET_ACTIVE_PCR_BANKS) (

+  IN EFI_TCG2_PROTOCOL *This,

+  OUT UINT32 *ActivePcrBanks

+);

+

+typedef

+EFI_STATUS

+(EFIAPI *EFI_TCG2_SET_ACTIVE_PCR_BANKS) (

+  IN EFI_TCG2_PROTOCOL *This,

+  IN UINT32 ActivePcrBanks

+);

+

+typedef

+EFI_STATUS

+(EFIAPI * EFI_TCG2_GET_RESULT_OF_SET_ACTIVE_PCR_BANKS) (

+  IN EFI_TCG2_PROTOCOL *This,

+  OUT UINT32 *OperationPresent,

+  OUT UINT32 *Response

+);

+

+//

+// Interface structure for the TCG2 Protocol

+//

+struct _EFI_TCG2_PROTOCOL {

+  EFI_TCG2_GET_CAPABILITY GetCapability;

+  EFI_TCG2_GET_EVENT_LOG GetEventLog;

+  EFI_TCG2_HASH_LOG_EXTEND_EVENT HashLogExtendEvent;

+  EFI_TCG2_SUBMIT_COMMAND SubmitCommand;

+  EFI_TCG2_GET_ACTIVE_PCR_BANKS GetActivePcrBanks;

+  EFI_TCG2_SET_ACTIVE_PCR_BANKS SetActivePcrBanks;

+  EFI_TCG2_GET_RESULT_OF_SET_ACTIVE_PCR_BANKS GetResultOfSetActivePcrBanks;

+};

+

+extern EFI_GUID gEfiTcg2ProtocolGuid;

+

+#endif

--
2.34.1



-=-=-=-=-=-=
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#113490): https://edk2.groups.io/g/devel/message/113490
Mute This Topic: https://groups.io/mt/103625305/5985097
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [sunny.w...@arm.com]
-=-=-=-=-=-=


IMPORTANT NOTICE: The contents of this email and any attachments are 
confidential and may also be privileged. If you are not the intended recipient, 
please notify the sender immediately and do not disclose the contents to any 
other person, use it for any purpose, or store or copy the information in any 
medium. Thank you.


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#116845): https://edk2.groups.io/g/devel/message/116845
Mute This Topic: https://groups.io/mt/103625305/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-


Reply via email to