summaryrefslogtreecommitdiffstats
path: root/SecurityPkg/Tcg/Opal
diff options
context:
space:
mode:
authorEric Dong <eric.dong@intel.com>2016-11-21 14:38:31 +0800
committerStar Zeng <star.zeng@intel.com>2016-11-21 15:37:57 +0800
commit01dd077315c6759c94af9af4232f8318db13cf8d (patch)
tree4a7772b0ce38adf9038f593706dd817e4c720c5e /SecurityPkg/Tcg/Opal
parentbee13c00218f3ed3118d8d87683c11b31ca04564 (diff)
downloadedk2-01dd077315c6759c94af9af4232f8318db13cf8d.tar.gz
edk2-01dd077315c6759c94af9af4232f8318db13cf8d.tar.bz2
edk2-01dd077315c6759c94af9af4232f8318db13cf8d.zip
SecurityPkg OpalPasswordDxe: Clean PSID buffer.
Change callback handler type to avoid saving PSID info in browser temp buffer. Also clean the buffer after using it. Cc: Feng Tian <feng.tian@intel.com> Reviewed-by: Jiewen Yao <jiewen.yao@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Eric Dong <eric.dong@intel.com>
Diffstat (limited to 'SecurityPkg/Tcg/Opal')
-rw-r--r--SecurityPkg/Tcg/Opal/OpalPasswordDxe/OpalHii.c23
-rw-r--r--SecurityPkg/Tcg/Opal/OpalPasswordDxe/OpalHiiPrivate.h4
2 files changed, 17 insertions, 10 deletions
diff --git a/SecurityPkg/Tcg/Opal/OpalPasswordDxe/OpalHii.c b/SecurityPkg/Tcg/Opal/OpalPasswordDxe/OpalHii.c
index 5937ce2613..7371b7e892 100644
--- a/SecurityPkg/Tcg/Opal/OpalPasswordDxe/OpalHii.c
+++ b/SecurityPkg/Tcg/Opal/OpalPasswordDxe/OpalHii.c
@@ -501,14 +501,13 @@ DriverCallback(
case HII_KEY_ID_ENTER_PASSWORD:
return HiiPasswordEntered(Value->string);
+
+ case HII_KEY_ID_ENTER_PSID:
+ return HiiPsidRevert(Value->string);
+
}
} else if (Action == EFI_BROWSER_ACTION_CHANGED) {
switch (HiiKeyId) {
- case HII_KEY_ID_ENTER_PSID:
- HiiPsidRevert();
- *ActionRequest = EFI_BROWSER_ACTION_REQUEST_FORM_APPLY;
- return EFI_SUCCESS;
-
case HII_KEY_ID_BLOCKSID:
switch (Value->u8) {
case 0:
@@ -661,12 +660,14 @@ HiiPopulateDiskInfoForm(
/**
Reverts the Opal disk to factory default.
+ @param PsidStringId The string id for the PSID info.
+
@retval EFI_SUCCESS Do the required action success.
**/
EFI_STATUS
HiiPsidRevert(
- VOID
+ EFI_STRING_ID PsidStringId
)
{
CHAR8 Response[DEFAULT_RESPONSE_SIZE];
@@ -674,15 +675,19 @@ HiiPsidRevert(
OPAL_DISK *OpalDisk;
TCG_RESULT Ret;
OPAL_SESSION Session;
+ CHAR16 *UnicodeStr;
UINT8 TmpBuf[PSID_CHARACTER_STRING_END_LENGTH];
Ret = TcgResultFailure;
- OpalHiiGetBrowserData();
-
+ UnicodeStr = HiiGetString (gHiiPackageListHandle, PsidStringId, NULL);
ZeroMem (TmpBuf, sizeof (TmpBuf));
- UnicodeStrToAsciiStrS (gHiiConfiguration.Psid, (CHAR8*)TmpBuf, PSID_CHARACTER_STRING_END_LENGTH);
+ UnicodeStrToAsciiStrS (UnicodeStr, (CHAR8*)TmpBuf, PSID_CHARACTER_STRING_END_LENGTH);
CopyMem (Psid.Psid, TmpBuf, PSID_CHARACTER_LENGTH);
+ HiiSetString (gHiiPackageListHandle, PsidStringId, L"", NULL);
+ ZeroMem (TmpBuf, sizeof (TmpBuf));
+ ZeroMem (UnicodeStr, StrSize (UnicodeStr));
+ FreePool (UnicodeStr);
OpalDisk = HiiGetOpalDiskCB (gHiiConfiguration.SelectedDiskIndex);
if (OpalDisk != NULL) {
diff --git a/SecurityPkg/Tcg/Opal/OpalPasswordDxe/OpalHiiPrivate.h b/SecurityPkg/Tcg/Opal/OpalPasswordDxe/OpalHiiPrivate.h
index a7709dd63d..ec5a93cf3f 100644
--- a/SecurityPkg/Tcg/Opal/OpalPasswordDxe/OpalHiiPrivate.h
+++ b/SecurityPkg/Tcg/Opal/OpalPasswordDxe/OpalHiiPrivate.h
@@ -225,12 +225,14 @@ HiiSetBlockSidAction (
/**
Reverts the Opal disk to factory default.
+ @param PsidStringId The string id for the PSID info.
+
@retval EFI_SUCCESS Do the required action success.
**/
EFI_STATUS
HiiPsidRevert(
- VOID
+ EFI_STRING_ID PsidStringId
);
/**