From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web09.20886.1644370391136991622 for ; Tue, 08 Feb 2022 17:33:11 -0800 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: arm.com, ip: 217.140.110.172, mailfrom: joseph.hemann@arm.com) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id C3ECA113E; Tue, 8 Feb 2022 17:33:10 -0800 (PST) Received: from u203013-lin.austin.arm.com (u203013-lin.austin.arm.com [10.118.28.29]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id B0D043F718; Tue, 8 Feb 2022 17:33:10 -0800 (PST) From: "Joseph Hemann" To: devel@edk2.groups.io Cc: G Edhaya Chandran , Barton Gao , Carolyn Gjertsen , Samer El-Haj-Mahmoud , Eric Jin , Arvin Chen , Supreeth Venkatesh , Stuart Yoder Subject: [PATCH V3 1/6] uefi-sct/SctPkg: TCG2 Protocol: add header with TCG2 protocol definitions Date: Tue, 8 Feb 2022 19:33:01 -0600 Message-Id: <20220209013306.425846-2-Joseph.hemann@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220209013306.425846-1-Joseph.hemann@arm.com> References: <20220209013306.425846-1-Joseph.hemann@arm.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Cc: G Edhaya Chandran Cc: Barton Gao Cc: Carolyn Gjertsen Cc: Samer El-Haj-Mahmoud Cc: Eric Jin Cc: Arvin Chen Cc: Supreeth Venkatesh Cc: Stuart Yoder Signed-off-by: Joseph Hemann Change-Id: Ie71cfebd15ddccff0d8d99359ee10761adb3001f --- uefi-sct/SctPkg/UEFI/Protocol/TCG2.h | 174 +++++++++++++++++++++++++++++++= ++++++++++++++++++++++++ 1 file changed, 174 insertions(+) diff --git a/uefi-sct/SctPkg/UEFI/Protocol/TCG2.h b/uefi-sct/SctPkg/UEFI/Pr= otocol/TCG2.h new file mode 100644 index 000000000000..923549e2e96b --- /dev/null +++ b/uefi-sct/SctPkg/UEFI/Protocol/TCG2.h @@ -0,0 +1,174 @@ +/** @file + + Copyright 2006 - 2016 Unified EFI, Inc.
+ Copyright (c) 2013 - 2016, Intel Corporation. All rights reserved.
+ Copyright (c) 2021, Arm Inc. All rights reserved.
=0D + + This program and the accompanying materials + are licensed and made available under the terms and conditions of the BS= D License + which accompanies this distribution. The full text of the license may b= e 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 IMP= LIED. + +**/ +/*++ + +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 UINT64 EFI_PHYSICAL_ADDRESS; + +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 +); + +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; + +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 --=20 2.25.1