From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 527C381F1B for ; Thu, 17 Nov 2016 00:45:48 -0800 (PST) Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga104.jf.intel.com with ESMTP; 17 Nov 2016 00:45:53 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.31,504,1473145200"; d="scan'208";a="32354988" Received: from fmsmsx108.amr.corp.intel.com ([10.18.124.206]) by fmsmga005.fm.intel.com with ESMTP; 17 Nov 2016 00:45:50 -0800 Received: from FMSMSX110.amr.corp.intel.com (10.18.116.10) by FMSMSX108.amr.corp.intel.com (10.18.124.206) with Microsoft SMTP Server (TLS) id 14.3.248.2; Thu, 17 Nov 2016 00:45:50 -0800 Received: from shsmsx152.ccr.corp.intel.com (10.239.6.52) by fmsmsx110.amr.corp.intel.com (10.18.116.10) with Microsoft SMTP Server (TLS) id 14.3.248.2; Thu, 17 Nov 2016 00:45:50 -0800 Received: from shsmsx102.ccr.corp.intel.com ([169.254.2.239]) by SHSMSX152.ccr.corp.intel.com ([169.254.6.138]) with mapi id 14.03.0248.002; Thu, 17 Nov 2016 16:45:48 +0800 From: "Yao, Jiewen" To: "Dong, Eric" , "edk2-devel@lists.01.org" CC: "Tian, Feng" Thread-Topic: [Patch 2/2] SecurityPkg OpalPasswordDxe: Clean PSID buffer. Thread-Index: AQHSP9D9WphFezvmIU2C1hBNNLlVR6Dc3krQ Date: Thu, 17 Nov 2016 08:45:48 +0000 Message-ID: <74D8A39837DF1E4DA445A8C0B3885C50386D66B3@shsmsx102.ccr.corp.intel.com> References: <1479276930-31360-1-git-send-email-eric.dong@intel.com> <1479276930-31360-3-git-send-email-eric.dong@intel.com> In-Reply-To: <1479276930-31360-3-git-send-email-eric.dong@intel.com> Accept-Language: zh-CN, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Subject: Re: [Patch 2/2] SecurityPkg OpalPasswordDxe: Clean PSID buffer. X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 17 Nov 2016 08:45:48 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable 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 ; Yao, Jiewen > Subject: [Patch 2/2] SecurityPkg OpalPasswordDxe: Clean PSID buffer. >=20 > Change callback handler type to avoid saving PSID info in > browser temp buffer. Also clean the buffer after using it. >=20 > Cc: Feng Tian > Cc: Jiewen Yao > Contributed-under: TianoCore Contribution Agreement 1.0 > Signed-off-by: Eric Dong > --- > SecurityPkg/Tcg/Opal/OpalPasswordDxe/OpalHii.c | 23 > +++++++++++++--------- > .../Tcg/Opal/OpalPasswordDxe/OpalHiiPrivate.h | 4 +++- > 2 files changed, 17 insertions(+), 10 deletions(-) >=20 > 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( >=20 > case HII_KEY_ID_ENTER_PASSWORD: > return HiiPasswordEntered(Value->string); > + > + case HII_KEY_ID_ENTER_PSID: > + return HiiPsidRevert(Value->string); > + > } > } else if (Action =3D=3D EFI_BROWSER_ACTION_CHANGED) { > switch (HiiKeyId) { > - case HII_KEY_ID_ENTER_PSID: > - HiiPsidRevert(); > - *ActionRequest =3D > 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. >=20 > + @param PsidStringId The string id for the PSID info. > + > @retval EFI_SUCCESS Do the required action success. >=20 > **/ > 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]; >=20 > Ret =3D TcgResultFailure; >=20 > - OpalHiiGetBrowserData(); > - > + UnicodeStr =3D 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); >=20 > OpalDisk =3D HiiGetOpalDiskCB (gHiiConfiguration.SelectedDiskIndex); > if (OpalDisk !=3D 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. >=20 > + @param PsidStringId The string id for the PSID info. > + > @retval EFI_SUCCESS Do the required action success. >=20 > **/ > EFI_STATUS > HiiPsidRevert( > - VOID > + EFI_STRING_ID PsidStringId > ); >=20 > /** > -- > 2.6.4.windows.1