From mboxrd@z Thu Jan 1 00:00:00 1970 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 Authentication-Results: mx.groups.io; dkim=missing; spf=fail (domain: intel.com, ip: , mailfrom: jian.j.wang@intel.com) IronPort-SDR: +Jbonf02eErebdetztRanbfo/EGSLwS2lmlW+l2pF311DvJ47n3gnU3b5e5ptYuKYFiPAnsdPP u5B1Ja2CPAPQ== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False 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" 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: [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> X-Mailer: git-send-email 2.24.0.windows.2 In-Reply-To: <20200316155936.2039-1-jian.j.wang@intel.com> References: <20200316155936.2039-1-jian.j.wang@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable > 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=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] CounterId Monotonic Counter Id.=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 CounterId is invalid.=0D + @retval EFI_NOT_READY The given RPMC at CounterId 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 CounterId,=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] CounterId Monotonic Counter Id.=0D +=0D + @retval EFI_SUCCESS The operation completed successful= ly.=0D + @retval EFI_INVALID_PARAMETER The given CounterId value is inval= id.=0D + @retval EFI_NOT_READY The given RPMC at CounterId 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 CounterId=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