From mboxrd@z Thu Jan 1 00:00:00 1970 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 Authentication-Results: mx.groups.io; dkim=missing; spf=fail (domain: intel.com, ip: , mailfrom: jian.j.wang@intel.com) IronPort-SDR: /CSvzA/HxLE3gjHZcduNddJTdvZGxo4ucKChdYypnxNBEzUdfR0SLJDzAHxb8Gp/fvAd+mDZE4 Zm0+W0ywUzWg== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False 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" 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: [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> X-Mailer: git-send-email 2.24.0.windows.2 In-Reply-To: <20200326074946.1304-1-jian.j.wang@intel.com> References: <20200326074946.1304-1-jian.j.wang@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable > 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 --- 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=0D + Public definitions for the Replay Protected Monotonic Counter (RPMC) Lib= rary.=0D +=0D +Copyright (c) 2020, Intel Corporation. All rights reserved.
=0D +SPDX-License-Identifier: BSD-2-Clause-Patent=0D +=0D +**/=0D +=0D +#ifndef _RPMC_LIB_H_=0D +#define _RPMC_LIB_H_=0D +=0D +#include =0D +=0D +/**=0D + Requests the monotonic counter from the designated RPMC counter.=0D +=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_DEVICE_ERROR A device error occurred while atte= mpting to update the counter.=0D + @retval EFI_UNSUPPORTED The operation is un-supported.=0D +**/=0D +EFI_STATUS=0D +EFIAPI=0D +RequestMonotonicCounter (=0D + OUT UINT32 *CounterValue=0D + );=0D +=0D +/**=0D + Increments the monotonic counter in the SPI flash device by 1.=0D +=0D + @retval EFI_SUCCESS The operation completed successful= ly.=0D + @retval EFI_DEVICE_ERROR A device error occurred while atte= mpting to update the counter.=0D + @retval EFI_UNSUPPORTED The operation is un-supported.=0D +**/=0D +EFI_STATUS=0D +EFIAPI=0D +IncrementMonotonicCounter (=0D + VOID=0D + );=0D +=0D +#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=0D + Public definitions for Variable Key Library.=0D +=0D +Copyright (c) 2020, Intel Corporation. All rights reserved.
=0D +SPDX-License-Identifier: BSD-2-Clause-Patent=0D +=0D +**/=0D +=0D +#ifndef _VARIABLE_KEY_LIB_H_=0D +#define _VARIABLE_KEY_LIB_H_=0D +=0D +#include =0D +=0D +/**=0D + Retrieves the key for integrity and/or confidentiality of variables.=0D +=0D + @param[out] VariableKey A pointer to pointer for the variabl= e key buffer.=0D + @param[in,out] VariableKeySize The size in bytes of the variable ke= y.=0D +=0D + @retval EFI_SUCCESS The variable key was returned.=0D + @retval EFI_DEVICE_ERROR An error occurred while attempting= to get the variable key.=0D + @retval EFI_ACCESS_DENIED The function was invoked after loc= king the key interface.=0D + @retval EFI_UNSUPPORTED The variable key is not supported = in the current boot configuration.=0D +**/=0D +EFI_STATUS=0D +EFIAPI=0D +GetVariableKey (=0D + OUT VOID **VariableKey,=0D + IN OUT UINTN *VariableKeySize=0D + );=0D +=0D +/**=0D + Regenerates the variable key.=0D +=0D + @retval EFI_SUCCESS The variable key was regenerated s= uccessfully.=0D + @retval EFI_DEVICE_ERROR An error occurred while attempting= to regenerate the key.=0D + @retval EFI_ACCESS_DENIED The function was invoked after loc= king the key interface.=0D + @retval EFI_UNSUPPORTED Key regeneration is not supported = in the current boot configuration.=0D +**/=0D +EFI_STATUS=0D +EFIAPI=0D +RegenerateVariableKey (=0D + VOID=0D + );=0D +=0D +/**=0D + Locks the regenerate key interface.=0D +=0D + @retval EFI_SUCCESS The key interface was locked succe= ssfully.=0D + @retval EFI_UNSUPPORTED Locking the key interface is not s= upported in the current boot configuration.=0D + @retval Others An error occurred while attempting= to lock the key interface.=0D +**/=0D +EFI_STATUS=0D +EFIAPI=0D +LockVariableKeyInterface (=0D + VOID=0D + );=0D +=0D +#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 @@ #=0D TcgStorageOpalLib|Include/Library/TcgStorageOpalLib.h=0D =0D + ## @libraryclass Provides interfaces to access RPMC device.=0D + #=0D + RpmcLib|Include/Library/RpmcLib.h=0D +=0D + ## @libraryclass Provides interfaces to access variable root key.=0D + #=0D + VariableKeyLib|Include/Library/VariableKeyLib.h=0D +=0D [Guids]=0D ## Security package token space guid.=0D # Include/Guid/SecurityPkgTokenSpace.h=0D --=20 2.24.0.windows.2