From nobody Fri May 3 16:34:37 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+55941+1787277+3901457@groups.io; helo=web01.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+55941+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1584497588; cv=none; d=zohomail.com; s=zohoarc; b=Jd+mkZyfL65aK5W4DuO4Cgi1GiNlp8Zh79PGcbnrU6WMho3Au2S7+akPhgIE8Purblf83ANai1t4DtOc8KHmhjnwNCIqAWfIvm6iXl/zrJhaHabfhpXnuQJ212XjxT1QZYuRnIzD0mcn9dh7fcyHtRK5PZTblywkbfdx3lZU7eA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1584497588; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Id:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=302BjJd7qK7si+AsRerEr6ZPav5lil9sDTou14kbBV4=; b=Riez+qAK7FcbsHSdFamcSFVqe0iEUWrEaAM+AB+r34bD1ksnB6Pyw6sik1dm0dx62dy5Wz46IkOmF2OuCfx2CCcIwZMw6zFW+QoBosHXo8Makps5j4gfXdemNPLjwWwobxacjZNl6rfSvfhCe9FRBu1ni02TW2vGFdnv5QQkD7A= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+55941+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) header.from= Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 1584497588784263.7874291674683; Tue, 17 Mar 2020 19:13:08 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id K0LnYY1788612x1qLQouJ45i; Tue, 17 Mar 2020 19:13:08 -0700 X-Received: from mga05.intel.com (mga05.intel.com []) by mx.groups.io with SMTP id smtpd.web12.7032.1584497586625273837 for ; Tue, 17 Mar 2020 19:13:08 -0700 IronPort-SDR: Fw2csFVAEAOpKnh6b7jna7Bzp0BCeZ3vn0CKKl+rcP7ZGLxJdhEPgm2nZwe+Fu7QsEAhyjllmi 6T3zZ5AazNXg== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 Mar 2020 19:13:07 -0700 IronPort-SDR: tmCbyamFeIAaN05uS42NbTLNvd5ei1w2PHTWfoervqKHSz/NNGTxPuJs7OGq/eWtqQh/r482OM YXOuavLI2DCg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.70,565,1574150400"; d="scan'208";a="279593278" X-Received: from shwdeopensfp777.ccr.corp.intel.com ([10.239.158.78]) by fmsmga002.fm.intel.com with ESMTP; 17 Mar 2020 19:13:06 -0700 From: "Wang, Jian J" To: devel@edk2.groups.io Cc: Jiewen Yao , Chao Zhang , Nishant C Mistry Subject: [edk2-devel] [PATCH v3 1/3] SecurityPkg: add RpmcLib and VariableKeyLib public headers Date: Wed, 18 Mar 2020 10:13:02 +0800 Message-Id: <20200318021304.2014-2-jian.j.wang@intel.com> In-Reply-To: <20200318021304.2014-1-jian.j.wang@intel.com> References: <20200318021304.2014-1-jian.j.wang@intel.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,jian.j.wang@intel.com X-Gm-Message-State: oHE9293qBQDNnc9g1XkjQO3Dx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1584497588; bh=0rEscS/7/RFROOjkHnki+WI7e/YE5O8ezRxOedRXh8k=; h=Cc:Date:From:Reply-To:Subject:To; b=CY+1qmL5LdfZMeBAzch0nrS4bb9GhBqMydow85LDY/fSWxwtEmRvh1AnbjHC+zFPU1G x0UIz/Qw2OHHA1yyJGJI9BmkdQ38u0gX6Q2hyq7XDfi5HEBsGBOQxedhChRcPT8zcEU76 XTyWboRTQ563Sqn3j5SW/tVcmDhnN0TszCg= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" > v3: update retval description in RpmcLib.h REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D2594 RpmcLib.h and VariableKeyLib.h are header files required to access RPMC device and Key generator from platform. They will be used to ensure the integrity and confidentiality of NV variables. Cc: Jiewen Yao Cc: Chao Zhang Cc: Nishant C Mistry Signed-off-by: Jian J Wang --- SecurityPkg/Include/Library/RpmcLib.h | 46 +++++++++++++++ SecurityPkg/Include/Library/VariableKeyLib.h | 59 ++++++++++++++++++++ SecurityPkg/SecurityPkg.dec | 8 +++ 3 files changed, 113 insertions(+) create mode 100644 SecurityPkg/Include/Library/RpmcLib.h create mode 100644 SecurityPkg/Include/Library/VariableKeyLib.h diff --git a/SecurityPkg/Include/Library/RpmcLib.h b/SecurityPkg/Include/Li= brary/RpmcLib.h new file mode 100644 index 0000000000..f548ad2c9f --- /dev/null +++ b/SecurityPkg/Include/Library/RpmcLib.h @@ -0,0 +1,46 @@ +/** @file + Public definitions for the Replay Protected Monotonic Counter (RPMC) Lib= rary. + +Copyright (c) 2020, Intel Corporation. All rights reserved.
+SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef _RPMC_LIB_H_ +#define _RPMC_LIB_H_ + +#include + +/** + Requests the current monotonic counter from the designated RPMC counter. + + @param[in] CounterId Monotonic Counter Id. + @param[out] CounterValue A pointer to a buffer to store the= RPMC value. + + @retval EFI_SUCCESS The operation completed successful= ly. + @retval EFI_DEVICE_ERROR A device error occurred while atte= mpting to update the counter. + @retval EFI_UNSUPPORTED The operation is un-supported. +**/ +EFI_STATUS +EFIAPI +RequestMonotonicCounter ( + IN UINT8 CounterId, + OUT UINT32 *CounterValue + ); + +/** + Increments the designated monotonic counter in the SPI flash device by 1. + + @param[in] CounterId Monotonic Counter Id. + + @retval EFI_SUCCESS The operation completed successful= ly. + @retval EFI_DEVICE_ERROR A device error occurred while atte= mpting to update the counter. + @retval EFI_UNSUPPORTED The operation is un-supported. +**/ +EFI_STATUS +EFIAPI +IncrementMonotonicCounter ( + IN UINT8 CounterId + ); + +#endif \ No newline at end of file diff --git a/SecurityPkg/Include/Library/VariableKeyLib.h b/SecurityPkg/Inc= lude/Library/VariableKeyLib.h new file mode 100644 index 0000000000..fe642b3d66 --- /dev/null +++ b/SecurityPkg/Include/Library/VariableKeyLib.h @@ -0,0 +1,59 @@ +/** @file + Public definitions for Variable Key Library. + +Copyright (c) 2020, Intel Corporation. All rights reserved.
+SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef _VARIABLE_KEY_LIB_H_ +#define _VARIABLE_KEY_LIB_H_ + +#include + +/** + Retrieves the variable root key. + + @param[out] VariableRootKey A pointer to pointer for the var= iable root key buffer. + @param[in,out] VariableRootKeySize The size in bytes of the variabl= e root key. + + @retval EFI_SUCCESS The variable root key was returned. + @retval EFI_DEVICE_ERROR An error occurred while attempting= to get the variable root key. + @retval EFI_ACCESS_DENIED The function was invoked after loc= king the key interface. + @retval EFI_UNSUPPORTED The variable root key is not suppo= rted in the current boot configuration. +**/ +EFI_STATUS +EFIAPI +GetVariableRootKey ( + OUT VOID **VariableRootKey, + IN OUT UINTN *VariableRootKeySize + ); + +/** + Regenerates the variable root key. + + @retval EFI_SUCCESS The variable root key was regenera= ted successfully. + @retval EFI_DEVICE_ERROR An error occurred while attempting= to regenerate the root key. + @retval EFI_ACCESS_DENIED The function was invoked after loc= king the key interface. + @retval EFI_UNSUPPORTED Key regeneration is not supported = in the current boot configuration. +**/ +EFI_STATUS +EFIAPI +RegenerateKey ( + VOID + ); + +/** + Locks the regenerate key interface. + + @retval EFI_SUCCESS The key interface was locked succe= ssfully. + @retval EFI_UNSUPPORTED Locking the key interface is not s= upported in the current boot configuration. + @retval Others An error occurred while attempting= to lock the key interface. +**/ +EFI_STATUS +EFIAPI +LockKeyInterface ( + VOID + ); + +#endif \ No newline at end of file diff --git a/SecurityPkg/SecurityPkg.dec b/SecurityPkg/SecurityPkg.dec index 5335cc5397..2cdfb02cc5 100644 --- a/SecurityPkg/SecurityPkg.dec +++ b/SecurityPkg/SecurityPkg.dec @@ -76,6 +76,14 @@ # TcgStorageOpalLib|Include/Library/TcgStorageOpalLib.h =20 + ## @libraryclass Provides interfaces to access RPMC device. + # + RpmcLib|Include/Library/RpmcLib.h + + ## @libraryclass Provides interfaces to access variable root key. + # + VariableKeyLib|Include/Library/VariableKeyLib.h + [Guids] ## Security package token space guid. # Include/Guid/SecurityPkgTokenSpace.h --=20 2.24.0.windows.2 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#55941): https://edk2.groups.io/g/devel/message/55941 Mute This Topic: https://groups.io/mt/72040979/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Fri May 3 16:34:37 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+55942+1787277+3901457@groups.io; helo=web01.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+55942+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1584497590; cv=none; d=zohomail.com; s=zohoarc; b=nZQyfnEqYeAAY6WDmp4KhTRnFAwOgmFCfxLOa/riRMUvmJtp25PeWGVPPmIwZK5IKYM9xs9lFKKjC38byHsf4LjlGHlSHMILs6XbYvbC4eE1JLsope8Lmnl2IbY1Y0UfCTAAu+tUBW2LtU0ZjTXB6MLCJSww74P9SMP+D6nk/Vw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1584497590; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Id:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=m5d+W94a20ivU341XbNqLOm6kh/1a537av4b+5DNXNU=; b=dNu9tENQo0GB+IAxWe00PfEECbAQv3y/z2CBZbyt8Z/t33PFttN/YmHMTUV5qmSIGsXheqNSy3z/+VFd0qb1cTYnJlIdCc2SjyN/Q9sxqmlsajiGZI5od09UTlolIMi33xTkPlhsSfuUkh56uyo8LJwexnC3lL4GplBSj/t1NXE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+55942+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) header.from= Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 1584497590228833.5598056910526; Tue, 17 Mar 2020 19:13:10 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id URYxYY1788612xpS5pAFSyOn; Tue, 17 Mar 2020 19:13:09 -0700 X-Received: from mga05.intel.com (mga05.intel.com []) by mx.groups.io with SMTP id smtpd.web12.7032.1584497586625273837 for ; Tue, 17 Mar 2020 19:13:09 -0700 IronPort-SDR: i2ztaDnwHZWMTr52Dh8uIKPci1wQZlW0f1SpzKzduMUZv3VEI3pTOEGucP9egRrqPZQllFxjTV uPKIKQrGbpiQ== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 Mar 2020 19:13:09 -0700 IronPort-SDR: twFzZn/vmQhTdcBkXIL7HNTi7w4a7zQ9Ps6h8KhmVYaFnKttmSwGcJjl246yuUB1BVwgbId5ao jHN3wk2tEKXA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.70,565,1574150400"; d="scan'208";a="279593295" X-Received: from shwdeopensfp777.ccr.corp.intel.com ([10.239.158.78]) by fmsmga002.fm.intel.com with ESMTP; 17 Mar 2020 19:13:07 -0700 From: "Wang, Jian J" To: devel@edk2.groups.io Cc: Jiewen Yao , Chao Zhang , Nishant C Mistry Subject: [edk2-devel] [PATCH v3 2/3] SecurityPkg: add null version of RpmcLib Date: Wed, 18 Mar 2020 10:13:03 +0800 Message-Id: <20200318021304.2014-3-jian.j.wang@intel.com> In-Reply-To: <20200318021304.2014-1-jian.j.wang@intel.com> References: <20200318021304.2014-1-jian.j.wang@intel.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,jian.j.wang@intel.com X-Gm-Message-State: gG7MsUOLVouJ9pg10mqmThqwx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1584497589; bh=hIWvwWkVChd4XHhG7JDj1Oh86ldOKwKTHdnUK0+YA4I=; h=Cc:Date:From:Reply-To:Subject:To; b=PW7iwsLWdBzJJlo2SoTnD1ZfN0GD6pP9uUdKus9FMRFiIetgo2tLb0Yso3BV0f8HCf2 ND7rGY1E+0YCGJB3UOQaoiic1YJY6WUhy/V0EMsqEJ2Qho51eV/hYHv1pbqF+Dyn05Phb uTBI+qJdxRiNs+4T3zBkGKNb6rryTiiTuTk= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" > v3: update retval description in RpmcLibNull.c REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D2594 Add null version of RpmcLib instance. The full version should be provided by platform which supports RPMC device. Cc: Jiewen Yao Cc: Chao Zhang Cc: Nishant C Mistry Signed-off-by: Jian J Wang --- SecurityPkg/Library/RpmcLibNull/RpmcLibNull.c | 51 +++++++++++++++++++ .../Library/RpmcLibNull/RpmcLibNull.inf | 33 ++++++++++++ SecurityPkg/SecurityPkg.dsc | 6 +++ 3 files changed, 90 insertions(+) create mode 100644 SecurityPkg/Library/RpmcLibNull/RpmcLibNull.c create mode 100644 SecurityPkg/Library/RpmcLibNull/RpmcLibNull.inf diff --git a/SecurityPkg/Library/RpmcLibNull/RpmcLibNull.c b/SecurityPkg/Li= brary/RpmcLibNull/RpmcLibNull.c new file mode 100644 index 0000000000..79d480484e --- /dev/null +++ b/SecurityPkg/Library/RpmcLibNull/RpmcLibNull.c @@ -0,0 +1,51 @@ +/** @file + NULL RpmcLib instance for build purpose. + +Copyright (c) 2020, Intel Corporation. All rights reserved.
+SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#include +#include + +/** + Requests the current monotonic counter from the designated RPMC counter. + + @param[in] CounterId Monotonic Counter Id. + @param[out] CounterValue A pointer to a buffer to store the= RPMC value. + + @retval EFI_SUCCESS The operation completed successful= ly. + @retval EFI_DEVICE_ERROR A device error occurred while atte= mpting to update the counter. + @retval EFI_UNSUPPORTED The operation is un-supported. +**/ +EFI_STATUS +EFIAPI +RequestMonotonicCounter ( + IN UINT8 CounterId, + OUT UINT32 *CounterValue + ) +{ + ASSERT (FALSE); + return EFI_UNSUPPORTED; +} + +/** + Increments the designated monotonic counter in the SPI flash device by 1. + + @param[in] CounterId Monotonic Counter Id. + + @retval EFI_SUCCESS The operation completed successful= ly. + @retval EFI_DEVICE_ERROR A device error occurred while atte= mpting to update the counter. + @retval EFI_UNSUPPORTED The operation is un-supported. +**/ +EFI_STATUS +EFIAPI +IncrementMonotonicCounter ( + IN UINT8 CounterId + ) +{ + ASSERT (FALSE); + return EFI_UNSUPPORTED; +} + diff --git a/SecurityPkg/Library/RpmcLibNull/RpmcLibNull.inf b/SecurityPkg/= Library/RpmcLibNull/RpmcLibNull.inf new file mode 100644 index 0000000000..500edfa87d --- /dev/null +++ b/SecurityPkg/Library/RpmcLibNull/RpmcLibNull.inf @@ -0,0 +1,33 @@ +## @file +# Provides Null version of RpmcLib for build purpose. +# +# Copyright (c) 2020, Intel Corporation. All rights reserved.
+# SPDX-License-Identifier: BSD-2-Clause-Patent +# +## + +[Defines] + INF_VERSION =3D 0x00010029 + BASE_NAME =3D RpmcLibNull + FILE_GUID =3D FAE0BA22-92E2-4334-8F0F-96AFF9BAE360 + MODULE_TYPE =3D BASE + VERSION_STRING =3D 1.0 + LIBRARY_CLASS =3D RpmcLib + +# +# The following information is for reference only and not required by the = build tools. +# +# VALID_ARCHITECTURES =3D IA32 X64 Arm AArch64 +# + +[Sources] + RpmcLibNull.c + +[Packages] + MdePkg/MdePkg.dec + SecurityPkg/SecurityPkg.dec + +[LibraryClasses] + BaseLib + DebugLib + diff --git a/SecurityPkg/SecurityPkg.dsc b/SecurityPkg/SecurityPkg.dsc index a2eeadda7a..97e0e7ed6e 100644 --- a/SecurityPkg/SecurityPkg.dsc +++ b/SecurityPkg/SecurityPkg.dsc @@ -64,6 +64,7 @@ TcgStorageCoreLib|SecurityPkg/Library/TcgStorageCoreLib/TcgStorageCoreLi= b.inf TcgStorageOpalLib|SecurityPkg/Library/TcgStorageOpalLib/TcgStorageOpalLi= b.inf ResetSystemLib|MdeModulePkg/Library/BaseResetSystemLibNull/BaseResetSyst= emLibNull.inf + RpmcLib|SecurityPkg/Library/RpmcLibNull/RpmcLibNull.inf =20 [LibraryClasses.ARM] # @@ -217,6 +218,11 @@ SecurityPkg/Library/TcgStorageCoreLib/TcgStorageCoreLib.inf SecurityPkg/Library/TcgStorageOpalLib/TcgStorageOpalLib.inf =20 + # + # Variable Confidentiality & Integrity + # + SecurityPkg/Library/RpmcLibNull/RpmcLibNull.inf + # # Other # --=20 2.24.0.windows.2 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#55942): https://edk2.groups.io/g/devel/message/55942 Mute This Topic: https://groups.io/mt/72040980/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Fri May 3 16:34:37 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+55943+1787277+3901457@groups.io; helo=web01.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+55943+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1584497591; cv=none; d=zohomail.com; s=zohoarc; b=C97vwLOjszKLvCuSKkDnFvoCBPontiJOHlmmNaMVWEMSXmNmBVUtEA3fRw7RN2njmbzTO9NbRr1dyKzUEiq1KOH2NvjU3jCU7c4W55VI8N94s8n66pUGC62RAmzZCRD0xw6RqK8lvYZ5u25iRm51Um5VXLjDB/eavjMbiUqEAq0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1584497591; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Id:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=Vgz3sR5WYRrO5y2YlBX3EEr4NcJYB4YPoUlvZwbgtTU=; b=jjUTsQuJGTOgG4Q1WX23/Q4nwiOJOnFkQtmq5p5gvhJvZKPc6iiDRhllrRjexW3dJPUebQAIbpHQq6zpP+cc9FB9dAA/jgvxvjFt0cDhK+QmpQtwky167fpxEbFPp2OZZAWqB/mPHBtLRQ+bMi3/59x5UeTScotA7JF8eFnwH/4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+55943+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) header.from= Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 1584497591574692.555683207338; Tue, 17 Mar 2020 19:13:11 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id 6YPjYY1788612xKUkJ8Lkp8G; Tue, 17 Mar 2020 19:13:11 -0700 X-Received: from mga05.intel.com (mga05.intel.com []) by mx.groups.io with SMTP id smtpd.web12.7032.1584497586625273837 for ; Tue, 17 Mar 2020 19:13:10 -0700 IronPort-SDR: 6MA0ALCmtooq69OnprrqJj4bMTZuTH/zNsEH5V9UvY1oojkAOVJZeUaj31k/5zfJIhr5Yg2wae K31EGPsotjsw== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 Mar 2020 19:13:10 -0700 IronPort-SDR: E2yPDd5LKQWVaXGqujGRlm/2LMi3tUnYW8rpKUWQp8M8GwFl3t/uHUZxdeM0Xo1917bMLoMh7S upSa/ikhEsTw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.70,565,1574150400"; d="scan'208";a="279593322" X-Received: from shwdeopensfp777.ccr.corp.intel.com ([10.239.158.78]) by fmsmga002.fm.intel.com with ESMTP; 17 Mar 2020 19:13:09 -0700 From: "Wang, Jian J" To: devel@edk2.groups.io Cc: Jiewen Yao , Chao Zhang , Nishant C Mistry Subject: [edk2-devel] [PATCH v3 3/3] SecurityPkg: add null version of VariableKeyLib Date: Wed, 18 Mar 2020 10:13:04 +0800 Message-Id: <20200318021304.2014-4-jian.j.wang@intel.com> In-Reply-To: <20200318021304.2014-1-jian.j.wang@intel.com> References: <20200318021304.2014-1-jian.j.wang@intel.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,jian.j.wang@intel.com X-Gm-Message-State: jucCiOt1L0Rehz84sTlZe3K2x1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1584497591; bh=AfEX56Iz171wbA28T8TZqpUg6Za9Rxqq7hYcErexSIE=; h=Cc:Date:From:Reply-To:Subject:To; b=qjt/ej6x6V15REYSvCkvW7Ep6J8DFvaGvuuduKPRUWkGKqh1RHIF7aDSl2YPcV/WTk1 3jVLMgoOQpiPFgSgAPowRwBZd9Dg3++vrFm5RZ4Iw47WYfPeSE1aTwKdRXtjxxzTZcpjF l1OIXNofNmi+WmhlvVpWdXAgYdEvd+B0lYY= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D2594 Add null version of VariableKeyLib instance. The full version should be provided by platforms which supports key generator. Cc: Jiewen Yao Cc: Chao Zhang Cc: Nishant C Mistry Signed-off-by: Jian J Wang --- .../VariableKeyLibNull/VariableKeyLibNull.c | 67 +++++++++++++++++++ .../VariableKeyLibNull/VariableKeyLibNull.inf | 33 +++++++++ SecurityPkg/SecurityPkg.dsc | 2 + 3 files changed, 102 insertions(+) create mode 100644 SecurityPkg/Library/VariableKeyLibNull/VariableKeyLibNu= ll.c create mode 100644 SecurityPkg/Library/VariableKeyLibNull/VariableKeyLibNu= ll.inf diff --git a/SecurityPkg/Library/VariableKeyLibNull/VariableKeyLibNull.c b/= SecurityPkg/Library/VariableKeyLibNull/VariableKeyLibNull.c new file mode 100644 index 0000000000..2ef6a68ea0 --- /dev/null +++ b/SecurityPkg/Library/VariableKeyLibNull/VariableKeyLibNull.c @@ -0,0 +1,67 @@ +/** @file + Null version of VariableKeyLib for build purpose. Don't use it in real p= roduct. + +Copyright (c) 2020, Intel Corporation. All rights reserved.
+SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ +#include +#include + +/** + Retrieves the variable root key. + + @param[out] VariableRootKey A pointer to pointer for the var= iable root key buffer. + @param[in,out] VariableRootKeySize The size in bytes of the variabl= e root key. + + @retval EFI_SUCCESS The variable root key was returned. + @retval EFI_DEVICE_ERROR An error occurred while attempting= to get the variable root key. + @retval EFI_ACCESS_DENIED The function was invoked after loc= king the key interface. + @retval EFI_UNSUPPORTED The variable root key is not suppo= rted in the current boot configuration. +**/ +EFI_STATUS +EFIAPI +GetVariableRootKey ( + OUT VOID **VariableRootKey, + IN OUT UINTN *VariableRootKeySize + ) +{ + ASSERT (FALSE); + return EFI_UNSUPPORTED; +} + +/** + Regenerates the variable root key. + + @retval EFI_SUCCESS The variable root key was regenera= ted successfully. + @retval EFI_DEVICE_ERROR An error occurred while attempting= to regenerate the root key. + @retval EFI_ACCESS_DENIED The function was invoked after loc= king the key interface. + @retval EFI_UNSUPPORTED Key regeneration is not supported = in the current boot configuration. +**/ +EFI_STATUS +EFIAPI +RegenerateKey ( + VOID + ) +{ + ASSERT (FALSE); + return EFI_UNSUPPORTED; +} + +/** + Locks the regenerate key interface. + + @retval EFI_SUCCESS The key interface was locked succe= ssfully. + @retval EFI_UNSUPPORTED Locking the key interface is not s= upported in the current boot configuration. + @retval Others An error occurred while attempting= to lock the key interface. +**/ +EFI_STATUS +EFIAPI +LockKeyInterface ( + VOID + ) +{ + ASSERT (FALSE); + return EFI_UNSUPPORTED; +} + diff --git a/SecurityPkg/Library/VariableKeyLibNull/VariableKeyLibNull.inf = b/SecurityPkg/Library/VariableKeyLibNull/VariableKeyLibNull.inf new file mode 100644 index 0000000000..ea74e38cf9 --- /dev/null +++ b/SecurityPkg/Library/VariableKeyLibNull/VariableKeyLibNull.inf @@ -0,0 +1,33 @@ +## @file +# Provides Null version of VariableKeyLib for build only. +# +# Copyright (c) 2020, Intel Corporation. All rights reserved.
+# SPDX-License-Identifier: BSD-2-Clause-Patent +# +## + +[Defines] + INF_VERSION =3D 0x00010029 + BASE_NAME =3D VariableKeyLibNull + FILE_GUID =3D 2B640ED8-1E6A-4516-9F1D-25910E59BC4A + MODULE_TYPE =3D BASE + VERSION_STRING =3D 1.0 + LIBRARY_CLASS =3D VariableKeyLib + +# +# The following information is for reference only and not required by the = build tools. +# +# VALID_ARCHITECTURES =3D IA32 X64 Arm AArch64 +# + +[Sources] + VariableKeyLibNull.c + +[Packages] + MdePkg/MdePkg.dec + SecurityPkg/SecurityPkg.dec + +[LibraryClasses] + BaseLib + DebugLib + diff --git a/SecurityPkg/SecurityPkg.dsc b/SecurityPkg/SecurityPkg.dsc index 97e0e7ed6e..4b85f77b02 100644 --- a/SecurityPkg/SecurityPkg.dsc +++ b/SecurityPkg/SecurityPkg.dsc @@ -64,6 +64,7 @@ TcgStorageCoreLib|SecurityPkg/Library/TcgStorageCoreLib/TcgStorageCoreLi= b.inf TcgStorageOpalLib|SecurityPkg/Library/TcgStorageOpalLib/TcgStorageOpalLi= b.inf ResetSystemLib|MdeModulePkg/Library/BaseResetSystemLibNull/BaseResetSyst= emLibNull.inf + VariableKeyLib|SecurityPkg/Library/VariableKeyLibNull/VariableKeyLibNull= .inf RpmcLib|SecurityPkg/Library/RpmcLibNull/RpmcLibNull.inf =20 [LibraryClasses.ARM] @@ -221,6 +222,7 @@ # # Variable Confidentiality & Integrity # + SecurityPkg/Library/VariableKeyLibNull/VariableKeyLibNull.inf SecurityPkg/Library/RpmcLibNull/RpmcLibNull.inf =20 # --=20 2.24.0.windows.2 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#55943): https://edk2.groups.io/g/devel/message/55943 Mute This Topic: https://groups.io/mt/72040981/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-