From nobody Sun May 19 01:15:23 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+109362+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+109362+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1696575514; cv=none; d=zohomail.com; s=zohoarc; b=K/mGZdtrcJTZKHdKF4EiNBofX5URBhsaCH0i5ieptS+VfI7yVlfuqLyzLhvm18zQvAqnJ9oaYbAgXfnYSf1IcO+ixlaAULQQDaPhRx3jVuXrGPHm2RQ4f5Tme1JILHcwzgBVL6cbsAVr/k77nfnUlKxOVqLc3YTCqT1OQd8vir0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1696575514; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Reply-To:Sender:Subject:Subject:To:To:Message-Id; bh=sXgwgkxUKhIsIIgZ25Qs+NAsPbNnDRQVcPMnRqhuO1w=; b=b1/mTJL2YuoMF1wnOg3x0UnKp4VFo8K1kY6DQDLcfsNmkRpMg5WLDchFXJRsb5ev0q48m11P0elFccnvpAknsf/AfngCd2E9r548JMpv+H2kjd763Rf4XSXImecv/O28dTl31ImoV1fj9C1UMGHB+RaEpbgSFaKnenIZFaNjhc0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+109362+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1696575514454217.32675620612645; Thu, 5 Oct 2023 23:58:34 -0700 (PDT) Return-Path: DKIM-Signature: a=rsa-sha256; bh=DmlOaeAGkKnTi1GUt7pjV4vslnEPNBTNn9l7ZHwp7d0=; 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=vIYUXGajI4JqiNbhmAGSqPSibjWUP22+2ynvvO5CTAfSEvijmzLvpQ8UX89/S9/7R8zmx6tX yp0g1AcNJSpF8UvGhxvwZM62PY3XrRSYgwSAoMkNYvMu525f3yHfEJk+kAHKLMAWU7wN2ZJcwnf jt8/AnX11M8Mrp92i85PCT4g= X-Received: by 127.0.0.2 with SMTP id QjyJYY1788612xD3zVMYqRuL; 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: 447PSqXFQg1nTNiOq1t5qO10x1787277AA= Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1696575515068100001 Content-Type: text/plain; charset="utf-8" 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 // while (BlockCount > 0) { - Status =3D GetRandomNumber128 (Seed); - if (EFI_ERROR (Status)) { - return Status; + if (!(GetRandomNumber128(Seed))) { + return EFI_DEVICE_ERROR; } - CopyMem (Ptr, Seed, 64); + CopyMem (Ptr, Seed, (Length % 64)); =20 BlockCount--; Ptr =3D Ptr + 64; @@ -78,7 +77,7 @@ RdRandGenerateEntropy ( if (EFI_ERROR (Status)) { return Status; } - CopyMem (Ptr, Seed, (Length % 64)); + CopyMem (Ptr, Seed, 64); =20 return Status; } --=20 2.26.2.windows.1 -=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 (#109362): https://edk2.groups.io/g/devel/message/109362 Mute This Topic: https://groups.io/mt/101792759/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-