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 A8A7D941AC9 for ; Mon, 24 Jul 2023 17:07:29 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=aMKDEfhgQocTyx93g24pf37pjRYWj00hEYnyjQc61OI=; c=relaxed/simple; d=groups.io; h=X-Received: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-exotenant: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-OriginatorOrg: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-Transport-CrossTenantHeadersStamped:X-Proofpoint-ORIG-GUID:X-Proofpoi nt-GUID: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=1690218448; v=1; b=JO5vjOgaQmUOONPlFQyUt4AW2jDuY/TQ6zF4qpNUA83UkGq2HDKldUoOtr1n39Doe7m7ojsb p/k/vyI4NpJi3bVMKFnQJzirO2i5LavCbTsz03VdqB8n1LxF7Z88ubw4l6jK8RKrM8b7HeuIG12 BOFsoDzSvc7iTI3l6/1Z3R4Q= X-Received: by 127.0.0.2 with SMTP id zbcKYY7687511xrfceMas07r; Mon, 24 Jul 2023 10:07:28 -0700 X-Received: from mx0b-00154904.pphosted.com (mx0b-00154904.pphosted.com [148.163.137.20]) by mx.groups.io with SMTP id smtpd.web11.51129.1690212401716547973 for ; Mon, 24 Jul 2023 08:26:42 -0700 X-Received: from pps.filterd (m0170397.ppops.net [127.0.0.1]) by mx0b-00154904.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 36OD1k1b012914; Mon, 24 Jul 2023 11:26:29 -0400 X-Received: from mx0a-00154901.pphosted.com (mx0a-00154901.pphosted.com [67.231.149.39]) by mx0b-00154904.pphosted.com (PPS) with ESMTPS id 3s086txvg0-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 24 Jul 2023 11:26:28 -0400 X-Received: from pps.filterd (m0134746.ppops.net [127.0.0.1]) by mx0a-00154901.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 36OF0mcg004075; Mon, 24 Jul 2023 11:26:27 -0400 X-Received: from nam11-dm6-obe.outbound.protection.outlook.com (mail-dm6nam11lp2175.outbound.protection.outlook.com [104.47.57.175]) by mx0a-00154901.pphosted.com (PPS) with ESMTPS id 3s1k3frjw8-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 24 Jul 2023 11:26:26 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=JH/JGuqxvhxcoB3gGKMI8a7T7JOA6g3J6825Ct8SCc1CZjkgQ7SQIYA9s7Yi28WZPqZ1Q4GBaM7HpUXz5N/BEoRC/4uE7kSSxKr/8ZerKX1s6DnRiD4hofmuBHjvwOB6hWWAU6a+Df8ryN3dc2B1oV93fZLIcLx+8u1He/SGsp+HzZMknAWvm2Xh0DynSEqyE2hVCwO+vAsQ2omGrl1be6UIx3awDZhLzklhVr/2Xu4M8O31GxH/UaWurLh3msWNI+RD1Dfmr5NizHOHu883eZp825O0Qr8bzUONfDvVuFDwUsq1exNo5LqYwgL2ZOMSyua4RkhNTmDrKZ9ekMFINw== 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=kggRpD/0L3e7RsA+pJl1harTCOqUwVLSjsyQkdTDiNk=; b=UyDl1j9ocSTu2slyhqxNehQf1ZKc5UwH3F7aYaaMSorEfXtT9A9W2Jy+QRlG/R8YuuDsSWejPRlTsPEPYzLHcz6w/JT2PC/7WlDwACjnJufwwd5Z1ZGShI+HnH4RpwPKJO/2PBJY+D2rVy7tJENgjEgWSTrBh0ozTy/mB4WSfLV/pOgAdytkf/IDQCrYASt9hhrIWxTi5BvisVuieGq1bjnJe/7iTX91po5iHXHgZK2iKGGlSjocVF3K0W9fVbkhfswATWK5jdFwFvHWzptAJgjU0BJr5zs6DiEGxyqZ07SjWRNrSH9CHK3p2i1PJdKPVj7K/9aAx1l2aTMAqqpejw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=dell.com; dmarc=pass action=none header.from=dell.com; dkim=pass header.d=dell.com; arc=none X-Received: from SA1PR19MB5572.namprd19.prod.outlook.com (2603:10b6:806:229::8) by LV3PR19MB8279.namprd19.prod.outlook.com (2603:10b6:408:1a4::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6609.24; Mon, 24 Jul 2023 15:26:23 +0000 X-Received: from SA1PR19MB5572.namprd19.prod.outlook.com ([fe80::450a:af8c:1e79:6116]) by SA1PR19MB5572.namprd19.prod.outlook.com ([fe80::450a:af8c:1e79:6116%4]) with mapi id 15.20.6609.031; Mon, 24 Jul 2023 15:26:23 +0000 From: "Poosapalli, Karunakar via groups.io" To: "jiewen.yao@intel.com" , gaoliming , "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: Adm8DJurGgUFmZ0XSiuVHtzYqmi7VgCNo1Ng Date: Mon, 24 Jul 2023 15:26:23 +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: SA1PR19MB5572:EE_|LV3PR19MB8279:EE_ x-ms-office365-filtering-correlation-id: 764ed35b-c531-4a7e-c245-08db8c5a56e0 x-exotenant: 2khUwGVqB6N9v58KS13ncyUmMJd8q4 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam-message-info: 4n9dGhfo5/wi87dG4k4bkZAZ40+MwmrM2cFJHQG9uJALpPLLPQpItFkiQP/ei1/+yfcbiqXdytQuCuyU7T0wOSrOgb+v08TxkyHGurYZUyuodgPluxgKUnVBeAq2C/vjDMn9W2XqX0YO5VK21SoCxWi1qjZ5nGSg1WBAXdwaIf+dxOQjkXIMqzB4oNWpSYLYF9j2VkonVWjWzSYPJvPbAbJoX5NX4WLofeiX3wgXZnFSAuE2vII4Xqi/oflydd+wRTMbOReedAGTtFjRfK8y0CLzFJzSbH4VZ156xdaeaGS307bvpU4LCxIQkLBiKhTtRLrBrd6DLokgbEW3DEuc50T4vByvrpPgaHFq/eDToh3VXX5JgBuZscKWLL0eR2h2vdUPoA7R2Rg8i5K4GcFLcRKJi62fHk4sya2wOP8zSgVi3y49A11R02C041NihEnuztd3wE3tjC3OH+u84hKmCd0HV9czUw9MBfSPWo+e1/FZql0o1Bs987CQVI5NTnxoOMUG7taIAekrf8w619hCys5jWW2wY7uE7Q0pDF1A4Bqp8TqVuSdDKD8PSEfzZ9AiNJoNt4k+vEGVmwqKeLukYxgrEG+IOEBEGANLQ+MVmOs= x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?3No/7dBZq/yi4VFCmfWP/Xg9QZIIfliWy4HEIYK6DlERhiBHG6wFjMNYLPMI?= =?us-ascii?Q?qZ+Bf3PAWdn8abmQ+O1HwwnyUnd8ymgSn6OMIVdMl3KLyUNwlKOYE8KLwGLF?= =?us-ascii?Q?83HVdIIYWqgdVFblS8OB/U4LmCm5lEeCtyBL3YwBUzPmICRrUm2ic9N/1vv9?= =?us-ascii?Q?+gNJZBRUIva0yL9uWi8iHAgGOoIK4jlIV0iTzPSY3aIc/jWKN0TthVQu6G8P?= =?us-ascii?Q?uihEYsen/YQka4wtEJepBElOWEk3Fa8DDJntCyxP74KKhfOd9bRb8qZ3udle?= =?us-ascii?Q?1TVfYM3M6C214kqRqpZQY4jxFgR4WHN32pcsjsRxt5yNDpP1H5wscEO66vQ6?= =?us-ascii?Q?Nhbg0WFt2PTdWrfZ4SXwLQclc8FKimAbo4VbZCstus4y38ibPtqyK/wsa4Tb?= =?us-ascii?Q?uegWdkSqM2Wn9PiBdY8AC7nMiqJKs/lPXVdYOBddLbqAOaK74YhPTrtYZNC1?= =?us-ascii?Q?tH6cfHyYHCM5KlbPsry5ou2TgOX1Q1vMntlsNShNkIJVLAr7Q4psLfHGeCxO?= =?us-ascii?Q?f/IQu+NSLWxYuvtZ+kM+BU8i8xbQws/ai5c9k/EuafNaOB4aL8EnJ2OMmJ9n?= =?us-ascii?Q?KUj9RVTS4mVQYh1BrFc26wWO7NzL+oY/dOqTJTkxKVq3tpnvEqFNR1P3Qv0w?= =?us-ascii?Q?zXzDkQfzCphADPm58JMPHynzmAIWmLrD1zyVDRsPGKWqtQTB6WhjFv1FSg5C?= =?us-ascii?Q?z5VMpI7mHgWfKRgrGnZtO6uOHzlffKDMkEfwi8QlueaxwoBH2RkgUriTCkeg?= =?us-ascii?Q?hNo5R+k0xv7nxncDavpzsic+NV16iGVJ/xXUCuqBYRAPoSc+JO3Vn0bb8siv?= =?us-ascii?Q?m5DOKuiQ/Kf6enZxBNV1VtGYX4w+OrTPSDySmfdRlxOb3ClawwHwYPX3wlqe?= =?us-ascii?Q?qlTO/uptdrgqWaFw9lmXp3gsjUNes6ZeTlfh1PkRx283dUTNcJUBjx8f0abV?= =?us-ascii?Q?Fii0J+9fvDCtLzsyC/026nnHX+9N/AZ7xXuDdFG/cv5fpeiA6KeAdLxASoHx?= =?us-ascii?Q?+1WHVDz0rvWYUdhRA6r2tKRSVtxnaIKTcm1MZc77Ycd+GjfPYxtpO6T56pZp?= =?us-ascii?Q?fzxGjCNTglkb5tyjKmqaXjMoeZHwZLGSsD3a7Gn921BGzO2tpr8n2os8DBAA?= =?us-ascii?Q?1YmyngtZUShfjQnc/yCWIgaPP9HTWNCMllsC/j489xI81KVjW1hv5qLZcK9N?= =?us-ascii?Q?/asig44v3eR0TOE3NAJMDPkOxJhB/8AqKpdkroVoHC0nr+xmOzIxtUhaWyCv?= =?us-ascii?Q?UDP0HZsfOXgNtmkh0FyvRPFBe+iW7TmxSNIG3QtqL8a3zjr6+A9zT7AiaKRx?= =?us-ascii?Q?VpPWwlnv1bWJSU7YUhPhHE8/SfYeNJ5F2N5z8gYTrsJlQXf9uDrmJqwUf16H?= =?us-ascii?Q?VWojHz+ZNbSf+LFdDWNVXWZhZWiuuOfDvIBZxr1It6pIjdCljYug6zrhGG+J?= =?us-ascii?Q?6RFQkhu8Wf5m6zS3bJzbeLKw38RFDVc7QaS1Fh+qIoLrBG2YvC0VZlYT0W+H?= =?us-ascii?Q?/hjQnKbOHwYDzpCGzgEgFzqrsQfIWISQyCOiT44xyAZfdw9CJomkCh8EUkjQ?= =?us-ascii?Q?YEPgqn8W+mehrwohFX85YCAiwHaJWIWovnYyTnMS8LiBHlFmJA12+KNKT0zt?= =?us-ascii?Q?2g=3D=3D?= MIME-Version: 1.0 X-OriginatorOrg: Dell.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: SA1PR19MB5572.namprd19.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 764ed35b-c531-4a7e-c245-08db8c5a56e0 X-MS-Exchange-CrossTenant-originalarrivaltime: 24 Jul 2023 15:26:23.5322 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 945c199a-83a2-4e80-9f8c-5a91be5752dd X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: sn64bnpTv+5LW3939YXIXwigZ0KUEGDWuD5E33YSF+5+Un8d1pIOqAoxoNqGRVR6WTcKzmvcTs0ZXp9vyF4bMT0Hbdh0V8QVMO3z+UUnx2M= X-MS-Exchange-Transport-CrossTenantHeadersStamped: LV3PR19MB8279 X-Proofpoint-ORIG-GUID: MTspczQuUxz6VlErFjFFq4n_bXhBM3DE X-Proofpoint-GUID: MTspczQuUxz6VlErFjFFq4n_bXhBM3DE 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,KarunakarPoosapalli@Dell.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: WV9s1j3OPc4tSPiih1oLENUTx7686176AA= Content-Language: en-US Content-Type: multipart/alternative; boundary="_000_SA1PR19MB5572C0449F73F74AD45345838B02ASA1PR19MB5572namp_" X-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20140610 header.b=JO5vjOga; dmarc=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_SA1PR19MB5572C0449F73F74AD45345838B02ASA1PR19MB5572namp_ Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable 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@edk2.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 (#107182): https://edk2.groups.io/g/devel/message/107182 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_SA1PR19MB5572C0449F73F74AD45345838B02ASA1PR19MB5572namp_ Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: quoted-printable

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 (#107182) | =20 | Mute= This Topic | New Topic
Your Subscriptio= n | Contact Group Owner | Unsubscribe [rebecca@openfw.io]

_._,_._,_
--_000_SA1PR19MB5572C0449F73F74AD45345838B02ASA1PR19MB5572namp_--