public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Stuart Yoder" <stuart.yoder@arm.com>
To: devel@edk2.groups.io, Edhaya.Chandran@arm.com, gaojie@byosoft.com.cn
Cc: ilias.apalodimas@linaro.org, heinrich.schuchardt@canonical.com,
	Samer.El-Haj-Mahmoud@arm.com, Jiewen.Yao@intel.com
Subject: [edk2-devel] [PATCH v1 1/6] uefi-sct/SctPkg: TCG2 Protocol: add header with TCG2 protocol definitions
Date: Thu, 14 Dec 2023 17:39:16 -0600	[thread overview]
Message-ID: <20231214233921.169624-2-stuart.yoder@arm.com> (raw)
In-Reply-To: <20231214233921.169624-1-stuart.yoder@arm.com>

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

Signed-off-by: Joseph Hemann <Joseph.hemann@arm.com>
Signed-off-by: Stuart Yoder <stuart.yoder@arm.com>
---
 uefi-sct/SctPkg/UEFI/Protocol/TCG2.h | 179 ++++++++++++++++++++
 1 file changed, 179 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..659c61a741e7
--- /dev/null
+++ b/uefi-sct/SctPkg/UEFI/Protocol/TCG2.h
@@ -0,0 +1,179 @@
+/** @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 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
+);
+
+// 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 (#112566): https://edk2.groups.io/g/devel/message/112566
Mute This Topic: https://groups.io/mt/103181267/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-



  reply	other threads:[~2023-12-14 23:39 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-14 23:39 [edk2-devel] [PATCH v1 0/6] Tests for TCG2 Protocol Stuart Yoder
2023-12-14 23:39 ` Stuart Yoder [this message]
2023-12-15 14:30   ` [edk2-devel] [PATCH v1 1/6] uefi-sct/SctPkg: TCG2 Protocol: add header with TCG2 protocol definitions Heinrich Schuchardt
2024-03-05 15:38     ` Stuart Yoder
2023-12-14 23:39 ` [edk2-devel] [PATCH v1 2/6] uefi-sct/SctPkg: TCG2 Protocol: add test infrastructure and GetCapability Test Stuart Yoder
2023-12-14 23:39 ` [edk2-devel] [PATCH v1 3/6] uefi-sct/SctPkg: TCG2 Protocol: add GetActivePcrBanks test Stuart Yoder
2023-12-14 23:39 ` [edk2-devel] [PATCH v1 4/6] uefi-sct/SctPkg: TCG2 Protocol: add HashLogExtendEvent test Stuart Yoder
2023-12-14 23:39 ` [edk2-devel] [PATCH v1 5/6] uefi-sct/SctPkg: TCG2 Protocol: add GetEventLog test Stuart Yoder
2023-12-14 23:39 ` [edk2-devel] [PATCH v1 6/6] uefi-sct/SctPkg: TCG2 Protocol: add SubmitCommand test Stuart Yoder

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20231214233921.169624-2-stuart.yoder@arm.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox