From nobody Fri Apr 19 05:33:25 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+56372+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+56372+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1585208990; cv=none; d=zohomail.com; s=zohoarc; b=CK4JIbFIsPO9UEo6e9HiBktkndOxlCtzb68tmFI/vFsxU11i8gYTK9CgZxs6cGxrEsgYAwhbgRArb7ukv3MDrtjHgqkJV7rmBc3bVpwCQg2Pv04oIg+OyYCfLF96Wz55weIpJq6PgpRofX2GL+/025FI4WSQGifDMpnZb3aDO0c= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1585208990; 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=PBKnOBaR71P47NEGOunrzIYHoBx7e146HdwTxaL1jWc=; b=GMrybgU/Fy8f7PhrKrONluUO16SGKqwHGs3zEBiNcfh3X+t8aFqMObA2S3k6pAibfsJt2k209ZRE5srlLUzrKxMrLEhod91ntIQkBKoLQA5vgAP7rVzjMIfqnrUTBoWaw5AwpvySR9/2Ufou1HVkXDQSoqOtGSWsDwK4vTT77C0= 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+56372+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 1585208990893536.3482076303071; Thu, 26 Mar 2020 00:49:50 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id mKLNYY1788612xnQDopSW1EO; Thu, 26 Mar 2020 00:49:50 -0700 X-Received: from mga05.intel.com (mga05.intel.com []) by mx.groups.io with SMTP id smtpd.web11.32483.1585208988652183387 for ; Thu, 26 Mar 2020 00:49:50 -0700 IronPort-SDR: /CSvzA/HxLE3gjHZcduNddJTdvZGxo4ucKChdYypnxNBEzUdfR0SLJDzAHxb8Gp/fvAd+mDZE4 Zm0+W0ywUzWg== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Mar 2020 00:49:49 -0700 IronPort-SDR: kpfgZbv9du678/JcDgNwRHtmrenTdYomLTOKkl2OC2k4vJyoqgmRBI4vqi27yM3NEWfBNoXpun eTfKlHMEyp3g== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.72,307,1580803200"; d="scan'208";a="271080254" X-Received: from shwdeopensfp777.ccr.corp.intel.com ([10.239.158.78]) by fmsmga004.fm.intel.com with ESMTP; 26 Mar 2020 00:49:48 -0700 From: "Wang, Jian J" To: devel@edk2.groups.io Cc: Jiewen Yao , Chao Zhang , Nishant C Mistry Subject: [edk2-devel] [PATCH v5 1/3] SecurityPkg: add RpmcLib and VariableKeyLib public headers Date: Thu, 26 Mar 2020 15:49:44 +0800 Message-Id: <20200326074946.1304-2-jian.j.wang@intel.com> In-Reply-To: <20200326074946.1304-1-jian.j.wang@intel.com> References: <20200326074946.1304-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: z2ckI9paE86Vf8iyFYsKAaD0x1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1585208990; bh=+hELIMFOtjlU/en4YekRDfPPTjhqWCI2D3fbYk4vdwI=; h=Cc:Date:From:Reply-To:Subject:To; b=RCcfBErC0Zx1yzHV/4na0H4hjILO99rI7jnjb0af8I2z1g11B96AAVk0FVDa0wGN0lJ WIFwOAhRGy6GsEJImLoVC+6GH1gsAFtC0xpuzkt+MiSkYT4QMdkf+zsHePEkC696YAWkM cN9ppS2d3c0bCkALAyTSP4/cCPRXwSkPUjw= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" > v5: change VariableRootKey to VariableKey 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 Reviewed-by: Jiewen.yao@intel.com Reviewed-by: Michael Kubacki --- SecurityPkg/Include/Library/RpmcLib.h | 42 ++++++++++++++ SecurityPkg/Include/Library/VariableKeyLib.h | 59 ++++++++++++++++++++ SecurityPkg/SecurityPkg.dec | 8 +++ 3 files changed, 109 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..8e3868516c --- /dev/null +++ b/SecurityPkg/Include/Library/RpmcLib.h @@ -0,0 +1,42 @@ +/** @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 monotonic counter from the designated RPMC counter. + + @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 ( + OUT UINT32 *CounterValue + ); + +/** + Increments the monotonic counter in the SPI flash device by 1. + + @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 ( + VOID + ); + +#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..596c8a2319 --- /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 key for integrity and/or confidentiality of variables. + + @param[out] VariableKey A pointer to pointer for the variabl= e key buffer. + @param[in,out] VariableKeySize The size in bytes of the variable ke= y. + + @retval EFI_SUCCESS The variable key was returned. + @retval EFI_DEVICE_ERROR An error occurred while attempting= to get the variable key. + @retval EFI_ACCESS_DENIED The function was invoked after loc= king the key interface. + @retval EFI_UNSUPPORTED The variable key is not supported = in the current boot configuration. +**/ +EFI_STATUS +EFIAPI +GetVariableKey ( + OUT VOID **VariableKey, + IN OUT UINTN *VariableKeySize + ); + +/** + Regenerates the variable key. + + @retval EFI_SUCCESS The variable key was regenerated s= uccessfully. + @retval EFI_DEVICE_ERROR An error occurred while attempting= to regenerate the 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 +RegenerateVariableKey ( + 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 +LockVariableKeyInterface ( + 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 (#56372): https://edk2.groups.io/g/devel/message/56372 Mute This Topic: https://groups.io/mt/72559443/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 Apr 19 05:33:25 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+56373+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+56373+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1585208992; cv=none; d=zohomail.com; s=zohoarc; b=juYeyiHaTVoyddx0GaMDahKxLY/HP8WEZisDmHiwDEEsJa6t1NoBo5xJspTsDKDuo3Sj4qYwYj+ScNJ21DKedUJ2Vme8plOjnltlasqCDyu7f6fsRmiuGqu9qfUmQeK9bN3w9m5IlNYMAJdwJKMZ5XxGn0z2LbPivrOHhYs+yyM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1585208992; 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=3t0UybaMJQemNFKkGV369oYliMdSTgghsmnkAGkH5YE=; b=K2h3FKD92IH2rKx8j5gtkVUHQiuKX9ffllIbz1EuRBAqjUyHPLam5ftWJWX/PZOyWxFxcLbqJv9s1wUOVBo+qCEqYzYSxztTJ2TNiQS3/HyqQMCpI68rQSUg9neMP49t91Xhe+8B7dbgCs19y046NGqTN7U7PCmBoIHvd8zuzTI= 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+56373+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 1585208992207927.243086648065; Thu, 26 Mar 2020 00:49:52 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id WXr9YY1788612xO0mJsIJ7B8; Thu, 26 Mar 2020 00:49:51 -0700 X-Received: from mga05.intel.com (mga05.intel.com []) by mx.groups.io with SMTP id smtpd.web11.32483.1585208988652183387 for ; Thu, 26 Mar 2020 00:49:51 -0700 IronPort-SDR: JV/sbyoszkFu2yznyYjosbK+osNEANP958EOFWUHeVQJiHT/1FguWEWaDCkVgptAyc9KZJAoqQ 1gBMdelL823g== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Mar 2020 00:49:51 -0700 IronPort-SDR: lSu6I7m3bD66HNvShoYDnoxEUcj8qHMaYCQtFBM5OwdxWcHaYE95pYS2eeh+otMNsrlTbBwt0u cWHrwHzLTYEQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.72,307,1580803200"; d="scan'208";a="271080278" X-Received: from shwdeopensfp777.ccr.corp.intel.com ([10.239.158.78]) by fmsmga004.fm.intel.com with ESMTP; 26 Mar 2020 00:49:50 -0700 From: "Wang, Jian J" To: devel@edk2.groups.io Cc: Jiewen Yao , Chao Zhang , Nishant C Mistry Subject: [edk2-devel] [PATCH v5 2/3] SecurityPkg: add null version of RpmcLib Date: Thu, 26 Mar 2020 15:49:45 +0800 Message-Id: <20200326074946.1304-3-jian.j.wang@intel.com> In-Reply-To: <20200326074946.1304-1-jian.j.wang@intel.com> References: <20200326074946.1304-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: c0qdI3S5jbDDPdNzQbe3zxd3x1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1585208991; bh=Bk8nNQQTlCi/FTT+ikLpLCfhH8hazKmwJnNusi6UNLE=; h=Cc:Date:From:Reply-To:Subject:To; b=UClyCUJZWDMLJxoYdjwwYthhSuki1whr0vSurqDOpSem4COrPx2+lAB3swqaaAcaD7d FgSpSNgJjHeRfpADXqAnMgrt1NEVlDmAN6dEuoOpk/ryD4YhH5NUEOFL2qITJzxiT2YBO kRTMi8FwqwrqmyCOx0akoLKWmm7K3Yw4Rw8= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" > v4: remove CounterId which should not be exposed 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 Reviewed-by: Jiewen.yao@intel.com Reviewed-by: Michael Kubacki --- SecurityPkg/Library/RpmcLibNull/RpmcLibNull.c | 47 +++++++++++++++++++ .../Library/RpmcLibNull/RpmcLibNull.inf | 33 +++++++++++++ SecurityPkg/SecurityPkg.dsc | 6 +++ 3 files changed, 86 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..e1dd09eb10 --- /dev/null +++ b/SecurityPkg/Library/RpmcLibNull/RpmcLibNull.c @@ -0,0 +1,47 @@ +/** @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 monotonic counter from the designated RPMC counter. + + @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 ( + OUT UINT32 *CounterValue + ) +{ + ASSERT (FALSE); + return EFI_UNSUPPORTED; +} + +/** + Increments the monotonic counter in the SPI flash device by 1. + + @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 ( + VOID + ) +{ + 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 (#56373): https://edk2.groups.io/g/devel/message/56373 Mute This Topic: https://groups.io/mt/72559444/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 Apr 19 05:33:25 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+56374+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+56374+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1585208993; cv=none; d=zohomail.com; s=zohoarc; b=gf++d0K/Nek6mDXR6v+fSMNdn0jp3ZmFG3fBlykSJVi/XrtrFFXcREOT5ql5jKN2UjrUWQomPYCf823Djaz3wGfw1Irdy1lCrd343zjMytVAQJPEYijdXd1/QsbGIMzG+m+r8K0EbGa+tShZtXIV4aPl0H/UImLCV74ui92wrUE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1585208993; 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=DvZwK9pUEz1QeVbahVPvQ+vxWr959nZDITuCR6fvY5w=; b=J0KkM27Wug4NparcTKk8yfz12MT9XsgnZnfJcQDmFMlW3CkZjXzyeRjBSmTK2jz7usu2GrRqFSeBtRy4pQK0PHQ/yCDNHJ/0lzX2TH50X0/6Fqw5tWv4qBQh44vPJol/kLfPxCPSOCr+F9FjyD+sfiFunTaN2HStSNcBahfUEYo= 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+56374+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 1585208993674903.546584994296; Thu, 26 Mar 2020 00:49:53 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id kqIUYY1788612xQnflhbvRzX; Thu, 26 Mar 2020 00:49:53 -0700 X-Received: from mga05.intel.com (mga05.intel.com []) by mx.groups.io with SMTP id smtpd.web11.32483.1585208988652183387 for ; Thu, 26 Mar 2020 00:49:52 -0700 IronPort-SDR: AoXu3Iu26rn6u7ep6mSk6I3UCsyoLenpN3NEpn/pc9WoKwDAhKb2dIBg/rfK7KXzbsx0XGcMcu CbHzr/KelZqQ== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Mar 2020 00:49:52 -0700 IronPort-SDR: faO4vTU0xuBG5UjhIhKq8uRgW95FmZ/fGZVyhVPXKZH1rAsSwWfqQgllhEpliaxjFWIDkjOs6j r2+59mEM8XMQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.72,307,1580803200"; d="scan'208";a="271080294" X-Received: from shwdeopensfp777.ccr.corp.intel.com ([10.239.158.78]) by fmsmga004.fm.intel.com with ESMTP; 26 Mar 2020 00:49:51 -0700 From: "Wang, Jian J" To: devel@edk2.groups.io Cc: Jiewen Yao , Chao Zhang , Nishant C Mistry Subject: [edk2-devel] [PATCH v5 3/3] SecurityPkg: add null version of VariableKeyLib Date: Thu, 26 Mar 2020 15:49:46 +0800 Message-Id: <20200326074946.1304-4-jian.j.wang@intel.com> In-Reply-To: <20200326074946.1304-1-jian.j.wang@intel.com> References: <20200326074946.1304-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: hAdmsr7bd3exvacAkPTJez4lx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1585208993; bh=8TzOUuuE+Hs44T7txVV7oLNaS05FXZD4poDz/U6N16U=; h=Cc:Date:From:Reply-To:Subject:To; b=NS8f35Yzp+bQ2iEiLch2nOUu4HjQSMiM4rrLBUreFApTzoHekOwW9/CNUcX9pSbDq42 N/MWwj6PwGBp3J0jee3aMDOsAu4+TX54p/S9p4Y1tbNzfBXrM75EXPUwUx2+swMA9Fsbx o1JNZCNg/XsSsllRxsAvsYbc2HyuDIafECA= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" > v5: change VariableRootKey to VariableKey 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 Reviewed-by: Jiewen.yao@intel.com Reviewed-by: Michael Kubacki --- .../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..3ddb37cabc --- /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 key for integrity and/or confidentiality of variables. + + @param[out] VariableKey A pointer to pointer for the variabl= e key buffer. + @param[in,out] VariableKeySize The size in bytes of the variable ke= y. + + @retval EFI_SUCCESS The variable key was returned. + @retval EFI_DEVICE_ERROR An error occurred while attempting= to get the variable key. + @retval EFI_ACCESS_DENIED The function was invoked after loc= king the key interface. + @retval EFI_UNSUPPORTED The variable key is not supported = in the current boot configuration. +**/ +EFI_STATUS +EFIAPI +GetVariableKey ( + OUT VOID **VariableKey, + IN OUT UINTN *VariableKeySize + ) +{ + ASSERT (FALSE); + return EFI_UNSUPPORTED; +} + +/** + Regenerates the variable key. + + @retval EFI_SUCCESS The variable key was regenerated s= uccessfully. + @retval EFI_DEVICE_ERROR An error occurred while attempting= to regenerate the 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 +RegenerateVariableKey ( + 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 +LockVariableKeyInterface ( + 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 (#56374): https://edk2.groups.io/g/devel/message/56374 Mute This Topic: https://groups.io/mt/72559447/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-