From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by spool.mail.gandi.net (Postfix) with ESMTPS id 41098AC1289 for ; Tue, 25 Jul 2023 12:17:53 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=sNCM17CDZO0uEoVt1WfDWm3qSrEefOwilEBri7VcUl8=; c=relaxed/simple; d=groups.io; h=X-Received:X-Received:X-IronPort-AV:X-IronPort-AV:X-Received:X-ExtLoop1:X-IronPort-AV:X-Received:X-Received:X-Received:X-Received:X-Received:ARC-Seal:ARC-Message-Signature:ARC-Authentication-Results:X-Received:X-Received:From:To:Subject:Thread-Topic:Thread-Index:Date:Message-ID:References:In-Reply-To:Accept-Language:X-MS-Has-Attach:X-MS-TNEF-Correlator:msip_labels:x-ms-publictraffictype:x-ms-traffictypediagnostic:x-ms-office365-filtering-correlation-id:x-ld-processed:x-ms-exchange-senderadcheck:x-ms-exchange-antispam-relay:x-microsoft-antispam-message-info:x-ms-exchange-antispam-messagedata-chunkcount:x-ms-exchange-antispam-messagedata-0:MIME-Version:X-MS-Exchange-CrossTenant-AuthAs:X-MS-Exchange-CrossTenant-AuthSource:X-MS-Exchange-CrossTenant-Network-Message-Id:X-MS-Exchange-CrossTenant-originalarrivaltime:X-MS-Exchange-CrossTenant-fromentityheader:X-MS-Exchange-CrossTenant-id:X-MS-Exchange-CrossTenant-mailboxtype:X-MS-Exchange-CrossTenant-userprincipalname:X-MS-Exchange-Transpo rt-CrossTenantHeadersStamped:X-OriginatorOrg:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:X-Gm-Message-State:Content-Language:Content-Type; s=20140610; t=1690287471; v=1; b=MLMvAxxqsDKR50pRw3S+6m6lTWY7h7JxTkL0h47LlGIHfreOjSVE0Vw0oGaFp0GvbsD9C2rv o+l+7i5m3zob106TURw5P8y6rNXz/hXvig/ibg4lTPuE1fqA8nTVLhgAhQUM6+PB6McUguHfVr0 kMdzoxeZ6jhQu+V0VelkWAKQ= X-Received: by 127.0.0.2 with SMTP id 6J0sYY7687511xTu4JJ4jXSC; Tue, 25 Jul 2023 05:17:51 -0700 X-Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by mx.groups.io with SMTP id smtpd.web10.18752.1690287470764071983 for ; Tue, 25 Jul 2023 05:17:51 -0700 X-IronPort-AV: E=McAfee;i="6600,9927,10781"; a="365164750" X-IronPort-AV: E=Sophos;i="6.01,230,1684825200"; d="scan'208,217";a="365164750" X-Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Jul 2023 05:17:33 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.01,202,1684825200"; d="scan'208,217";a="869445507" X-Received: from fmsmsx601.amr.corp.intel.com ([10.18.126.81]) by fmsmga001.fm.intel.com with ESMTP; 25 Jul 2023 05:17:35 -0700 X-Received: from fmsmsx611.amr.corp.intel.com (10.18.126.91) by fmsmsx601.amr.corp.intel.com (10.18.126.81) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.27; Tue, 25 Jul 2023 05:17:33 -0700 X-Received: from fmsmsx603.amr.corp.intel.com (10.18.126.83) by fmsmsx611.amr.corp.intel.com (10.18.126.91) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.27; Tue, 25 Jul 2023 05:17:33 -0700 X-Received: from fmsedg601.ED.cps.intel.com (10.1.192.135) by fmsmsx603.amr.corp.intel.com (10.18.126.83) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.27 via Frontend Transport; Tue, 25 Jul 2023 05:17:33 -0700 X-Received: from NAM11-DM6-obe.outbound.protection.outlook.com (104.47.57.172) by edgegateway.intel.com (192.55.55.70) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.27; Tue, 25 Jul 2023 05:17:32 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=AvH48kGqi8K+ydfreDPs9ddGP+TgIDw7GByKcsZwIaFYW3U2UtWrwNU0lvqwcAM7OVoEcfr5wojJxJFNQKIou0UMXGhguFudjoELExpt5PsCaknfFwthO4BHIA+rMCJ2r42A41TQ0IANj4KtPiDsWfSLmUbfNin83j6uxlqsOMJzlTg2c/w5GqoqdXBOj0Tv20DjQZUoJuvr0tUpwuvEAJHu1CwqIw6KDj7BIMRAAGQWUhnArU28dsPEeyUKUQT9SHkivVcNv0sxJUY3DaFU+8GRYjzvFn+SwPBoEq6xOoq1e8Zfll1lNsamKYK5ePTBjIHpyH9Cje2ovsd5zkt6jQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=dQFDVSMtsqNCexRpgoyj0k7IfgA6PIRS9cnV/j1UxaE=; b=N8daYeyBzPKU1OrQjQL+ar3KP1WZxHHvEnlr+FjHbXFDcWg1HwJM/azsv7YSd8mOTJmqeggHOhrM9gdRUYsPhSXpiBeEn7Mf91ZPrLeQz4pfhCo4EK2TQ9onD5r7dfAJ8f/4W4aXHQKk1PkkX58wrUTpRkMmdSXm8tY8AIeZeYFhKcrKBqoQkD8SbtpRVYxRWEXu44XZ5+XAuyNEPK0F3VGNSY9xDlx6Dy9GAfWmDQz/PoB3zVWxLt2+pd5BMfqgi/mkkqHkKdftXMZa7fNTOuMvdOUwJzs21LrQFzdp5hOpwsKGvW7tVJg5CRzrZctWC8U+GqEKOALA+dt+defiAA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none X-Received: from MW4PR11MB5872.namprd11.prod.outlook.com (2603:10b6:303:169::14) by SA3PR11MB8120.namprd11.prod.outlook.com (2603:10b6:806:2f3::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6609.31; Tue, 25 Jul 2023 12:17:30 +0000 X-Received: from MW4PR11MB5872.namprd11.prod.outlook.com ([fe80::8557:2ebb:bf92:1be8]) by MW4PR11MB5872.namprd11.prod.outlook.com ([fe80::8557:2ebb:bf92:1be8%6]) with mapi id 15.20.6609.032; Tue, 25 Jul 2023 12:17:30 +0000 From: "Yao, Jiewen" To: "Poosapalli, Karunakar" , "Gao, Liming" , "devel@edk2.groups.io" Subject: Re: [edk2-devel] [PATCH] SecurityPkg: DxeTcg2PhysicalPresenceLib for Clear Graphics Screen To unblock and Display TPM messages Thread-Topic: [edk2-devel] [PATCH] SecurityPkg: DxeTcg2PhysicalPresenceLib for Clear Graphics Screen To unblock and Display TPM messages Thread-Index: Adm8DJurGgUFmZ0XSiuVHtzYqmi7VgCNo1NgACuqkgA= Date: Tue, 25 Jul 2023 12:17:30 +0000 Message-ID: References: In-Reply-To: Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: msip_labels: MSIP_Label_73dd1fcc-24d7-4f55-9dc2-c1518f171327_Enabled=true; MSIP_Label_73dd1fcc-24d7-4f55-9dc2-c1518f171327_SetDate=2023-07-24T15:26:21Z; MSIP_Label_73dd1fcc-24d7-4f55-9dc2-c1518f171327_Method=Standard; MSIP_Label_73dd1fcc-24d7-4f55-9dc2-c1518f171327_Name=No Protection (Label Only) - Internal Use; MSIP_Label_73dd1fcc-24d7-4f55-9dc2-c1518f171327_SiteId=945c199a-83a2-4e80-9f8c-5a91be5752dd; MSIP_Label_73dd1fcc-24d7-4f55-9dc2-c1518f171327_ActionId=71210890-7005-4d3f-96bc-c67ef8eb8258; MSIP_Label_73dd1fcc-24d7-4f55-9dc2-c1518f171327_ContentBits=2 x-ms-publictraffictype: Email x-ms-traffictypediagnostic: MW4PR11MB5872:EE_|SA3PR11MB8120:EE_ x-ms-office365-filtering-correlation-id: 008f0310-4e64-4e00-ed3c-08db8d091e3e x-ld-processed: 46c98d88-e344-4ed4-8496-4ed7712e255d,ExtAddr x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam-message-info: RB1rDv85fezoqEtXRUnvcb3EypSdfWFL2HaZQFGOfuUsFKgZQRMzb3gYTjMKr/jB/ZonksIcLD4z+rYXGcBXz8XhXJVqabLUOUk2VdfBf8Tt6kTKfOSKZWYLcE4AmaC3CUhR7CltAoYWboQYkGexxh5SeinGjQE2vxoJ2pmkH/wzhmgr9RmRY949b0DMke4yQTzOq3TQw5ijclWXFysWmV6T7H3lPErYNfI0JA8UUmqqxifkErx0pY1pRzLllzepTgcPI/fp1ScdnmxxxeILZ6IqxqzQgWxNvnd0/ssz7jZZmGm05UK6NUslxqOPgYeOawEVEfd9bWA1URvly6sUMj3NMqWn83RhxPnJitzt4lFDs2ClghnuOc3ohAtxBhIQw0a8nF03XaKiE2kBoxc6b+ScftXJGSiBwBu/LI34Q4Zq0ETalyst/iVYdBS0KpegA55chfA95ibzgVCrwSW7vuUrgQm5lfObgafoxLeTzvjxNVURZ5ptnWgs8ix40As3F7JLkEcnja9/El/2Rc3NVKG/TS08+nYcQnNWoAL7Hb4AptN743Qjr6d/7HN8eRte3d4ufZPp6aQ/Qr0VgazRaFQntl93lHFlkULyZBGarso= x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?hxfYGzWXXgTydaytNOp+niVrIiydBhv6eRCpP6wCDq8kRoRvMAhJa/gQvhbi?= =?us-ascii?Q?Tlblh19sCwv1kwQs/vQI2whaLwuxBQjPhPA9Ae9GFd8Pfc16a8YVg4Sal2v1?= =?us-ascii?Q?n/z3Z4n2Dv3tv1kpPnENTDoIu972GmiBhl6hjE629lByW1yWcHbs9RwlrCd9?= =?us-ascii?Q?OoIJKNyg0qNPuTXbTBbGqz0qrXpYbPSD77vX2b9uMCcR/8+LqkZ0sUQ7vbou?= =?us-ascii?Q?c5UIuq/VKlWknqbSKmY7UXpbMC9Qyzb+73Uv9L6giU1B3UkWP2wp6dY7gzMK?= =?us-ascii?Q?BYdJAHIrHy5V0F6ayuqv/G+k6TboVx9XOgafPU3EcSGjgGW9SYAluIuDbpZb?= =?us-ascii?Q?1YDFCLmrHK/Rv0S5H46WcM5vxv7io4IJmajMD5Dg/xT9zr/c3PrwrVg8S+na?= =?us-ascii?Q?8MpEWATz97csgLpb2c8B/DOM3T7ipom5I560KcVDyF+D+RT9+wZLDV97gfXF?= =?us-ascii?Q?yFk35cc9ONcLcYmi+A+9JAOG5n8iDUX2eLzJcYK7I0ps32z8xHgDHuaG7JHa?= =?us-ascii?Q?ng4fs+E5i1/sVSurveRFzRlRLHucF4fDV2sfvrN9ep6vXPM87x6g6tdJGpQD?= =?us-ascii?Q?3J1yhMJkUTbnJJUwgrOxeTLZpAAKge3Ix+yQGCILMkkT7t3fNvvSaKNx2TRx?= =?us-ascii?Q?6ZVy1zcGQr20qxZfaAZCGLqP35kRIfV7PzvtZZe7DwIh9mehHEllOYTMLxsd?= =?us-ascii?Q?t+jGYdFW0hA5Carhhf3ma1YQsU9lRxHuyUjBJyoss/F3a7iGF8oTFyRziH1Q?= =?us-ascii?Q?2y2kUPC/VZ2PGcRkfHIvslgQbI1hc0TSPalZXFKmTq/xVtgBoqR6uCiqvPEQ?= =?us-ascii?Q?mDXnZcIDQvSEjD+ydd2Lf4911FoGYQv0AKQLY25EgaDsOJfKbylmYPcvh1b8?= =?us-ascii?Q?3JkzBzJ25Daa99gntrm2m2eE8AjGbLa5CwbUR6WM0W5cZ+rK9KQGSJNb6EqP?= =?us-ascii?Q?F4IkCvRbx+0DjmaPxBbLE+mmcfizSpGhfX0oswHsNs7EWpV2iOGtJlr1bEF9?= =?us-ascii?Q?sNeUte5D3lL/Rih4pyLCwVr/Z4LuGhOrRqiLaO9AIUGcl+CL66A5lrOtIFX5?= =?us-ascii?Q?Osuycs+OJE+xVTJIH5vhH+cn08WDFYdUPBtYRvMkrYfrVJnO7mSECoFOo9uX?= =?us-ascii?Q?QExwaD2hNxuGKiYUt4tbC3ZReG6lW3b9DpmpYPRUflT0SDW506EIaWfGROau?= =?us-ascii?Q?P4jJe2jfzMsekJq5HeCqVhmfWC2FOVwYzproEK+aLUC55tnoFyCgRwOsAEmz?= =?us-ascii?Q?x+JJZh/kNWNsFUMYaxQdd211/hTi2woL9/DkqUyqAzCxEQTMMJDDRmFdhdPM?= =?us-ascii?Q?UCIb90jyOA2O0cmoeS75ft0owwJJVTOSDfhAaxAQ2nAUtRAGGdcr0kL8VOTH?= =?us-ascii?Q?O8PpKAip3FLs0NziWz/9SL8XaFnT1RfPDbbXdAGpqful93+RHst+G5aVZvW5?= =?us-ascii?Q?K/ZZbyTAJAalUOq37iECix8Q/5xJ/80VSqx1deo+VSti8WIpYpIu9X/ZpVoQ?= =?us-ascii?Q?MuM+jg2zzdx+aKEokEYs0ZveqZqwvpsI8zjg6mHS9karkhhVI3gIHqWsKVCm?= =?us-ascii?Q?9pcgdZcp0bnKzqGItbQFDu70W+foDrWrmCcf4Wc4?= MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: MW4PR11MB5872.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 008f0310-4e64-4e00-ed3c-08db8d091e3e X-MS-Exchange-CrossTenant-originalarrivaltime: 25 Jul 2023 12:17:30.4546 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: Pv8kzddsAO0T+jgHJ5AzFwCCuX7z6zCr0kxjuCoF9FpYxYfOCRF0xB7j9Q5bUD8ygFZMA1p8gbekse+gKxWLTw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA3PR11MB8120 X-OriginatorOrg: intel.com Precedence: Bulk List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,jiewen.yao@intel.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: WrhCpEUpka3rvtCKy5XhoaIsx7686176AA= Content-Language: en-US Content-Type: multipart/alternative; boundary="_000_MW4PR11MB5872F29F4E3F6DDAB04595088C03AMW4PR11MB5872namp_" X-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20140610 header.b=MLMvAxxq; arc=reject ("signature check failed: fail, {[1] = sig:microsoft.com:reject}"); dmarc=fail reason="SPF not aligned (relaxed), DKIM not aligned (relaxed)" header.from=intel.com (policy=none); spf=pass (spool.mail.gandi.net: domain of bounce@groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce@groups.io --_000_MW4PR11MB5872F29F4E3F6DDAB04595088C03AMW4PR11MB5872namp_ Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Hello I agree with you on the problem statement. But I don't think this is a desired solution. We expect Platform BDS to call the PhysicalPresenceLib. As such, why not cl= ear the screen in the platform BDS? Thank you Yao, Jiewen From: Poosapalli, Karunakar Sent: Monday, July 24, 2023 11:26 PM To: Yao, Jiewen ; Gao, Liming ; devel@edk2.groups.io Subject: RE: [edk2-devel] [PATCH] SecurityPkg: DxeTcg2PhysicalPresenceLib f= or Clear Graphics Screen To unblock and Display TPM messages Can you please review and share your feedback? Thanks & Regards Karunakar Poosapalli Firmware Principal Engineer, Client BIOS Customer BIOS | Dell Core BIOS CPG Software Engineering | Dell Technologies Mobile +91 9951902957 Karunakar_poosapalli@Dell.Com Internal Use - Confidential From: Poosapalli, Karunakar Sent: Saturday, July 22, 2023 1:21 AM To: jiewen.yao@intel.com; gaoliming; devel@edk= 2.groups.io Subject: [edk2-devel] [PATCH] SecurityPkg: DxeTcg2PhysicalPresenceLib for C= lear Graphics Screen To unblock and Display TPM messages Patch review for Bugzilla - https://bugzilla.tianocore.org/show_bug.cgi?id= =3D4462 >From c537f9c5c9e02c54e27466b96fe33555afccd358 Mon Sep 17 00:00:00 2001 From: Karunakar Poosapalli karunakar_poosapalli@dell.com Date: Sat, 22 Jul 2023 01:13:44 +0530 Subject: [PATCH] Patch - Enhance Tcg2 to clear graphics before printing the messages on screen [Background] Tcg2UserConfirm() Function is used to display any user conformation message= s on the console Function Definition Full path - SecurityPkg\Library\DxeTcg2PhysicalPresence= Lib\DxeTcg2PhysicalPresenceLib.c [Issue] In the current Tcg2UserConfirm() implementation, This function forms a dest= ination string to be displayed on the console and directly Print the messag= e on Console. But there is no logic added to clear the graphics before printing the messa= ges on the screen. There are some scenarios where Tcg messages might have been blocked by some= other GUI or messages on Console. 1. When there are some messages or logos already displayed in the content= on the console, TCG message will NOT be displayed or corrupted to the End user. 2. There could be a Custom logo displaying on the screen which actually b= locks the screen. [Solution] 1. As TCG user confirmation is the highest priority and it blocks the POS= T until the user presses the input key. Before TCG messages Print on the console, there= should be logic added to clear the graphics screen Cc: gaoliming gaoliming@byosoft.com.cn Cc: Jiewen Jiewen.yao@intel.com REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D4462 Signed-off-by: Karunakar Poosapalli karunakar_poosapalli@dell.com --- .../DxeTcg2PhysicalPresenceLib.c | 74 +++++++++++++++++++ .../DxeTcg2PhysicalPresenceLib.inf | 1 + 2 files changed, 75 insertions(+) diff --git a/SecurityPkg/Library/DxeTcg2PhysicalPresenceLib/DxeTcg2Physical= PresenceLib.c b/SecurityPkg/Library/DxeTcg2PhysicalPresenceLib/DxeTcg2Physi= calPresenceLib.c index de4f5e583d..bd486f3b5b 100644 --- a/SecurityPkg/Library/DxeTcg2PhysicalPresenceLib/DxeTcg2PhysicalPresenc= eLib.c +++ b/SecurityPkg/Library/DxeTcg2PhysicalPresenceLib/DxeTcg2PhysicalPresenc= eLib.c @@ -251,6 +251,74 @@ Tcg2ExecutePhysicalPresence ( } } +/** + Clear Graphics Screen To unblock and Display TPM messages + + @param[in] VOID + @retval EFI_STATUS +**/ +EFI_STATUS +ClearGraphicsScreenToDisplayTpmMessages() +{ + EFI_GRAPHICS_OUTPUT_PROTOCOL *Gop; + EFI_STATUS Status; + EFI_HANDLE *HandleBuffer; + UINTN NumberOfHandles; + UINTN Index; + EFI_DEVICE_PATH_PROTOCOL *GopDevicePath; + + DEBUG((DEBUG_INFO, "ClearGraphicsScreenToDisplayTpmMessages Entry...\n")= ); + + Status =3D gBS->LocateHandleBuffer ( + ByProtocol, + &gEfiGraphicsOutputProtocolGuid, + NULL, + &NumberOfHandles, + &HandleBuffer + ); + DEBUG((DEBUG_INFO, "LocateHandleBuffer Status =3D %r, NumberOfHandles = =3D %x\n", Status, NumberOfHandles)); + + if (EFI_ERROR (Status)) + { + return Status; + } + + for (Index =3D 0; Index < NumberOfHandles; Index++) + { + Status =3D gBS->HandleProtocol ( + HandleBuffer[Index], + &gEfiDevicePathProtocolGuid, + (VOID *)&GopDevicePath + ); + DEBUG((DEBUG_INFO, "HandleProtocol GopDevicePath Status =3D %r, Inde= x =3D %x\n", Status, Index)); + if (EFI_ERROR (Status)) + { + continue; + } + + Status =3D gBS->HandleProtocol ( + HandleBuffer[Index], + &gEfiGraphicsOutputProtocolGuid, + (VOID **) &Gop + ); + DEBUG((DEBUG_INFO, "HandleProtocol Gop Status =3D %r, Index =3D %x\n= ", Status, Index)); + if (EFI_ERROR(Status)) + { + continue; + } + + // Clear the graphics screen to black + Status =3D Gop->Blt(Gop, NULL, EfiBltVideoFill, 0, 0, 0, 0, Gop->Mod= e->Info->HorizontalResolution, Gop->Mode->Info->VerticalResolution, 0); + DEBUG((DEBUG_INFO, "Gop->Blt Status =3D %r, Index =3D %x\n", Status,= Index)); + if (EFI_ERROR(Status)) { + continue; + } + } + + gBS->FreePool (HandleBuffer); + DEBUG((DEBUG_INFO, "ClearGraphicsScreenToDisplayTpmMessages Exit...\n"))= ; + return Status; +} /** Read the specified key for user confirmation. @@ -576,6 +644,12 @@ Tcg2UserConfirm ( BufSize -=3D StrSize (ConfirmText); UnicodeSPrint (ConfirmText + StrLen (ConfirmText), BufSize, TmpStr1, Tmp= Str2); + // + //Clear Graphics Screen To unblock and Display TPM messages + // + Status =3D ClearGraphicsScreenToDisplayTpmMessages(); + DEBUG((DEBUG_INFO, "ClearGraphicsScreenToDisplayTpmMessages Status =3D %= r\n", Status)); + DstStr[80] =3D L'\0'; for (Index =3D 0; Index < StrLen (ConfirmText); Index +=3D 80) { StrnCpyS (DstStr, sizeof (DstStr) / sizeof (CHAR16), ConfirmText + Ind= ex, sizeof (DstStr) / sizeof (CHAR16) - 1); diff --git a/SecurityPkg/Library/DxeTcg2PhysicalPresenceLib/DxeTcg2Physical= PresenceLib.inf b/SecurityPkg/Library/DxeTcg2PhysicalPresenceLib/DxeTcg2Phy= sicalPresenceLib.inf index e1c7c20d52..de423cfd13 100644 --- a/SecurityPkg/Library/DxeTcg2PhysicalPresenceLib/DxeTcg2PhysicalPresenc= eLib.inf +++ b/SecurityPkg/Library/DxeTcg2PhysicalPresenceLib/DxeTcg2PhysicalPresenc= eLib.inf @@ -54,6 +54,7 @@ [Protocols] gEfiTcg2ProtocolGuid ## SOMETIMES_CONSUMES gEdkiiVariableLockProtocolGuid ## SOMETIMES_CONSUMES + gEfiGraphicsOutputProtocolGuid ## CONSUMES [Pcd] gEfiSecurityPkgTokenSpaceGuid.PcdTcg2PhysicalPresenceFlags ## SOME= TIMES_CONSUMES -- 2.17.0.windows.1 Internal Use - Confidential -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#107244): https://edk2.groups.io/g/devel/message/107244 Mute This Topic: https://groups.io/mt/100333271/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- --_000_MW4PR11MB5872F29F4E3F6DDAB04595088C03AMW4PR11MB5872namp_ Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: quoted-printable

Hello

I agree with you on the problem statement.

 

But I don’t think this is a desired solution.<= o:p>

We expect Platform BDS to call the PhysicalPresenceL= ib. As such, why not clear the  screen in the platform BDS?=

 

Thank you

Yao, Jiewen

 

From: Poosapalli, Karunakar <KarunakarPoos= apalli@Dell.com>
Sent: Monday, July 24, 2023 11:26 PM
To: Yao, Jiewen <jiewen.yao@intel.com>; Gao, Liming <gaolim= ing@byosoft.com.cn>; devel@edk2.groups.io
Subject: RE: [edk2-devel] [PATCH] SecurityPkg: DxeTcg2PhysicalPresen= ceLib for Clear Graphics Screen To unblock and Display TPM messages

 

Can you please review and share your feedback?<= /o:p>

 

 

Tha= nks & Regards

Kar= unakar Poosapalli

Firmware Principal Engineer, Client BIOS=

Customer BIOS | Dell Core BIOS<= /span>

CPG Software Engineering | Dell Technologies

Mobile +91 9951902957<= /p>

Karunakar_poosapalli@Dell.Com<= /p>

 

 

Internal Use - Confidential

From: Poosapalli, Karunakar
Sent: Saturday, July 22, 2023 1:21 AM
To: jiewen.yao@intel.com= ; gaoliming; devel@edk2.groups.io
Subject: [edk2-devel] [PATCH] SecurityPkg: DxeTcg2PhysicalPresenceLi= b for Clear Graphics Screen To unblock and Display TPM messages

 

Patch review for Bugzilla -  https://bugzilla.tianocore.= org/show_bug.cgi?id=3D4462

 

From c537f9c5c9e02c54e27466b96fe33555afccd358 Mon Se= p 17 00:00:00 2001

From: Karunakar Poosapalli karunakar_poosapalli@dell.com

Date: Sat, 22 Jul 2023 01:13:44 +0530

Subject: [PATCH] Patch - Enhance Tcg2 to clear graph= ics before printing the

messages on screen

 

[Background]

Tcg2UserConfirm() Function is used to display any us= er conformation messages on the console

Function Definition Full path - SecurityPkg\Library\= DxeTcg2PhysicalPresenceLib\DxeTcg2PhysicalPresenceLib.c

 

[Issue]

In the current Tcg2UserConfirm() implementation, Thi= s function forms a destination string to be displayed on the console and di= rectly Print the message on Console.

 

But there is no logic added to clear the graphics be= fore printing the messages on the screen.

 

There are some scenarios where Tcg messages might ha= ve been blocked by some other GUI or messages on Console.

  1. When there are some messages or logos alre= ady displayed in the content on the console,

     TCG message will NOT be dis= played or corrupted to the End user.

  2. There could be a Custom logo displaying on= the screen which actually blocks the screen.

 

[Solution]

  1. As TCG user confirmation is the highest pr= iority and it blocks the POST until the user

     presses the input key. Befo= re TCG messages Print on the console, there should be logic

     added to clear the graphics= screen

 

Cc: gaoliming gaoliming@byosoft.com.cn

Cc: Jiewen  Jiewen.yao@intel.com

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D4462

Signed-off-by: Karunakar Poosapalli karunakar_poosapalli@dell.com

---

.../DxeTcg2PhysicalPresenceLib.c   &n= bsp;          | 74 +++++++++++= ++++++++

.../DxeTcg2PhysicalPresenceLib.inf   =          |  1 +

2 files changed, 75 insertions(+)

 

diff --git a/SecurityPkg/Library/DxeTcg2PhysicalPres= enceLib/DxeTcg2PhysicalPresenceLib.c b/SecurityPkg/Library/DxeTcg2PhysicalP= resenceLib/DxeTcg2PhysicalPresenceLib.c

index de4f5e583d..bd486f3b5b 100644

--- a/SecurityPkg/Library/DxeTcg2PhysicalPresenceLib= /DxeTcg2PhysicalPresenceLib.c

+++ b/SecurityPkg/Library/DxeTcg2PhysicalPresenceLib= /DxeTcg2PhysicalPresenceLib.c

@@ -251,6 +251,74 @@ Tcg2ExecutePhysicalPresence (

   }

}

 

+/**

+  Clear Graphics Screen To unblock and Display= TPM messages 

+

+  @param[in]  VOID

+  @retval     EFI_STATUS

+**/

+EFI_STATUS

+ClearGraphicsScreenToDisplayTpmMessages()

+{

+  EFI_GRAPHICS_OUTPUT_PROTOCOL *Gop;

+  EFI_STATUS Status;

+  EFI_HANDLE     &nbs= p;            &= nbsp;           *HandleBu= ffer;

+  UINTN      &nb= sp;            =             &nb= sp;   NumberOfHandles;

+  UINTN      &nb= sp;            =             &nb= sp;   Index;

+  EFI_DEVICE_PATH_PROTOCOL   &n= bsp;            *Gop= DevicePath;

+

+  DEBUG((DEBUG_INFO, "ClearGraphicsScreen= ToDisplayTpmMessages Entry...\n"));

+

+  Status =3D gBS->LocateHandleBuffer (=

+        &nb= sp;   ByProtocol,

+        &nb= sp;   &gEfiGraphicsOutputProtocolGuid,

+        &nb= sp;   NULL,

+        &nb= sp;   &NumberOfHandles,

+        &nb= sp;   &HandleBuffer

+        &nb= sp;   );

+  DEBUG((DEBUG_INFO, "LocateHandleBuffer = Status =3D %r, NumberOfHandles =3D %x\n", Status, NumberOfHandles));

+

+  if (EFI_ERROR (Status))

+  {

+    return Status;

+  }

+  for (Index =3D 0; Index < NumberOfHandles= ; Index++)

+    {

+      Status =3D gBS->H= andleProtocol (

+        &nb= sp;       HandleBuffer[Index],

+        &nb= sp;       &gEfiDevicePathProtocolGuid,

+        &nb= sp;       (VOID *)&GopDevicePath

+        &nb= sp;       );

+      DEBUG((DEBUG_INFO, &= quot;HandleProtocol GopDevicePath Status =3D %r, Index =3D %x\n", Stat= us, Index));

+      if (EFI_ERROR (Statu= s))

+        {

+        &nb= sp; continue;

+        }

+

+      Status =3D gBS->H= andleProtocol (

+        &nb= sp;       HandleBuffer[Index],

+        &nb= sp;       &gEfiGraphicsOutputProtocolGuid= ,

+        &nb= sp;       (VOID **) &Gop

+        &nb= sp;       );

+      DEBUG((DEBUG_INFO, &= quot;HandleProtocol Gop Status =3D %r, Index =3D %x\n", Status, Index)= );

+      if (EFI_ERROR(Status= ))

+        {

+        &nb= sp;   continue;

+        }

+

+      // Clear the graphic= s screen to black

+      Status =3D Gop->B= lt(Gop, NULL, EfiBltVideoFill, 0, 0, 0, 0, Gop->Mode->Info->Horizo= ntalResolution, Gop->Mode->Info->VerticalResolution, 0);

+      DEBUG((DEBUG_INFO, &= quot;Gop->Blt Status =3D %r, Index =3D %x\n", Status, Index));=

+      if (EFI_ERROR(Status= )) {

+        continue= ;

+      }

+    }

+

+  gBS->FreePool (HandleBuffer);<= /p>

+  DEBUG((DEBUG_INFO, "ClearGraphicsScreen= ToDisplayTpmMessages Exit...\n"));

+  return Status;

+}

/**

   Read the specified key for user confirm= ation.

 

@@ -576,6 +644,12 @@ Tcg2UserConfirm (

   BufSize -=3D StrSize (ConfirmText);

   UnicodeSPrint (ConfirmText + StrLen (Co= nfirmText), BufSize, TmpStr1, TmpStr2);

 

+  //

+  //Clear Graphics Screen To unblock and Displ= ay TPM messages

+  //

+  Status =3D ClearGraphicsScreenToDisplayTpmMe= ssages();

+  DEBUG((DEBUG_INFO, "ClearGraphicsScreen= ToDisplayTpmMessages Status =3D %r\n", Status));

+

   DstStr[80] =3D L'\0';

   for (Index =3D 0; Index < StrLen (Co= nfirmText); Index +=3D 80) {

     StrnCpyS (DstStr, sizeof (D= stStr) / sizeof (CHAR16), ConfirmText + Index, sizeof (DstStr) / sizeof (CH= AR16) - 1);

diff --git a/SecurityPkg/Library/DxeTcg2PhysicalPres= enceLib/DxeTcg2PhysicalPresenceLib.inf b/SecurityPkg/Library/DxeTcg2Physica= lPresenceLib/DxeTcg2PhysicalPresenceLib.inf

index e1c7c20d52..de423cfd13 100644

--- a/SecurityPkg/Library/DxeTcg2PhysicalPresenceLib= /DxeTcg2PhysicalPresenceLib.inf

+++ b/SecurityPkg/Library/DxeTcg2PhysicalPresenceLib= /DxeTcg2PhysicalPresenceLib.inf

@@ -54,6 +54,7 @@

[Protocols]

   gEfiTcg2ProtocolGuid   &= nbsp;           &nbs= p; ## SOMETIMES_CONSUMES

   gEdkiiVariableLockProtocolGuid &nb= sp;     ## SOMETIMES_CONSUMES

+  gEfiGraphicsOutputProtocolGuid  &n= bsp;    ## CONSUMES

 

 [Pcd]

   gEfiSecurityPkgTokenSpaceGuid.PcdTcg2Ph= ysicalPresenceFlags       ## SOMETIMES_CONSUM= ES

--

2.17.0.windows.1

 

 

Internal Use - Confidential

_._,_._,_

Groups.io Links:

=20 You receive all messages sent to this group. =20 =20

View/Reply Online (#107244) | =20 | Mute= This Topic | New Topic
Your Subscriptio= n | Contact Group Owner | Unsubscribe [rebecca@openfw.io]

_._,_._,_
--_000_MW4PR11MB5872F29F4E3F6DDAB04595088C03AMW4PR11MB5872namp_--