From: "Min Xu" <min.m.xu@intel.com>
To: devel@edk2.groups.io
Cc: Min Xu <min.m.xu@intel.com>,
Ard Biesheuvel <ardb+tianocore@kernel.org>,
Jordan Justen <jordan.l.justen@intel.com>,
Ashish Kalra <ashish.kalra@amd.com>,
Brijesh Singh <brijesh.singh@amd.com>,
Erdem Aktas <erdemaktas@google.com>,
James Bottomley <jejb@linux.ibm.com>,
Jiewen Yao <jiewen.yao@intel.com>,
Tom Lendacky <thomas.lendacky@amd.com>,
Sami Mujawar <sami.mujawar@arm.com>,
Gerd Hoffmann <kraxel@redhat.com>
Subject: [PATCH 1/4] OvmfPkg: Add library class BlobMeasurementLib with null implementation
Date: Mon, 23 May 2022 13:55:39 +0800 [thread overview]
Message-ID: <23b823d3e53725efb2f6b290973d905a7a020e34.1653284206.git.min.m.xu@intel.com> (raw)
In-Reply-To: <cover.1653284206.git.min.m.xu@intel.com>
BlobMeasurementLib will be used to measure blobs fetching from QEMU's
firmware config (fw_cfg) in platforms which implments
EFI_CC_MEASUREMENT_PROTOCOL.
The null implementation BlobMeasurementLibNull always return EFI_SUCCESS.
Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Ashish Kalra <ashish.kalra@amd.com>
Cc: Brijesh Singh <brijesh.singh@amd.com>
Cc: Erdem Aktas <erdemaktas@google.com>
Cc: James Bottomley <jejb@linux.ibm.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Tom Lendacky <thomas.lendacky@amd.com>
Cc: Sami Mujawar <sami.mujawar@arm.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Min Xu <min.m.xu@intel.com>
---
OvmfPkg/Include/Library/BlobMeasurementLib.h | 38 +++++++++++++++++++
.../BlobMeasurementLibNull.c | 34 +++++++++++++++++
.../BlobMeasurementLibNull.inf | 24 ++++++++++++
OvmfPkg/OvmfPkg.dec | 3 ++
4 files changed, 99 insertions(+)
create mode 100644 OvmfPkg/Include/Library/BlobMeasurementLib.h
create mode 100644 OvmfPkg/Library/BlobMeasurementLibNull/BlobMeasurementLibNull.c
create mode 100644 OvmfPkg/Library/BlobMeasurementLibNull/BlobMeasurementLibNull.inf
diff --git a/OvmfPkg/Include/Library/BlobMeasurementLib.h b/OvmfPkg/Include/Library/BlobMeasurementLib.h
new file mode 100644
index 000000000000..e54a41c2c9c1
--- /dev/null
+++ b/OvmfPkg/Include/Library/BlobMeasurementLib.h
@@ -0,0 +1,38 @@
+/** @file
+
+ Blob measurement library
+
+ This library class allows measuring blobs from external sources, such as QEMU's firmware config.
+
+ Copyright (C) 2022, Intel Corporation. All rights reserved.
+
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+**/
+
+#ifndef BLOB_MEASUREMENT_LIB_H_
+#define BLOB_MEASUREMENT_LIB_H_
+
+#include <Uefi/UefiBaseType.h>
+#include <Base.h>
+
+/**
+ Measure blob from an external source.
+
+ @param[in] BlobName The name of the blob
+ @param[in] BlobNameSize Size of the blob name
+ @param[in] BlobBase The data of the blob
+ @param[in] BlobSize The size of the blob in bytes
+
+ @retval EFI_SUCCESS The blob was measured successfully.
+ @retval Other errors
+**/
+EFI_STATUS
+EFIAPI
+MeasureKernelBlob (
+ IN CONST CHAR16 *BlobName,
+ IN UINT32 BlobNameSize,
+ IN CONST VOID *BlobBase,
+ IN UINT32 BlobSize
+ );
+
+#endif
diff --git a/OvmfPkg/Library/BlobMeasurementLibNull/BlobMeasurementLibNull.c b/OvmfPkg/Library/BlobMeasurementLibNull/BlobMeasurementLibNull.c
new file mode 100644
index 000000000000..e93e3cf164c0
--- /dev/null
+++ b/OvmfPkg/Library/BlobMeasurementLibNull/BlobMeasurementLibNull.c
@@ -0,0 +1,34 @@
+/** @file
+
+ Null implementation of the blob measurement library.
+
+ Copyright (C) 2022, Intel Corporation. All rights reserved.
+
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+**/
+
+#include <Library/BaseLib.h>
+#include <Library/BlobMeasurementLib.h>
+
+/**
+ Measure blob from an external source.
+
+ @param[in] BlobName The name of the blob
+ @param[in] BlobNameSize Size of the blob name
+ @param[in] BlobBase The data of the blob
+ @param[in] BlobSize The size of the blob in bytes
+
+ @retval EFI_SUCCESS The blob was measured successfully.
+ @retval Other errors
+**/
+EFI_STATUS
+EFIAPI
+MeasureKernelBlob (
+ IN CONST CHAR16 *BlobName,
+ IN UINT32 BlobNameSize,
+ IN CONST VOID *BlobBase,
+ IN UINT32 BlobSize
+ )
+{
+ return EFI_SUCCESS;
+}
diff --git a/OvmfPkg/Library/BlobMeasurementLibNull/BlobMeasurementLibNull.inf b/OvmfPkg/Library/BlobMeasurementLibNull/BlobMeasurementLibNull.inf
new file mode 100644
index 000000000000..5bf3710222c2
--- /dev/null
+++ b/OvmfPkg/Library/BlobMeasurementLibNull/BlobMeasurementLibNull.inf
@@ -0,0 +1,24 @@
+## @file
+#
+# Null implementation of the blob measurement library.
+#
+# Copyright (C) 2022, Intel Corporation. All rights reserved.
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+##
+
+[Defines]
+ INF_VERSION = 0x00010005
+ BASE_NAME = BlobMeasurementLibNull
+ FILE_GUID = fad119ff-8627-4661-a35f-920a6eeb2866
+ MODULE_TYPE = BASE
+ VERSION_STRING = 1.0
+ LIBRARY_CLASS = BlobMeasurementLib
+
+[Sources]
+ BlobMeasurementLibNull.c
+
+[Packages]
+ MdePkg/MdePkg.dec
+ OvmfPkg/OvmfPkg.dec
diff --git a/OvmfPkg/OvmfPkg.dec b/OvmfPkg/OvmfPkg.dec
index 8c2048051bea..da94e4c7aa89 100644
--- a/OvmfPkg/OvmfPkg.dec
+++ b/OvmfPkg/OvmfPkg.dec
@@ -26,6 +26,9 @@
## @libraryclass Verify blobs read from the VMM
BlobVerifierLib|Include/Library/BlobVerifierLib.h
+ ## @libraryclass Measure blobs read from the VMM
+ BlobMeasurementLib|Include/Library/BlobMeasurementLib.h
+
## @libraryclass Loads and boots a Linux kernel image
#
LoadLinuxLib|Include/Library/LoadLinuxLib.h
--
2.29.2.windows.2
next prev parent reply other threads:[~2022-05-23 5:56 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-05-23 5:55 [PATCH 0/4] Measure kernel blob Min Xu
2022-05-23 5:55 ` Min Xu [this message]
2022-05-23 5:55 ` [PATCH 2/4] OvmfPkg: Add BlobMeasurementLibNull to dsc Min Xu
2022-05-23 5:55 ` [PATCH 3/4] OvmfPkg: Implement BlobMeasurementLibTdx Min Xu
2022-05-23 8:14 ` Gerd Hoffmann
2022-05-23 5:55 ` [PATCH 4/4] OvmfPkg: Call MeasureKernelBlob after fetch from fw_cfg Min Xu
2022-05-23 9:29 ` [PATCH 0/4] Measure kernel blob Yao, Jiewen
[not found] ` <16F1B1F290429BFD.18186@groups.io>
2022-05-23 9:36 ` [edk2-devel] " Yao, Jiewen
2022-05-23 11:13 ` Ard Biesheuvel
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=23b823d3e53725efb2f6b290973d905a7a020e34.1653284206.git.min.m.xu@intel.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