From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by mx.groups.io with SMTP id smtpd.web10.5746.1681184882019319117 for ; Mon, 10 Apr 2023 20:48:02 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="unable to parse pub key" header.i=@intel.com header.s=intel header.b=COf8iW6m; spf=pass (domain: intel.com, ip: 192.55.52.115, mailfrom: linus.liu@intel.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1681184882; x=1712720882; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=NttS+sCtvAbZn58EWGK5kbllX7aJVbi6T74cjJCpjUA=; b=COf8iW6matttZdLgLs1jID8ldIavDEszFTraeWNElSw8YsJ/i19I6+YD P2xGkSpPjAGvHPYqxhyuGZx5epu1Csp4AqJ1gvERclH3MCO2jzpTAJwdu cKW1OH+8iBNN1cDY5pwInodgSVUjH1tBXzHjVq4YOIeEnrFvqqYE2y5Nm Oz21Kue/Nqq2wSSG1B1Qcd0LYWye5UiKXdRMVXvGvN3uJyl5N4VDpPc0l afOYOoAEFuqtYuVDzn+PeLDCKmZiSbL+6KT7572jXv7DISNVX4YF00Lzj cyg03DHHJIjdop3m/kSZV8UIXpBenMTY2UsoYxwwttCPwgY9kD3pm3lnJ w==; X-IronPort-AV: E=McAfee;i="6600,9927,10676"; a="343520456" X-IronPort-AV: E=Sophos;i="5.98,335,1673942400"; d="scan'208";a="343520456" Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Apr 2023 20:48:01 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10676"; a="777757104" X-IronPort-AV: E=Sophos;i="5.98,335,1673942400"; d="scan'208";a="777757104" Received: from linusliu-desk1.gar.corp.intel.com ([10.5.215.134]) by FMSMGA003.fm.intel.com with ESMTP; 10 Apr 2023 20:48:00 -0700 From: linus.liu@intel.com To: devel@edk2.groups.io Cc: Jiewen Yao Subject: [PATCH] Securitypkg/hddpassword: Update HddPasswordDxeInit to use Variable Policy Date: Mon, 10 Apr 2023 20:47:52 -0700 Message-Id: <20230411034753.1533-1-linus.liu@intel.com> X-Mailer: git-send-email 2.33.1.windows.1 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D4408 Change-Id: I3c4b466ef318766d6d70c9f73e36b94b5f10832c Cc: Jiewen Yao , Jian J Wang , Maggie Chu Signed-off-by: Linus Liu --- SecurityPkg/HddPassword/HddPasswordDxe.c | 16 +++++++++++----- SecurityPkg/HddPassword/HddPasswordDxe.h | 1 - SecurityPkg/HddPassword/HddPasswordDxe.inf | 3 ++- 3 files changed, 13 insertions(+), 7 deletions(-) diff --git a/SecurityPkg/HddPassword/HddPasswordDxe.c b/SecurityPkg/HddPass= word/HddPasswordDxe.c index a1a63b67a4..c20fdbe83f 100644 --- a/SecurityPkg/HddPassword/HddPasswordDxe.c +++ b/SecurityPkg/HddPassword/HddPasswordDxe.c @@ -9,6 +9,7 @@ **/=0D =0D #include "HddPasswordDxe.h"=0D +#include =0D =0D EFI_GUID mHddPasswordVendorGuid =3D HDD_PASSWORD_CONFIG_GUID;= =0D CHAR16 mHddPasswordVendorStorageName[] =3D L"HDD_PASSWORD_CONFIG";=0D @@ -2822,7 +2823,7 @@ HddPasswordDxeInit ( HDD_PASSWORD_DXE_PRIVATE_DATA *Private;=0D VOID *Registration;=0D EFI_EVENT EndOfDxeEvent;=0D - EDKII_VARIABLE_LOCK_PROTOCOL *VariableLock;=0D + EDKII_VARIABLE_POLICY_PROTOCOL *VariablePolicy;=0D =0D Private =3D NULL;=0D =0D @@ -2858,12 +2859,17 @@ HddPasswordDxeInit ( //=0D // Make HDD_PASSWORD_VARIABLE_NAME variable read-only.=0D //=0D - Status =3D gBS->LocateProtocol (&gEdkiiVariableLockProtocolGuid, NULL, (= VOID **)&VariableLock);=0D + Status =3D gBS->LocateProtocol (&gEdkiiVariablePolicyProtocolGuid, NULL,= (VOID **)&VariablePolicy);=0D if (!EFI_ERROR (Status)) {=0D - Status =3D VariableLock->RequestToLock (=0D - VariableLock,=0D + Status =3D RegisterBasicVariablePolicy (=0D + VariablePolicy,=0D + &mHddPasswordVendorGuid,=0D HDD_PASSWORD_VARIABLE_NAME,=0D - &mHddPasswordVendorGuid=0D + VARIABLE_POLICY_NO_MIN_SIZE,=0D + VARIABLE_POLICY_NO_MAX_SIZE,=0D + VARIABLE_POLICY_NO_MUST_ATTR,=0D + VARIABLE_POLICY_NO_CANT_ATTR,=0D + VARIABLE_POLICY_TYPE_LOCK_NOW=0D );=0D DEBUG ((DEBUG_INFO, "%a(): Lock %s variable (%r)\n", __FUNCTION__, HDD= _PASSWORD_VARIABLE_NAME, Status));=0D ASSERT_EFI_ERROR (Status);=0D diff --git a/SecurityPkg/HddPassword/HddPasswordDxe.h b/SecurityPkg/HddPass= word/HddPasswordDxe.h index 231533e737..049a208794 100644 --- a/SecurityPkg/HddPassword/HddPasswordDxe.h +++ b/SecurityPkg/HddPassword/HddPasswordDxe.h @@ -17,7 +17,6 @@ #include =0D #include =0D #include =0D -#include =0D =0D #include =0D #include =0D diff --git a/SecurityPkg/HddPassword/HddPasswordDxe.inf b/SecurityPkg/HddPa= ssword/HddPasswordDxe.inf index 06e8755ffc..2c0ebbcc78 100644 --- a/SecurityPkg/HddPassword/HddPasswordDxe.inf +++ b/SecurityPkg/HddPassword/HddPasswordDxe.inf @@ -50,6 +50,7 @@ PrintLib=0D UefiLib=0D LockBoxLib=0D + VariablePolicyHelperLib=0D S3BootScriptLib=0D PciLib=0D BaseCryptLib=0D @@ -63,7 +64,7 @@ gEfiHiiConfigAccessProtocolGuid ## PRODUCES=0D gEfiAtaPassThruProtocolGuid ## CONSUMES=0D gEfiPciIoProtocolGuid ## CONSUMES=0D - gEdkiiVariableLockProtocolGuid ## CONSUMES=0D + gEdkiiVariablePolicyProtocolGuid ## CONSUMES=0D =0D [Pcd]=0D gEfiSecurityPkgTokenSpaceGuid.PcdSkipHddPasswordPrompt ## CONSUMES=0D --=20 2.33.1.windows.1