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.web08.3620.1625561717843590607 for ; Tue, 06 Jul 2021 01:55:17 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@ibm.com header.s=pp1 header.b=rRVmGnHe; spf=pass (domain: linux.ibm.com, ip: 148.163.156.1, mailfrom: dovmurik@linux.ibm.com) Received: from pps.filterd (m0098396.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 1668YDot155706; Tue, 6 Jul 2021 04:55:16 -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=KLObJEZ6WLNWEC16Vqz1oNhgKGFidben9f8RGdFA2RU=; b=rRVmGnHe/ZAB/1ZmSMpPyq63dAhgiw17DeUd8oaHz2j+JT3OR37w4T23VJbV/Szx6CKW XT4mFATHXv/S+Oc5318u3D48MxT8xVEIagmN6aVUfjE0oQB63ahXdXeduOV5nof/aCjF 763P3E8QTA+svdKVrsv6IE1HoTYVjAsu9JwuNlHctLgPE/P694WnUlGxxytDBlgweBNP YEyL1AC0glfjqHPiYf6vMCQtALsZIaGeKfQ20y8DxdgZyirAI+B0PHiVRfoFIsCHZzrO OnqmxpQWmOCRLDUWFNOGvp4pr4Fe8j3KiIPgUDzXNdeCv6WjDuhwp+LcbgMee+fElfaR gQ== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com with ESMTP id 39mbdwbeg5-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 06 Jul 2021 04:55:16 -0400 Received: from m0098396.ppops.net (m0098396.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.43/8.16.0.43) with SMTP id 1668a9UN161767; Tue, 6 Jul 2021 04:55:15 -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 39mbdwbefj-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 06 Jul 2021 04:55:15 -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 1668pu49014092; Tue, 6 Jul 2021 08:55:14 GMT Received: from b03cxnp08027.gho.boulder.ibm.com (b03cxnp08027.gho.boulder.ibm.com [9.17.130.19]) by ppma04wdc.us.ibm.com with ESMTP id 39ju3agfab-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 06 Jul 2021 08:55:14 +0000 Received: from b03ledav003.gho.boulder.ibm.com (b03ledav003.gho.boulder.ibm.com [9.17.130.234]) by b03cxnp08027.gho.boulder.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 1668tCHG13435450 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 6 Jul 2021 08:55:12 GMT Received: from b03ledav003.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 22B7C6A047; Tue, 6 Jul 2021 08:55:12 +0000 (GMT) Received: from b03ledav003.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 190796A057; Tue, 6 Jul 2021 08:55:11 +0000 (GMT) Received: from localhost.localdomain (unknown [9.2.130.16]) by b03ledav003.gho.boulder.ibm.com (Postfix) with ESMTP; Tue, 6 Jul 2021 08:55:11 +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 , Laszlo Ersek , Ard Biesheuvel , Jordan Justen , Ashish Kalra , Brijesh Singh , Erdem Aktas , Jiewen Yao , Min Xu , Tom Lendacky Subject: [PATCH v2 04/11] OvmfPkg: add library class BlobVerifierLib with null implementation Date: Tue, 6 Jul 2021 08:54:54 +0000 Message-Id: <20210706085501.1260662-5-dovmurik@linux.ibm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210706085501.1260662-1-dovmurik@linux.ibm.com> References: <20210706085501.1260662-1-dovmurik@linux.ibm.com> X-TM-AS-GCONF: 00 X-Proofpoint-GUID: 5z1NAClbn3jPLEMmoPpuATYQ6Z_w71lN X-Proofpoint-ORIG-GUID: Di_rc1NbK7VrxN1rzvGGSNN62Br-YZlt 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-06_04:2021-07-02,2021-07-06 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 bulkscore=0 spamscore=0 impostorscore=0 clxscore=1015 mlxlogscore=999 lowpriorityscore=0 adultscore=0 malwarescore=0 priorityscore=1501 mlxscore=0 suspectscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104190000 definitions=main-2107060042 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 NullBlobVerifierLib treats all blobs as valid. Cc: Laszlo Ersek 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/NullBlobVerifierLib.inf | 27 ++++++++++++++ OvmfPkg/Include/Library/BlobVerifierLib.h | 38 +++++++++++++= +++++++ OvmfPkg/Library/BlobVerifierLib/NullBlobVerifier.c | 34 +++++++++++++= +++++ 4 files changed, 102 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/NullBlobVerifierLib.inf b/Ovmf= Pkg/Library/BlobVerifierLib/NullBlobVerifierLib.inf new file mode 100644 index 000000000000..c8942ad05d96 --- /dev/null +++ b/OvmfPkg/Library/BlobVerifierLib/NullBlobVerifierLib.inf @@ -0,0 +1,27 @@ +## @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 0x00010005=0D + BASE_NAME =3D NullBlobVerifierLib=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 + NullBlobVerifier.c=0D +=0D +[Packages]=0D + MdePkg/MdePkg.dec=0D + OvmfPkg/OvmfPkg.dec=0D +=0D +[LibraryClasses]=0D + DebugLib=0D diff --git a/OvmfPkg/Include/Library/BlobVerifierLib.h b/OvmfPkg/Include/Li= brary/BlobVerifierLib.h new file mode 100644 index 000000000000..667024766681 --- /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 BlobName The name of the blob=0D + @param Buf The data of the blob=0D + @param 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 + UINT32 BufSize=0D + );=0D +=0D +#endif=0D diff --git a/OvmfPkg/Library/BlobVerifierLib/NullBlobVerifier.c b/OvmfPkg/L= ibrary/BlobVerifierLib/NullBlobVerifier.c new file mode 100644 index 000000000000..7b31b6ec767d --- /dev/null +++ b/OvmfPkg/Library/BlobVerifierLib/NullBlobVerifier.c @@ -0,0 +1,34 @@ +/** @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 +#include =0D +=0D +/**=0D + Verify blob from an external source.=0D +=0D + @param BlobName The name of the blob=0D + @param Buf The data of the blob=0D + @param 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 + UINT32 BufSize=0D + )=0D +{=0D + return EFI_SUCCESS;=0D +}=0D --=20 2.25.1