From: "Linus Liu" <linus.liu@intel.com>
To: "devel@edk2.groups.io" <devel@edk2.groups.io>
Cc: "Yao, Jiewen" <jiewen.yao@intel.com>,
"Chu, Maggie" <maggie.chu@intel.com>,
"Kumar, Rahul R" <rahul.r.kumar@intel.com>
Subject: Re: [PATCH v1] Securitypkg/hddpassword: Update HddPasswordDxeInit to use Variable Policy
Date: Fri, 28 Apr 2023 05:06:56 +0000 [thread overview]
Message-ID: <PH7PR11MB5888E8789F9E9D9954837E1FFC6B9@PH7PR11MB5888.namprd11.prod.outlook.com> (raw)
In-Reply-To: <20230428025543.127-1-linus.liu@intel.com>
Hi Jiewen and Rahul R
Please help to review the patch.
Thanks
-----Original Message-----
From: Liu, Linus <linus.liu@intel.com>
Sent: Friday, April 28, 2023 10:56 AM
To: devel@edk2.groups.io
Cc: Liu, Linus <linus.liu@intel.com>; Yao, Jiewen <jiewen.yao@intel.com>; Chu, Maggie <maggie.chu@intel.com>; Kumar, Rahul R <rahul.r.kumar@intel.com>
Subject: [PATCH v1] Securitypkg/hddpassword: Update HddPasswordDxeInit to use Variable Policy
From: Linus Liu <linus.liu@intel.com>
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4408
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Maggie Chu <maggie.chu@intel.com>
Cc: Kumar Rahul <rahul.r.kumar@intel.com>
Signed-off-by: Linus Liu <linus.liu@intel.com>
---
SecurityPkg/HddPassword/HddPasswordDxe.c | 20 +++++++++++++-------
SecurityPkg/HddPassword/HddPasswordDxe.h | 1 -
SecurityPkg/HddPassword/HddPasswordDxe.inf | 3 ++-
SecurityPkg/SecurityPkg.dsc | 1 +
4 files changed, 16 insertions(+), 9 deletions(-)
diff --git a/SecurityPkg/HddPassword/HddPasswordDxe.c b/SecurityPkg/HddPassword/HddPasswordDxe.c
index 55dfb25886..86c11c749f 100644
--- a/SecurityPkg/HddPassword/HddPasswordDxe.c
+++ b/SecurityPkg/HddPassword/HddPasswordDxe.c
@@ -9,6 +9,7 @@
**/
#include "HddPasswordDxe.h"
+#include <Library/VariablePolicyHelperLib.h>
EFI_GUID mHddPasswordVendorGuid = HDD_PASSWORD_CONFIG_GUID;
CHAR16 mHddPasswordVendorStorageName[] = L"HDD_PASSWORD_CONFIG";
@@ -2822,7 +2823,7 @@ HddPasswordDxeInit (
HDD_PASSWORD_DXE_PRIVATE_DATA *Private;
VOID *Registration;
EFI_EVENT EndOfDxeEvent;
- EDKII_VARIABLE_LOCK_PROTOCOL *VariableLock;
+ EDKII_VARIABLE_POLICY_PROTOCOL *VariablePolicy;
Private = NULL;
@@ -2858,13 +2859,18 @@ HddPasswordDxeInit (
//
// Make HDD_PASSWORD_VARIABLE_NAME variable read-only.
//
- Status = gBS->LocateProtocol (&gEdkiiVariableLockProtocolGuid, NULL, (VOID **)&VariableLock);
+ Status = gBS->LocateProtocol (&gEdkiiVariablePolicyProtocolGuid, NULL, (VOID **)&VariablePolicy);
if (!EFI_ERROR (Status)) {
- Status = VariableLock->RequestToLock (
- VariableLock,
- HDD_PASSWORD_VARIABLE_NAME,
- &mHddPasswordVendorGuid
- );
+ Status = RegisterBasicVariablePolicy (
+ VariablePolicy,
+ &mHddPasswordVendorGuid,
+ HDD_PASSWORD_VARIABLE_NAME,
+ VARIABLE_POLICY_NO_MIN_SIZE,
+ VARIABLE_POLICY_NO_MAX_SIZE,
+ VARIABLE_POLICY_NO_MUST_ATTR,
+ VARIABLE_POLICY_NO_CANT_ATTR,
+ VARIABLE_POLICY_TYPE_LOCK_NOW
+ );
DEBUG ((DEBUG_INFO, "%a(): Lock %s variable (%r)\n", __func__, HDD_PASSWORD_VARIABLE_NAME, Status));
ASSERT_EFI_ERROR (Status);
}
diff --git a/SecurityPkg/HddPassword/HddPasswordDxe.h b/SecurityPkg/HddPassword/HddPasswordDxe.h
index 231533e737..049a208794 100644
--- a/SecurityPkg/HddPassword/HddPasswordDxe.h
+++ b/SecurityPkg/HddPassword/HddPasswordDxe.h
@@ -17,7 +17,6 @@
#include <Protocol/AtaPassThru.h>
#include <Protocol/PciIo.h>
#include <Protocol/HiiConfigAccess.h>
-#include <Protocol/VariableLock.h>
#include <Guid/MdeModuleHii.h>
#include <Guid/EventGroup.h>
diff --git a/SecurityPkg/HddPassword/HddPasswordDxe.inf b/SecurityPkg/HddPassword/HddPasswordDxe.inf
index 06e8755ffc..2c0ebbcc78 100644
--- a/SecurityPkg/HddPassword/HddPasswordDxe.inf
+++ b/SecurityPkg/HddPassword/HddPasswordDxe.inf
@@ -50,6 +50,7 @@
PrintLib
UefiLib
LockBoxLib
+ VariablePolicyHelperLib
S3BootScriptLib
PciLib
BaseCryptLib
@@ -63,7 +64,7 @@
gEfiHiiConfigAccessProtocolGuid ## PRODUCES
gEfiAtaPassThruProtocolGuid ## CONSUMES
gEfiPciIoProtocolGuid ## CONSUMES
- gEdkiiVariableLockProtocolGuid ## CONSUMES
+ gEdkiiVariablePolicyProtocolGuid ## CONSUMES
[Pcd]
gEfiSecurityPkgTokenSpaceGuid.PcdSkipHddPasswordPrompt ## CONSUMES
diff --git a/SecurityPkg/SecurityPkg.dsc b/SecurityPkg/SecurityPkg.dsc
index 3bad5375c0..3c62205162 100644
--- a/SecurityPkg/SecurityPkg.dsc
+++ b/SecurityPkg/SecurityPkg.dsc
@@ -74,6 +74,7 @@
PlatformPKProtectionLib|SecurityPkg/Library/PlatformPKProtectionLibVarPolicy/PlatformPKProtectionLibVarPolicy.inf
SecureBootVariableProvisionLib|SecurityPkg/Library/SecureBootVariableProvisionLib/SecureBootVariableProvisionLib.inf
TdxLib|MdePkg/Library/TdxLib/TdxLib.inf
+ VariablePolicyHelperLib|MdeModulePkg/Library/VariablePolicyHelperLib/VariablePolicyHelperLib.inf
[LibraryClasses.ARM, LibraryClasses.AARCH64]
#
--
2.39.2.windows.1
next prev parent reply other threads:[~2023-04-28 5:07 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-28 2:55 [PATCH v1] Securitypkg/hddpassword: Update HddPasswordDxeInit to use Variable Policy Linus Liu
2023-04-28 5:06 ` Linus Liu [this message]
-- strict thread matches above, loose matches on Subject: below --
2023-04-12 5:00 Linus Liu
2023-04-11 10:13 Linus Liu
2023-04-11 10:03 Linus Liu
2023-04-11 10:01 Linus Liu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-list from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=PH7PR11MB5888E8789F9E9D9954837E1FFC6B9@PH7PR11MB5888.namprd11.prod.outlook.com \
--to=devel@edk2.groups.io \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox