From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga17.intel.com (mga17.intel.com []) by mx.groups.io with SMTP id smtpd.web11.4405.1583992343621109277 for ; Wed, 11 Mar 2020 22:52:26 -0700 Authentication-Results: mx.groups.io; dkim=missing; spf=fail (domain: intel.com, ip: , mailfrom: jian.j.wang@intel.com) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga107.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 11 Mar 2020 22:52:26 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.70,543,1574150400"; d="scan'208";a="236706544" Received: from shwdeopensfp777.ccr.corp.intel.com ([10.239.158.78]) by orsmga008.jf.intel.com with ESMTP; 11 Mar 2020 22:52:24 -0700 From: "Wang, Jian J" To: devel@edk2.groups.io Cc: Jiewen Yao , Chao Zhang , Nishant C Mistry Subject: [PATCH 2/3] SecurityPkg: add null version of RpmcLib Date: Thu, 12 Mar 2020 13:52:20 +0800 Message-Id: <20200312055221.1781-3-jian.j.wang@intel.com> X-Mailer: git-send-email 2.24.0.windows.2 In-Reply-To: <20200312055221.1781-1-jian.j.wang@intel.com> References: <20200312055221.1781-1-jian.j.wang@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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..586590c65f --- /dev/null +++ b/SecurityPkg/Library/RpmcLibNull/RpmcLibNull.c @@ -0,0 +1,55 @@ +/** @file=0D + NULL RpmcLib instance for build purpose.=0D +=0D +Copyright (c) 2020, Intel Corporation. All rights reserved.
=0D +SPDX-License-Identifier: BSD-2-Clause-Patent=0D +=0D +**/=0D +=0D +#include =0D +#include =0D +=0D +/**=0D + Requests the current monotonic counter from the designated RPMC counter.= =0D +=0D + @param[in] CounterIndex The RPMC index.=0D + @param[out] CounterValue A pointer to a buffer to store the= RPMC value.=0D +=0D + @retval EFI_SUCCESS The operation completed successful= ly.=0D + @retval EFI_INVALID_PARAMETER The CounterValue pointer is NULL o= r CounterIndex is invalid.=0D + @retval EFI_NOT_READY The given RPMC at CounterIndex is = not yet initialized.=0D + @retval EFI_DEVICE_ERROR A device error occurred while atte= mpting to update the counter.=0D + @retval EFI_UNSUPPORTED Requesting the monotonic counter i= s not supported in the current boot configuration.=0D +**/=0D +EFI_STATUS=0D +EFIAPI=0D +RequestMonotonicCounter (=0D + IN UINT8 CounterIndex,=0D + OUT UINT32 *CounterValue=0D + )=0D +{=0D + ASSERT (FALSE);=0D + return EFI_UNSUPPORTED;=0D +}=0D +=0D +/**=0D + Increments the designated monotonic counter in the SPI flash device by 1= .=0D +=0D + @param[in] CounterIndex The RPMC index.=0D +=0D + @retval EFI_SUCCESS The operation completed successful= ly.=0D + @retval EFI_INVALID_PARAMETER The given CounterIndex value is in= valid.=0D + @retval EFI_NOT_READY The given RPMC at CounterIndex is = not yet initialized.=0D + @retval EFI_DEVICE_ERROR A device error occurred while atte= mpting to update the counter.=0D + @retval EFI_UNSUPPORTED Incrementing the monotonic counter= is not supported in the current boot configuration.=0D +**/=0D +EFI_STATUS=0D +EFIAPI=0D +IncrementMonotonicCounter (=0D + IN UINT8 CounterIndex=0D + )=0D +{=0D + ASSERT (FALSE);=0D + return EFI_UNSUPPORTED;=0D +}=0D +=0D 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=0D +# Provides Null version of RpmcLib for build purpose.=0D +#=0D +# Copyright (c) 2020, Intel Corporation. All rights reserved.
=0D +# SPDX-License-Identifier: BSD-2-Clause-Patent=0D +#=0D +##=0D +=0D +[Defines]=0D + INF_VERSION =3D 0x00010029=0D + BASE_NAME =3D RpmcLibNull=0D + FILE_GUID =3D FAE0BA22-92E2-4334-8F0F-96AFF9BAE360= =0D + MODULE_TYPE =3D BASE=0D + VERSION_STRING =3D 1.0=0D + LIBRARY_CLASS =3D RpmcLib=0D +=0D +#=0D +# The following information is for reference only and not required by the = build tools.=0D +#=0D +# VALID_ARCHITECTURES =3D IA32 X64 Arm AArch64=0D +#=0D +=0D +[Sources]=0D + RpmcLibNull.c=0D +=0D +[Packages]=0D + MdePkg/MdePkg.dec=0D + SecurityPkg/SecurityPkg.dec=0D +=0D +[LibraryClasses]=0D + BaseLib=0D + DebugLib=0D +=0D 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=0D TcgStorageOpalLib|SecurityPkg/Library/TcgStorageOpalLib/TcgStorageOpalLi= b.inf=0D ResetSystemLib|MdeModulePkg/Library/BaseResetSystemLibNull/BaseResetSyst= emLibNull.inf=0D + RpmcLib|SecurityPkg/Library/RpmcLibNull/RpmcLibNull.inf=0D =0D [LibraryClasses.ARM]=0D #=0D @@ -217,6 +218,11 @@ SecurityPkg/Library/TcgStorageCoreLib/TcgStorageCoreLib.inf=0D SecurityPkg/Library/TcgStorageOpalLib/TcgStorageOpalLib.inf=0D =0D + #=0D + # Variable Confidentiality & Integrity=0D + #=0D + SecurityPkg/Library/RpmcLibNull/RpmcLibNull.inf=0D +=0D #=0D # Other=0D #=0D --=20 2.24.0.windows.2