From nobody Sun May 5 15:35:29 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+55890+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+55890+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1584374381; cv=none; d=zohomail.com; s=zohoarc; b=T9BgoArfb6IyoyQzNlHrOVj+QCiKQoXo+0eYAMwxL/1z1MOYr4gqxGWL4X1mLOklIWZBFJAD40KFQljxhs3WlCnXAcueIoipHaXpZoiSxpDcsfGQUenGeAkZfzRerbND0cnlZHk4CBY4aMW5OT5duKXVpLthNt4xlH4oCZNB4Wo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1584374381; 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=cXwONA26AGWuHavoUHhDJ5bGuWhR/mLWRmDuahRLj3Y=; b=ELT0sEH9SkpxMFHG25fotc7gfh+yVdVwSNnAP4+3stpMo6tIX9GE8ZD2+RpXY/7Pomy4hGoB0aEalLzpIXbAJ60wPbc1G81bHlitSBjK7yd77AoyrpV5cswGxptL1Oc1jpagMiHSZYs7la6o3J50zo5D+upwgymzBsSbt1klRuc= 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+55890+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 1584374381112974.4936327998076; Mon, 16 Mar 2020 08:59:41 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id 537UYY1788612x8MObozqZ7x; Mon, 16 Mar 2020 08:59:40 -0700 X-Received: from mga14.intel.com (mga14.intel.com []) by mx.groups.io with SMTP id smtpd.web11.71234.1584374378715450970 for ; Mon, 16 Mar 2020 08:59:40 -0700 IronPort-SDR: zHDgTc7LzwebGE8zHpbSDfKiWK2QI+jG/UVIqQB5APlKlfvKU9qsB9MHVATIBPBMISO+nZ1xDs 4skMK2xazeCw== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Mar 2020 08:59:39 -0700 IronPort-SDR: joWZVvYhgZwoY4KN43I94Jcv6wgtEqsLKv9/tJ4U6H12AShYoqaBOx8wp6gEklfVXb8wRrW+fK owFy95oE/4CQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.70,561,1574150400"; d="scan'208";a="290736882" X-Received: from shwdeopensfp777.ccr.corp.intel.com ([10.239.158.78]) by FMSMGA003.fm.intel.com with ESMTP; 16 Mar 2020 08:59:38 -0700 From: "Wang, Jian J" To: devel@edk2.groups.io Cc: Jiewen Yao , Chao Zhang , Nishant C Mistry Subject: [edk2-devel] [PATCH v2 1/3] SecurityPkg: add RpmcLib and VariableKeyLib public headers Date: Mon, 16 Mar 2020 23:59:34 +0800 Message-Id: <20200316155936.2039-2-jian.j.wang@intel.com> In-Reply-To: <20200316155936.2039-1-jian.j.wang@intel.com> References: <20200316155936.2039-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: jM1PBuXQ1pD40G84INFMyJt0x1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1584374380; bh=zXeFNmQ/jeMQFHLVJZitrsviJUuf8Vbrp5DluBH0dQE=; h=Cc:Date:From:Reply-To:Subject:To; b=fs3jFoHBdp+Im/JKpQESg/kRdLdueI4DB2cpelgDZwO0vwaS4ramUmTf3oInSyHeGWJ nT6B96V7yVLezSqgz2SyRrtOAq+uAGpLYJi71rVopzhpP6LJBNqvfG86Gn9poFgoj4/9A jW4MMiFptG99TGXwumsC8Jq0eL+rL/ZfEao= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" > v2: change CounterIndex to CounterId 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 | 50 +++++++++++++++++ SecurityPkg/Include/Library/VariableKeyLib.h | 59 ++++++++++++++++++++ SecurityPkg/SecurityPkg.dec | 8 +++ 3 files changed, 117 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..bc25a0307b --- /dev/null +++ b/SecurityPkg/Include/Library/RpmcLib.h @@ -0,0 +1,50 @@ +/** @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_INVALID_PARAMETER The CounterValue pointer is is NUL= L or CounterId is invalid. + @retval EFI_NOT_READY The given RPMC at CounterId is not= yet initialized. + @retval EFI_DEVICE_ERROR A device error occurred while atte= mpting to update the counter. + @retval EFI_UNSUPPORTED Requesting the monotonic counter i= s not supported in the current boot configuration. +**/ +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_INVALID_PARAMETER The given CounterId value is inval= id. + @retval EFI_NOT_READY The given RPMC at CounterId is not= yet initialized. + @retval EFI_DEVICE_ERROR A device error occurred while atte= mpting to update the counter. + @retval EFI_UNSUPPORTED Incrementing the monotonic counter= is not supported in the current boot configuration. +**/ +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 (#55890): https://edk2.groups.io/g/devel/message/55890 Mute This Topic: https://groups.io/mt/72001670/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 Sun May 5 15:35:29 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+55891+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+55891+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1584374382; cv=none; d=zohomail.com; s=zohoarc; b=O94phNDNRzyLSOISSYb+/saSOBnKZel4K3WzjDM3niylqwExLJrfv9EA27ef9CJblnvRqXIKGDJcWwj+aMTY1DfLY9ONpiKOFkTT8Bu2q/hGsfSfV5fjM4dRjqOhP3F5Iz/Ne6nbEUC9ANC14pCDmQcUcOzVOwxb4/wLfXJB4qc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1584374382; 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=UNrGeQQn3Ptxv89JovVKUZQjbZNEfs2Wdf8Qdv1mi2M=; b=niq0Abqo2dp5eWqkp8xWlyxH478tDyPuEnMMfbditPa7qu/3sezB++d/60G7XXdXuSbiPJxaPZiC2RUmEvbiCdWd65gQAQsUzO4h7taYUT3Dul4YOlQM+0Jb9OsDkh41U4NIQE9QfZztm5BvEjcX9+sVaMUTJaWHHGxsmtrkSIM= 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+55891+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 1584374382757488.90076479488573; Mon, 16 Mar 2020 08:59:42 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id dNHlYY1788612xQf2DOW9pYM; Mon, 16 Mar 2020 08:59:42 -0700 X-Received: from mga14.intel.com (mga14.intel.com []) by mx.groups.io with SMTP id smtpd.web11.71234.1584374378715450970 for ; Mon, 16 Mar 2020 08:59:41 -0700 IronPort-SDR: +Jbonf02eErebdetztRanbfo/EGSLwS2lmlW+l2pF311DvJ47n3gnU3b5e5ptYuKYFiPAnsdPP u5B1Ja2CPAPQ== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Mar 2020 08:59:41 -0700 IronPort-SDR: KXav4xNrttTPkdgzirs75nJVnZU7t7gMK8Oi3S8STNEun+VI0mQ29afB/1RLkOeffb2jEPhKZK BnF89KyBiBWQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.70,561,1574150400"; d="scan'208";a="290736888" X-Received: from shwdeopensfp777.ccr.corp.intel.com ([10.239.158.78]) by FMSMGA003.fm.intel.com with ESMTP; 16 Mar 2020 08:59:40 -0700 From: "Wang, Jian J" To: devel@edk2.groups.io Cc: Jiewen Yao , Chao Zhang , Nishant C Mistry Subject: [edk2-devel] [PATCH v2 2/3] SecurityPkg: add null version of RpmcLib Date: Mon, 16 Mar 2020 23:59:35 +0800 Message-Id: <20200316155936.2039-3-jian.j.wang@intel.com> In-Reply-To: <20200316155936.2039-1-jian.j.wang@intel.com> References: <20200316155936.2039-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: BbN8Rj15hyeKPszkVU579HJGx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1584374382; bh=ArKvgASQVPeC+0nzser8J0BHxH1SvKCM2XQoPH3iKU4=; h=Cc:Date:From:Reply-To:Subject:To; b=O/sjSgGCiF/o78XDeTbWnC7y3YakUvvMTIU0kVxlU/1ya9wQVYFhwq0+HVCXJLk1P3A juhhVETQJjOAsNtq5tZ/tMCSNAGx/hPZ48vl49+IFZMotFJzUpc0GmZH/DdIc9hO9ZDCJ Wt3S4EwS827ISPlyRpphk85ayr9WWY7IK+g= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" > v2: change CounterIndex to CounterId 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 | 55 +++++++++++++++++++ .../Library/RpmcLibNull/RpmcLibNull.inf | 33 +++++++++++ SecurityPkg/SecurityPkg.dsc | 6 ++ 3 files changed, 94 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..90352817bb --- /dev/null +++ b/SecurityPkg/Library/RpmcLibNull/RpmcLibNull.c @@ -0,0 +1,55 @@ +/** @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_INVALID_PARAMETER The CounterValue pointer is NULL o= r CounterId is invalid. + @retval EFI_NOT_READY The given RPMC at CounterId is not= yet initialized. + @retval EFI_DEVICE_ERROR A device error occurred while atte= mpting to update the counter. + @retval EFI_UNSUPPORTED Requesting the monotonic counter i= s not supported in the current boot configuration. +**/ +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_INVALID_PARAMETER The given CounterId value is inval= id. + @retval EFI_NOT_READY The given RPMC at CounterId is not= yet initialized. + @retval EFI_DEVICE_ERROR A device error occurred while atte= mpting to update the counter. + @retval EFI_UNSUPPORTED Incrementing the monotonic counter= is not supported in the current boot configuration. +**/ +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 (#55891): https://edk2.groups.io/g/devel/message/55891 Mute This Topic: https://groups.io/mt/72001674/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 Sun May 5 15:35:29 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+55892+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+55892+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1584374383; cv=none; d=zohomail.com; s=zohoarc; b=WIpDoyUh2hv6II1V8IXaHu25GgAo1LVe5pwbIAj92Cd5lpDa7RLyWRJurcT9qCW32bH51u32BQULLVxT+V7uHpWaLGG3rQot7XVnvoV9+xjXjF9uQv4T8tE6G8l4kS0asONHzkPvh5LX6nNiX2fqrCi0YZGgqXFPRa0dSj5tDHg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1584374383; 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=SA1YVG0shB24he5vcdWHwbM3Uh1m75Jf2zpDHamVfho=; b=V9qXody9PclVKqYW6wP4G0NZiLzi/kBhE7LL+NBVNmOY1x7dxbqBkGsC+zPi6Ey10lC+aOfFwSaFsNXn7hfjJ/EDuC7QlNkC2RkWIu8gbptHImHzygDJEv8ujq1WGTyz7sFMeTzTy7L9gUIQvbXV3jzX5r+6CGdxMM1+O+q7znI= 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+55892+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 1584374383905361.976800190576; Mon, 16 Mar 2020 08:59:43 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id pvQlYY1788612xdu4WL32Sz6; Mon, 16 Mar 2020 08:59:43 -0700 X-Received: from mga14.intel.com (mga14.intel.com []) by mx.groups.io with SMTP id smtpd.web11.71234.1584374378715450970 for ; Mon, 16 Mar 2020 08:59:43 -0700 IronPort-SDR: L2SpuxbzWA7BY4W31hCCv1C9L8Fn0ijdZONEyHO8yIz9Rqkw0P+7R+Ng64vDjiDJoR6y1d7BnZ HiOEITfVqjaw== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Mar 2020 08:59:42 -0700 IronPort-SDR: vSpWo4WxpoVur679TMA7vMR8fba91DEIylCJcKTeML25xIcasKeXftW/XZlJKk2PIk2tVhcED5 0fU1Tmo8TjpA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.70,561,1574150400"; d="scan'208";a="290736892" X-Received: from shwdeopensfp777.ccr.corp.intel.com ([10.239.158.78]) by FMSMGA003.fm.intel.com with ESMTP; 16 Mar 2020 08:59:41 -0700 From: "Wang, Jian J" To: devel@edk2.groups.io Cc: Jiewen Yao , Chao Zhang , Nishant C Mistry Subject: [edk2-devel] [PATCH v2 3/3] SecurityPkg: add null version of VariableKeyLib Date: Mon, 16 Mar 2020 23:59:36 +0800 Message-Id: <20200316155936.2039-4-jian.j.wang@intel.com> In-Reply-To: <20200316155936.2039-1-jian.j.wang@intel.com> References: <20200316155936.2039-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: vhVsR5TOFjUmDoDIURz5WAV6x1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1584374383; bh=m0/ogM2uoGJbTp5qjKvjnsbtfkWf1tDWkQmUU+ziSw0=; h=Cc:Date:From:Reply-To:Subject:To; b=KHk5XyEnayROGQEMGJW2gbZKDPcbsZMYZ/iKYlP1NFLXWdiQykknt+G1TaGWTXPhR/6 5Wma+VO2fIQB3VgQ+Fi18JvBjfztfNOijbiDuwsc+FA7qDwZQqxgRNomcv7bMpAuvM3/O uzS2HqhCq0K08/VlCK44vOiYbdMj9i0CAas= 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 (#55892): https://edk2.groups.io/g/devel/message/55892 Mute This Topic: https://groups.io/mt/72001675/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-