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 84C0774003B for ; Fri, 6 Oct 2023 06:58:35 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=dq1dtdFCY0JpM9iAWu4qNAe/zIPEE+8AAFZfwOpG0cY=; c=relaxed/simple; d=groups.io; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Transfer-Encoding; s=20140610; t=1696575514; v=1; b=ZB3Ho1zEAJmb+uxQd+vucNyZAADbQqF7F8zDmMBSOZe18bJx2hQjU9+AzcAvSzRyp19QkXa7 i2ThIzy9ECBvMBmcYTx1SqsEilVZLszBFZY0qm8KZjf0EDKNyJaFBv+oZ+4CkklQANDtIrIAGt6 v/ajVSUbldlS0aC5LkqHRQ3Y= X-Received: by 127.0.0.2 with SMTP id IVRVYY7687511xJzgOcRiGsZ; Thu, 05 Oct 2023 23:58:34 -0700 X-Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.31]) by mx.groups.io with SMTP id smtpd.web11.13889.1696508495462647072 for ; Thu, 05 Oct 2023 05:21:36 -0700 X-IronPort-AV: E=McAfee;i="6600,9927,10853"; a="447661680" X-IronPort-AV: E=Sophos;i="6.03,203,1694761200"; d="scan'208";a="447661680" X-Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Oct 2023 05:21:35 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10853"; a="751760492" X-IronPort-AV: E=Sophos;i="6.03,203,1694761200"; d="scan'208";a="751760492" X-Received: from pidsbabios007.gar.corp.intel.com ([10.66.244.202]) by orsmga002-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Oct 2023 05:21:32 -0700 From: Susovan Mohapatra To: devel@edk2.groups.io Cc: Chasel Chiu , Nate DeSimone , Isaac Oram , Liming Gao , Eric Dong Subject: [edk2-devel] [PATCH v2] MinPlatformPkg: Fix/Update code design gap. Date: Thu, 5 Oct 2023 17:51:05 +0530 Message-Id: <6fe43ef6050a2891bb6c77648f0ecc93810d1b82.1696504657.git.susovan.mohapatra@intel.com> MIME-Version: 1.0 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,susovan.mohapatra@intel.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: 8QunR5Tr5cc1GsNSBL2RxtYlx7686176AA= Content-Transfer-Encoding: quoted-printable X-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20140610 header.b=ZB3Ho1zE; 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 https://bugzilla.tianocore.org/show_bug.cgi?id=3D4461 1. The function GetRandomNumber128() returns a boolean TRUE/FALSE. The existing code was getting data in EFI_STATUS.0=3D=3DFALSE=3D=3DEFI_S= UCCESS Updated code to check for the return value before proceeding further. 2. The 'seed' from the GetRandomNumber128() is in bits. Changed the copymem to the way it is done in other place in same code. Cc: Chasel Chiu Cc: Nate DeSimone Cc: Isaac Oram Cc: Liming Gao Cc: Eric Dong Signed-off-by: Susovan Mohapatra --- .../PeiDxeTpmPlatformHierarchyLib.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/Platform/Intel/MinPlatformPkg/Tcg/Library/PeiDxeTpmPlatformHie= rarchyLib/PeiDxeTpmPlatformHierarchyLib.c b/Platform/Intel/MinPlatformPkg/T= cg/Library/PeiDxeTpmPlatformHierarchyLib/PeiDxeTpmPlatformHierarchyLib.c index 9812ab99ab..0c18c74028 100644 --- a/Platform/Intel/MinPlatformPkg/Tcg/Library/PeiDxeTpmPlatformHierarchyL= ib/PeiDxeTpmPlatformHierarchyLib.c +++ b/Platform/Intel/MinPlatformPkg/Tcg/Library/PeiDxeTpmPlatformHierarchyL= ib/PeiDxeTpmPlatformHierarchyLib.c @@ -61,11 +61,10 @@ RdRandGenerateEntropy ( // Generate high-quality seed for DRBG Entropy=0D //=0D while (BlockCount > 0) {=0D - Status =3D GetRandomNumber128 (Seed);=0D - if (EFI_ERROR (Status)) {=0D - return Status;=0D + if (!(GetRandomNumber128(Seed))) {=0D + return EFI_DEVICE_ERROR;=0D }=0D - CopyMem (Ptr, Seed, 64);=0D + CopyMem (Ptr, Seed, (Length % 64));=0D =0D BlockCount--;=0D Ptr =3D Ptr + 64;=0D @@ -78,7 +77,7 @@ RdRandGenerateEntropy ( if (EFI_ERROR (Status)) {=0D return Status;=0D }=0D - CopyMem (Ptr, Seed, (Length % 64));=0D + CopyMem (Ptr, Seed, 64);=0D =0D return Status;=0D }=0D --=20 2.26.2.windows.1 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#109362): https://edk2.groups.io/g/devel/message/109362 Mute This Topic: https://groups.io/mt/101792759/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=-=-=-=-=-=-=-=-=-=-=-