public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Yao, Jiewen" <jiewen.yao@intel.com>
To: "Dong, Eric" <eric.dong@intel.com>,
	"edk2-devel@lists.01.org" <edk2-devel@lists.01.org>
Cc: "Tian, Feng" <feng.tian@intel.com>
Subject: Re: [Patch 2/2] SecurityPkg OpalPasswordDxe: Clean PSID buffer.
Date: Thu, 17 Nov 2016 08:45:48 +0000	[thread overview]
Message-ID: <74D8A39837DF1E4DA445A8C0B3885C50386D66B3@shsmsx102.ccr.corp.intel.com> (raw)
In-Reply-To: <1479276930-31360-3-git-send-email-eric.dong@intel.com>

Reviewed-by: Jiewen.yao@intel.com

> -----Original Message-----
> From: Dong, Eric
> Sent: Wednesday, November 16, 2016 2:16 PM
> To: edk2-devel@lists.01.org
> Cc: Tian, Feng <feng.tian@intel.com>; Yao, Jiewen <jiewen.yao@intel.com>
> Subject: [Patch 2/2] 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>
> 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



      reply	other threads:[~2016-11-17  8:45 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 ` [Patch 2/2] SecurityPkg OpalPasswordDxe: Clean PSID buffer Eric Dong
2016-11-17  8:45   ` Yao, Jiewen [this message]

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=74D8A39837DF1E4DA445A8C0B3885C50386D66B3@shsmsx102.ccr.corp.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