From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: intel.com, ip: 192.55.52.93, mailfrom: maggie.chu@intel.com) Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by groups.io with SMTP; Mon, 13 May 2019 02:18:20 -0700 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 13 May 2019 02:18:19 -0700 X-ExtLoop1: 1 Received: from chumaggi-mobl.gar.corp.intel.com ([10.5.245.173]) by fmsmga006.fm.intel.com with ESMTP; 13 May 2019 02:18:18 -0700 From: "Maggie Chu" To: devel@edk2.groups.io Cc: Eric Dong , Chao Zhang , Jiewen Yao Subject: [PATCH] SecurityPkg/OpalPassword: Add PCD to skip password prompt in device unlocked status Date: Mon, 13 May 2019 17:18:04 +0800 Message-Id: <20190513091804.14660-1-maggie.chu@intel.com> X-Mailer: git-send-email 2.14.2.windows.3 https://bugzilla.tianocore.org/show_bug.cgi?id=1801 Add a PCD for skipping password prompt. Previous change only support if storage device is in locked device. This change is added to support the case that security status of the storage device is unlocked. Signed-off-by: Maggie Chu Cc: Eric Dong Cc: Chao Zhang Cc: Jiewen Yao --- SecurityPkg/SecurityPkg.dec | 10 +++++----- SecurityPkg/Tcg/Opal/OpalPassword/OpalDriver.c | 16 ++++++++++++++-- SecurityPkg/Tcg/Opal/OpalPassword/OpalPasswordDxe.inf | 2 +- 3 files changed, 20 insertions(+), 8 deletions(-) diff --git a/SecurityPkg/SecurityPkg.dec b/SecurityPkg/SecurityPkg.dec index 3314f1854b..96db80c2d2 100644 --- a/SecurityPkg/SecurityPkg.dec +++ b/SecurityPkg/SecurityPkg.dec @@ -422,11 +422,11 @@ # @Prompt Possible TPM2 Interrupt Number buffer gEfiSecurityPkgTokenSpaceGuid.PcdTpm2PossibleIrqNumBuf|{0x00, 0x00, 0x00, 0x00}|VOID*|0x0001001D - ## Indicates if Opal DXE driver skip unlock device flow.

- # TRUE - Skip unlock device flow.
- # FALSE - Does not skip unlock device flow.
- # @Prompt Skip Opal DXE driver unlock device flow. - gEfiSecurityPkgTokenSpaceGuid.PcdSkipOpalDxeUnlock|FALSE|BOOLEAN|0x00010020 + ## Indicates if Opal DXE driver skip password prompt.

+ # TRUE - Skip password prompt.
+ # FALSE - Does not skip password prompt.
+ # @Prompt Skip Opal DXE driver password prompt. + gEfiSecurityPkgTokenSpaceGuid.PcdSkipOpalPasswordPrompt|FALSE|BOOLEAN|0x00010020 [PcdsDynamic, PcdsDynamicEx] diff --git a/SecurityPkg/Tcg/Opal/OpalPassword/OpalDriver.c b/SecurityPkg/Tcg/Opal/OpalPassword/OpalDriver.c index 965205c0b2..b0f9ca2215 100644 --- a/SecurityPkg/Tcg/Opal/OpalPassword/OpalDriver.c +++ b/SecurityPkg/Tcg/Opal/OpalPassword/OpalDriver.c @@ -899,8 +899,20 @@ OpalDriverRequestPassword ( IsLocked = OpalDeviceLocked (&Dev->OpalDisk.SupportedAttributes, &Dev->OpalDisk.LockingFeature); - if (IsLocked && PcdGetBool (PcdSkipOpalDxeUnlock)) { - return; + // + // Add PcdSkipOpalPasswordPrompt to determin whether to skip password prompt. + // Due to board design, device may not power off during system warm boot, which result in + // security status remain unlocked status, hence we add device security status check here. + // + // If device is in the locked status, device keeps locked and system continues booting. + // If device is in the unlocked status, system is forced shutdown to support security requirement. + // + if (PcdGetBool (PcdSkipOpalPasswordPrompt)) { + if (IsLocked) { + return; + } else { + gRT->ResetSystem (EfiResetShutdown, EFI_SUCCESS, 0, NULL); + } } while (Count < MAX_PASSWORD_TRY_COUNT) { diff --git a/SecurityPkg/Tcg/Opal/OpalPassword/OpalPasswordDxe.inf b/SecurityPkg/Tcg/Opal/OpalPassword/OpalPasswordDxe.inf index e74f147aaa..87519198c0 100644 --- a/SecurityPkg/Tcg/Opal/OpalPassword/OpalPasswordDxe.inf +++ b/SecurityPkg/Tcg/Opal/OpalPassword/OpalPasswordDxe.inf @@ -71,7 +71,7 @@ gS3StorageDeviceInitListGuid ## SOMETIMES_PRODUCES ## UNDEFINED [Pcd] - gEfiSecurityPkgTokenSpaceGuid.PcdSkipOpalDxeUnlock ## CONSUMES + gEfiSecurityPkgTokenSpaceGuid.PcdSkipOpalPasswordPrompt ## CONSUMES [Depex] gEfiHiiStringProtocolGuid AND gEfiHiiDatabaseProtocolGuid -- 2.16.2.windows.1