From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by mx.groups.io with SMTP id smtpd.web10.7336.1654754625219451717 for ; Wed, 08 Jun 2022 23:03:47 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="unable to parse pub key" header.i=@intel.com header.s=intel header.b=CvtkRDn6; spf=pass (domain: intel.com, ip: 192.55.52.43, mailfrom: judah.vang@intel.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1654754627; x=1686290627; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=4UakLWaJ8CugX7q936cghExji29oppnlyd1epams6KI=; b=CvtkRDn6Yc9opEwmqhWGYbB0pOVp5uxwWy/EGYzN5Vb9wDev8OzPWOZl Xr7cf42P3AA5r6Ri5ANszrM5byeCUuXccaR19S7Ql07kriGJhAgF22b3z EqQfxcpsahSE5Q2owIXEDgNyv401zInwJVAKcbXu+3jJWiD4M+AGhLeSV I4L73Iuw4R7+PEJPvi+FyN6eRSwo6VT2qa/KaU7sV6pzWzvVq27bOJ8nw +qe/FmmN2XdtyWqmF8dz8vRjYqDlkUiUEvcLzy0iKZym6+X+i51eaDGS5 Xhc7cw701wW1XiAZgfk2+2GqAfL6WaSt0qlWuEX8sEcOx3JlHvSHw4r6d A==; X-IronPort-AV: E=McAfee;i="6400,9594,10372"; a="363487934" X-IronPort-AV: E=Sophos;i="5.91,287,1647327600"; d="scan'208";a="363487934" Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Jun 2022 23:03:47 -0700 X-IronPort-AV: E=Sophos;i="5.91,287,1647327600"; d="scan'208";a="566239872" Received: from jvang-mobl.amr.corp.intel.com ([10.209.91.16]) by orsmga002-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Jun 2022 23:03:46 -0700 From: "Judah Vang" To: devel@edk2.groups.io Cc: Jian J Wang , Jiewen Yao , Nishant C Mistry Subject: [PATCH v3 12/28] SecurityPkg: Add new variable types and functions Date: Wed, 8 Jun 2022 23:03:06 -0700 Message-Id: <20220609060322.3491-13-judah.vang@intel.com> X-Mailer: git-send-email 2.35.1.windows.2 In-Reply-To: <20220609060322.3491-1-judah.vang@intel.com> References: <20220609060322.3491-1-judah.vang@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2594 Add new variable encryption/decryption function prototypes. Add new variable digest structure. Add new Protected variable function prototypes. Update RPMC APIs to Add an index because there is could more than one counter. Cc: Jian J Wang Cc: Jiewen Yao Cc: Nishant C Mistry Signed-off-by: Jian J Wang Signed-off-by: Nishant C Mistry Signed-off-by: Judah Vang --- SecurityPkg/Include/Library/RpmcLib.h | 15 +++++--- SecurityPkg/Include/Library/VariableKeyLib.h | 37 +++----------------- 2 files changed, 16 insertions(+), 36 deletions(-) diff --git a/SecurityPkg/Include/Library/RpmcLib.h b/SecurityPkg/Include/Library/RpmcLib.h index df4ba34ba8cf..cb71dfcd7e4d 100644 --- a/SecurityPkg/Include/Library/RpmcLib.h +++ b/SecurityPkg/Include/Library/RpmcLib.h @@ -1,19 +1,23 @@ /** @file Public definitions for the Replay Protected Monotonic Counter (RPMC) Library. -Copyright (c) 2020, Intel Corporation. All rights reserved.
+Copyright (c) 2020 - 2022, Intel Corporation. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent **/ -#ifndef _RPMC_LIB_H_ -#define _RPMC_LIB_H_ +#ifndef RPMC_LIB_H_ +#define RPMC_LIB_H_ #include +#define RPMC_COUNTER_1 0 +#define RPMC_COUNTER_2 1 + /** Requests the monotonic counter from the designated RPMC counter. + @param[in] CounterIndex The RPMC index @param[out] CounterValue A pointer to a buffer to store the RPMC value. @retval EFI_SUCCESS The operation completed successfully. @@ -23,12 +27,15 @@ SPDX-License-Identifier: BSD-2-Clause-Patent EFI_STATUS EFIAPI RequestMonotonicCounter ( + IN UINT8 CounterIndex, OUT UINT32 *CounterValue ); /** Increments the monotonic counter in the SPI flash device by 1. + @param[in] CounterIndex The RPMC index + @retval EFI_SUCCESS The operation completed successfully. @retval EFI_DEVICE_ERROR A device error occurred while attempting to update the counter. @retval EFI_UNSUPPORTED The operation is un-supported. @@ -36,7 +43,7 @@ RequestMonotonicCounter ( EFI_STATUS EFIAPI IncrementMonotonicCounter ( - VOID + IN UINT8 CounterIndex ); #endif diff --git a/SecurityPkg/Include/Library/VariableKeyLib.h b/SecurityPkg/Include/Library/VariableKeyLib.h index 561ebad09da2..6076c4d4731b 100644 --- a/SecurityPkg/Include/Library/VariableKeyLib.h +++ b/SecurityPkg/Include/Library/VariableKeyLib.h @@ -1,13 +1,13 @@ /** @file Public definitions for Variable Key Library. -Copyright (c) 2020, Intel Corporation. All rights reserved.
+Copyright (c) 2020 - 2022, Intel Corporation. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent **/ -#ifndef _VARIABLE_KEY_LIB_H_ -#define _VARIABLE_KEY_LIB_H_ +#ifndef VARIABLE_KEY_LIB_H_ +#define VARIABLE_KEY_LIB_H_ #include @@ -25,35 +25,8 @@ SPDX-License-Identifier: BSD-2-Clause-Patent EFI_STATUS EFIAPI GetVariableKey ( - OUT VOID **VariableKey, - IN OUT UINTN *VariableKeySize - ); - -/** - Regenerates the variable key. - - @retval EFI_SUCCESS The variable key was regenerated successfully. - @retval EFI_DEVICE_ERROR An error occurred while attempting to regenerate the key. - @retval EFI_ACCESS_DENIED The function was invoked after locking 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 successfully. - @retval EFI_UNSUPPORTED Locking the key interface is not supported in the current boot configuration. - @retval Others An error occurred while attempting to lock the key interface. -**/ -EFI_STATUS -EFIAPI -LockVariableKeyInterface ( - VOID + OUT VOID *VariableKey, + IN UINTN VariableKeySize ); #endif -- 2.35.1.windows.2