From: Eric Dong <eric.dong@intel.com>
To: edk2-devel@lists.01.org
Cc: Feng Tian <feng.tian@intel.com>, Jiewen Yao <jiewen.yao@intel.com>
Subject: [Patch 2/2] SecurityPkg OpalPasswordDxe: Clean PSID buffer.
Date: Wed, 16 Nov 2016 14:15:30 +0800 [thread overview]
Message-ID: <1479276930-31360-3-git-send-email-eric.dong@intel.com> (raw)
In-Reply-To: <1479276930-31360-1-git-send-email-eric.dong@intel.com>
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>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Eric Dong <eric.dong@intel.com>
---
SecurityPkg/Tcg/Opal/OpalPasswordDxe/OpalHii.c | 23 +++++++++++++---------
.../Tcg/Opal/OpalPasswordDxe/OpalHiiPrivate.h | 4 +++-
2 files changed, 17 insertions(+), 10 deletions(-)
diff --git a/SecurityPkg/Tcg/Opal/OpalPasswordDxe/OpalHii.c b/SecurityPkg/Tcg/Opal/OpalPasswordDxe/OpalHii.c
index 5937ce2..7371b7e 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 a7709dd..ec5a93c 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
);
/**
--
2.6.4.windows.1
next prev parent reply other threads:[~2016-11-16 6:16 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-11-16 6:15 [Patch 0/2] Clean the temp buffer after using it Eric Dong
2016-11-16 6:15 ` [Patch 1/2] SecurityPkg OpalPasswordDxe: Clean password buffer Eric Dong
2016-11-17 8:46 ` Yao, Jiewen
2016-11-16 6:15 ` Eric Dong [this message]
2016-11-17 8:45 ` [Patch 2/2] SecurityPkg OpalPasswordDxe: Clean PSID buffer Yao, Jiewen
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=1479276930-31360-3-git-send-email-eric.dong@intel.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