From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by mx.groups.io with SMTP id smtpd.web10.4760.1626768278659876466 for ; Tue, 20 Jul 2021 01:04:38 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@ibm.com header.s=pp1 header.b=aVVDsVA1; spf=pass (domain: linux.ibm.com, ip: 148.163.156.1, mailfrom: dovmurik@linux.ibm.com) Received: from pps.filterd (m0098409.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 16K84XWG126322; Tue, 20 Jul 2021 04:04:37 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : mime-version; s=pp1; bh=1EU60vxyM+xvAUCk4ENCSCV/D0ks8FrRCZfpgeocJB8=; b=aVVDsVA1epnnmmyj3AqtyxrzAJTOqXYcwl9XrirlVNs/zG0rdYB4oeDKH019JFMQ2rcZ in4UkJT430+79RmDeHbnnxh/zwpPVq0X46ZebZcvao3q1nsKMgFRNeYyL/SkZpvyEBvp TcYWpznCSwKBsWwt2GIuozIAcQ5Q/M4i6FLNNoKB9JnjULvLtxj+tTzslcAHaDe3t0FX iLBeTS+f86sZmBPqVQZax+Bt3aIwOSSpIFzaRjW1ocsX0SPhhSLi1GfeaDPFLTqqNVUK j3LChYk2N9SrNjlIGehp/iuFjlGzM6VbjElLhUmyHwJrlzBL2z39PSGtMabJmIisqcTo 3g== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com with ESMTP id 39wtcc8fwk-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 20 Jul 2021 04:04:36 -0400 Received: from m0098409.ppops.net (m0098409.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.43/8.16.0.43) with SMTP id 16K84YQt126486; Tue, 20 Jul 2021 04:04:35 -0400 Received: from ppma04wdc.us.ibm.com (1a.90.2fa9.ip4.static.sl-reverse.com [169.47.144.26]) by mx0a-001b2d01.pphosted.com with ESMTP id 39wtcc8ft5-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 20 Jul 2021 04:04:34 -0400 Received: from pps.filterd (ppma04wdc.us.ibm.com [127.0.0.1]) by ppma04wdc.us.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 16K83gKd032658; Tue, 20 Jul 2021 08:04:27 GMT Received: from b03cxnp08026.gho.boulder.ibm.com (b03cxnp08026.gho.boulder.ibm.com [9.17.130.18]) by ppma04wdc.us.ibm.com with ESMTP id 39upuaw2uy-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 20 Jul 2021 08:04:27 +0000 Received: from b03ledav002.gho.boulder.ibm.com (b03ledav002.gho.boulder.ibm.com [9.17.130.233]) by b03cxnp08026.gho.boulder.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 16K84PVw25362908 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 20 Jul 2021 08:04:25 GMT Received: from b03ledav002.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 5372D136053; Tue, 20 Jul 2021 08:04:25 +0000 (GMT) Received: from b03ledav002.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 1CA7713605D; Tue, 20 Jul 2021 08:04:24 +0000 (GMT) Received: from localhost.localdomain (unknown [9.2.130.16]) by b03ledav002.gho.boulder.ibm.com (Postfix) with ESMTP; Tue, 20 Jul 2021 08:04:23 +0000 (GMT) From: "Dov Murik" To: devel@edk2.groups.io Cc: Dov Murik , Tobin Feldman-Fitzthum , Tobin Feldman-Fitzthum , Jim Cadden , James Bottomley , Hubertus Franke , Ard Biesheuvel , Jordan Justen , Ashish Kalra , Brijesh Singh , Erdem Aktas , Jiewen Yao , Min Xu , Tom Lendacky Subject: [PATCH v3 04/11] OvmfPkg: add library class BlobVerifierLib with null implementation Date: Tue, 20 Jul 2021 08:03:54 +0000 Message-Id: <20210720080401.3662854-5-dovmurik@linux.ibm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210720080401.3662854-1-dovmurik@linux.ibm.com> References: <20210720080401.3662854-1-dovmurik@linux.ibm.com> X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: -uG-MG1RpTjtleNUOn8ilNbq1TnC5uSN X-Proofpoint-GUID: etZvqmXx-nn88kZGJSjtI-1PAs-4_cAE X-Proofpoint-UnRewURL: 0 URL was un-rewritten MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.391,18.0.790 definitions=2021-07-20_04:2021-07-19,2021-07-20 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxlogscore=999 impostorscore=0 lowpriorityscore=0 bulkscore=0 clxscore=1015 mlxscore=0 malwarescore=0 phishscore=0 adultscore=0 priorityscore=1501 spamscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104190000 definitions=main-2107200047 Content-Transfer-Encoding: quoted-printable BlobVerifierLib will be used to verify blobs fetching them from QEMU's firmware config (fw_cfg) in platforms that enable such verification. The null implementation BlobVerifierLibNull treats all blobs as valid. Cc: Ard Biesheuvel Cc: Jordan Justen Cc: Ashish Kalra Cc: Brijesh Singh Cc: Erdem Aktas Cc: James Bottomley Cc: Jiewen Yao Cc: Min Xu Cc: Tom Lendacky Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=3D3457 Signed-off-by: Dov Murik --- OvmfPkg/OvmfPkg.dec | 3 ++ OvmfPkg/Library/BlobVerifierLib/BlobVerifierLibNull.inf | 24 +++++++++++++ OvmfPkg/Include/Library/BlobVerifierLib.h | 38 +++++++++++++= +++++++ OvmfPkg/Library/BlobVerifierLib/BlobVerifierNull.c | 33 +++++++++++++= ++++ 4 files changed, 98 insertions(+) diff --git a/OvmfPkg/OvmfPkg.dec b/OvmfPkg/OvmfPkg.dec index 6ae733f6e39f..f82228d69cc2 100644 --- a/OvmfPkg/OvmfPkg.dec +++ b/OvmfPkg/OvmfPkg.dec @@ -23,6 +23,9 @@ [LibraryClasses] ## @libraryclass Access bhyve's firmware control interface.=0D BhyveFwCtlLib|Include/Library/BhyveFwCtlLib.h=0D =0D + ## @libraryclass Verify blobs read from the VMM=0D + BlobVerifierLib|Include/Library/BlobVerifierLib.h=0D +=0D ## @libraryclass Loads and boots a Linux kernel image=0D #=0D LoadLinuxLib|Include/Library/LoadLinuxLib.h=0D diff --git a/OvmfPkg/Library/BlobVerifierLib/BlobVerifierLibNull.inf b/Ovmf= Pkg/Library/BlobVerifierLib/BlobVerifierLibNull.inf new file mode 100644 index 000000000000..850d398e65a4 --- /dev/null +++ b/OvmfPkg/Library/BlobVerifierLib/BlobVerifierLibNull.inf @@ -0,0 +1,24 @@ +## @file=0D +#=0D +# Null implementation of the blob verifier library.=0D +#=0D +# Copyright (C) 2021, IBM Corp=0D +#=0D +# SPDX-License-Identifier: BSD-2-Clause-Patent=0D +#=0D +##=0D +=0D +[Defines]=0D + INF_VERSION =3D 1.29=0D + BASE_NAME =3D BlobVerifierLibNull=0D + FILE_GUID =3D b1b5533e-e01a-43bb-9e54-414f00ca036e= =0D + MODULE_TYPE =3D BASE=0D + VERSION_STRING =3D 1.0=0D + LIBRARY_CLASS =3D BlobVerifierLib=0D +=0D +[Sources]=0D + BlobVerifierNull.c=0D +=0D +[Packages]=0D + MdePkg/MdePkg.dec=0D + OvmfPkg/OvmfPkg.dec=0D diff --git a/OvmfPkg/Include/Library/BlobVerifierLib.h b/OvmfPkg/Include/Li= brary/BlobVerifierLib.h new file mode 100644 index 000000000000..db122684f76c --- /dev/null +++ b/OvmfPkg/Include/Library/BlobVerifierLib.h @@ -0,0 +1,38 @@ +/** @file=0D +=0D + Blob verification library=0D +=0D + This library class allows verifiying whether blobs from external sources= =0D + (such as QEMU's firmware config) are trusted.=0D +=0D + Copyright (C) 2021, IBM Corporation=0D +=0D + SPDX-License-Identifier: BSD-2-Clause-Patent=0D +**/=0D +=0D +#ifndef BLOB_VERIFIER_LIB_H__=0D +#define BLOB_VERIFIER_LIB_H__=0D +=0D +#include =0D +#include =0D +=0D +/**=0D + Verify blob from an external source.=0D +=0D + @param[in] BlobName The name of the blob=0D + @param[in] Buf The data of the blob=0D + @param[in] BufSize The size of the blob in bytes=0D +=0D + @retval EFI_SUCCESS The blob was verified successfully.=0D + @retval EFI_ACCESS_DENIED The blob could not be verified, and theref= ore=0D + should be considered non-secure.=0D +**/=0D +EFI_STATUS=0D +EFIAPI=0D +VerifyBlob (=0D + IN CONST CHAR16 *BlobName,=0D + IN CONST VOID *Buf,=0D + IN UINT32 BufSize=0D + );=0D +=0D +#endif=0D diff --git a/OvmfPkg/Library/BlobVerifierLib/BlobVerifierNull.c b/OvmfPkg/L= ibrary/BlobVerifierLib/BlobVerifierNull.c new file mode 100644 index 000000000000..975d4dd52f80 --- /dev/null +++ b/OvmfPkg/Library/BlobVerifierLib/BlobVerifierNull.c @@ -0,0 +1,33 @@ +/** @file=0D +=0D + Null implementation of the blob verifier library.=0D +=0D + Copyright (C) 2021, IBM Corporation=0D +=0D + SPDX-License-Identifier: BSD-2-Clause-Patent=0D +**/=0D +=0D +#include =0D +#include =0D +=0D +/**=0D + Verify blob from an external source.=0D +=0D + @param[in] BlobName The name of the blob=0D + @param[in] Buf The data of the blob=0D + @param[in] BufSize The size of the blob in bytes=0D +=0D + @retval EFI_SUCCESS The blob was verified successfully.=0D + @retval EFI_ACCESS_DENIED The blob could not be verified, and theref= ore=0D + should be considered non-secure.=0D +**/=0D +EFI_STATUS=0D +EFIAPI=0D +VerifyBlob (=0D + IN CONST CHAR16 *BlobName,=0D + IN CONST VOID *Buf,=0D + IN UINT32 BufSize=0D + )=0D +{=0D + return EFI_SUCCESS;=0D +}=0D --=20 2.25.1