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.web11.5945.1627412928469767696 for ; Tue, 27 Jul 2021 12:08:48 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@ibm.com header.s=pp1 header.b=hvty5tqA; spf=pass (domain: linux.ibm.com, ip: 148.163.156.1, mailfrom: dovmurik@linux.ibm.com) Received: from pps.filterd (m0187473.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 16RJ5QiD118430; Tue, 27 Jul 2021 15:08:47 -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=CSDj+7vp9/tC+JeXd1PYnwb0VqM0VVUlV5sB54N8FnE=; b=hvty5tqAoIvoUecDeJb01uAvh4KMxdVOGgQZOBRq8FID9WJD46T6pOBnIHDTT56YYKk6 xlkjqK4vyTRuSaXQlp0LhGQwgTyxXdEZM6YVCBduRgPMoGqWyDwb1xUX7HCNdeKTD35r TZ6ph8p44Wl1FCCZiXgoAq0pQRNrvNVQ08yxudTIKH5yF8T6K3/O2Sm4bIy+NBIKoOeR IifILfe9rgzGxvOGkn+EtYEfXxMXr/wdFFCskeAvY5p8f5anfdJmFoIt0qnlTDgaUeUK eBub8lCkoD/YL2xqJEAvDGUlAmUGKvfOC3KCiwMZJw2xiH+3OKAOnEGc00mztrQwMZB1 rQ== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com with ESMTP id 3a2qpd0x0b-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 27 Jul 2021 15:08:46 -0400 Received: from m0187473.ppops.net (m0187473.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.43/8.16.0.43) with SMTP id 16RJ5Ppm118345; Tue, 27 Jul 2021 15:08:10 -0400 Received: from ppma02dal.us.ibm.com (a.bd.3ea9.ip4.static.sl-reverse.com [169.62.189.10]) by mx0a-001b2d01.pphosted.com with ESMTP id 3a2qpd0ths-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 27 Jul 2021 15:08:09 -0400 Received: from pps.filterd (ppma02dal.us.ibm.com [127.0.0.1]) by ppma02dal.us.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 16RIw6DZ017967; Tue, 27 Jul 2021 19:07:31 GMT Received: from b01cxnp22033.gho.pok.ibm.com (b01cxnp22033.gho.pok.ibm.com [9.57.198.23]) by ppma02dal.us.ibm.com with ESMTP id 3a2362sacr-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 27 Jul 2021 19:07:31 +0000 Received: from b01ledav003.gho.pok.ibm.com (b01ledav003.gho.pok.ibm.com [9.57.199.108]) by b01cxnp22033.gho.pok.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 16RJ7TGn15663470 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 27 Jul 2021 19:07:29 GMT Received: from b01ledav003.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 61AA9B2065; Tue, 27 Jul 2021 19:07:29 +0000 (GMT) Received: from b01ledav003.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 28C49B206A; Tue, 27 Jul 2021 19:07:29 +0000 (GMT) Received: from localhost.localdomain (unknown [9.2.130.16]) by b01ledav003.gho.pok.ibm.com (Postfix) with ESMTP; Tue, 27 Jul 2021 19:07:29 +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 v5 04/11] OvmfPkg: add library class BlobVerifierLib with null implementation Date: Tue, 27 Jul 2021 19:07:17 +0000 Message-Id: <20210727190724.3586867-5-dovmurik@linux.ibm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210727190724.3586867-1-dovmurik@linux.ibm.com> References: <20210727190724.3586867-1-dovmurik@linux.ibm.com> X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: 8xB3tQ8QVZvWQm0v7M2PKaPHVVWBQBrM X-Proofpoint-GUID: 7KE2tzZb4qtJIxTACnGDmrHQIB-_vcce 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-27_13:2021-07-27,2021-07-27 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxscore=0 lowpriorityscore=0 bulkscore=0 spamscore=0 malwarescore=0 adultscore=0 impostorscore=0 clxscore=1015 phishscore=0 mlxlogscore=999 suspectscore=0 priorityscore=1501 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2107140000 definitions=main-2107270113 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 Reviewed-by: Tom Lendacky --- OvmfPkg/OvmfPkg.dec | 3 ++ OvmfPkg/Library/BlobVerifierLibNull/BlobVerifierLibNull.inf | 24 +++++++++= ++++ OvmfPkg/Include/Library/BlobVerifierLib.h | 38 +++++++++= +++++++++++ OvmfPkg/Library/BlobVerifierLibNull/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/BlobVerifierLibNull/BlobVerifierLibNull.inf b/= OvmfPkg/Library/BlobVerifierLibNull/BlobVerifierLibNull.inf new file mode 100644 index 000000000000..850d398e65a4 --- /dev/null +++ b/OvmfPkg/Library/BlobVerifierLibNull/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..65c01af9bf18 --- /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/BlobVerifierLibNull/BlobVerifierNull.c b/OvmfP= kg/Library/BlobVerifierLibNull/BlobVerifierNull.c new file mode 100644 index 000000000000..975d4dd52f80 --- /dev/null +++ b/OvmfPkg/Library/BlobVerifierLibNull/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