From nobody Sun Apr 28 16:56:19 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+95622+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+95622+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1666819454; cv=none; d=zohomail.com; s=zohoarc; b=n0jKAyqLG7T5hoaV547COp9+SdmWjFochPKBV1+oDCiehdEPPDdeQ/eFhchBuj54ELl/YZHxyCtYoAuu/fIEH4CVum7Pe7wxWBY/K5AVTaA5IsjXDwbp+9uFK69ufVi8Ucdgvw5q0fH6O3PWRKRRcuLHZBRQEThUn2gYUSD8f+s= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1666819454; h=Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Sender:Subject:To; bh=dq2IUeDvo3LJqChs67M3LDBwikOwKLh9OjbeDIZO3d8=; b=QKfesMi0+MecOfIVAuJacjL5wxCfBycKwV8ZbVk1VdbQZHSOWlgLfu8sMKicwhiEQV6RSK2hT++XL9dbCR83LrAp2NEso5n25cmXmJbVrhK4YyZ/j71fNFq0QL3rxqryyAr6PAc/Mxkd20cFsihXzL22tjZE9taUdYtNwu4MQ2E= 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+95622+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 1666819454695100.33891075712643; Wed, 26 Oct 2022 14:24:14 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id vIO2YY1788612xyw4Bs1anAL; Wed, 26 Oct 2022 14:24:14 -0700 X-Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by mx.groups.io with SMTP id smtpd.web09.1482.1666819453283539047 for ; Wed, 26 Oct 2022 14:24:13 -0700 X-IronPort-AV: E=McAfee;i="6500,9779,10512"; a="309757173" X-IronPort-AV: E=Sophos;i="5.95,215,1661842800"; d="scan'208";a="309757173" X-Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Oct 2022 14:24:08 -0700 X-IronPort-AV: E=McAfee;i="6500,9779,10512"; a="634651593" X-IronPort-AV: E=Sophos;i="5.95,215,1661842800"; d="scan'208";a="634651593" X-Received: from ecbjorge-mobl1.amr.corp.intel.com ([10.212.214.112]) by fmsmga007-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Oct 2022 14:24:07 -0700 From: "Bjorge, Erik C" To: devel@edk2.groups.io Cc: Erik Bjorge , Jiewen Yao , Jian J Wang Subject: [edk2-devel] [PATCH V1] SecurityPkg: Fix return handling in RdRandGenerateEntropy Date: Wed, 26 Oct 2022 14:23:44 -0700 Message-Id: <91a69f0b059217210234eef8cac8ee37df7a152e.1666819264.git.erik.c.bjorge@intel.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: 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,erik.c.bjorge@intel.com X-Gm-Message-State: Gwyw5CrbqXenpCt7ZLdQAhMex1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1666819454; bh=Kq7Zw1gexZIp0oYQ1NkcztPZGsP8FH88iHUGnWRWmfE=; h=Cc:Date:From:Reply-To:Subject:To; b=L9WdvF2HgBhQVKszLa0XAiKNzS9Xxoj9/GavGGj9X00xtB5jnXTZa6MT+NpKt0dB4LQ SbXclrZE7NCfwWYUudPpAU+lGmv42ixI1Y5eOhTwkksC8R5tnBto6oFr8WnK7kIJvWyKd RtxCDrdyDwynGPkRgD8uA+iLCSbhCCv0/G0= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1666819455908100001 Content-Type: text/plain; charset="utf-8" REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D4090 The function GetRandomNumber128 returns a BOOLEAN and not EFI_STATUS. Update the code to correctly handle the BOOLEAN return type. Cc: Jiewen Yao Cc: Jian J Wang Signed-off-by: Erik Bjorge --- .../PeiDxeTpmPlatformHierarchyLib.c | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/SecurityPkg/Library/PeiDxeTpmPlatformHierarchyLib/PeiDxeTpmPla= tformHierarchyLib.c b/SecurityPkg/Library/PeiDxeTpmPlatformHierarchyLib/Pei= DxeTpmPlatformHierarchyLib.c index b8838766bc..8e3b7ce9fd 100644 --- a/SecurityPkg/Library/PeiDxeTpmPlatformHierarchyLib/PeiDxeTpmPlatformHi= erarchyLib.c +++ b/SecurityPkg/Library/PeiDxeTpmPlatformHierarchyLib/PeiDxeTpmPlatformHi= erarchyLib.c @@ -46,12 +46,10 @@ RdRandGenerateEntropy ( OUT UINT8 *Entropy ) { - EFI_STATUS Status; UINTN BlockCount; UINT64 Seed[2]; UINT8 *Ptr; =20 - Status =3D EFI_NOT_READY; BlockCount =3D Length / sizeof (Seed); Ptr =3D (UINT8 *)Entropy; =20 @@ -59,9 +57,8 @@ 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_NOT_READY; } =20 CopyMem (Ptr, Seed, sizeof (Seed)); @@ -73,14 +70,13 @@ RdRandGenerateEntropy ( // // Populate the remained data as request. // - Status =3D GetRandomNumber128 (Seed); - if (EFI_ERROR (Status)) { - return Status; + if (!GetRandomNumber128 (Seed)) { + return EFI_NOT_READY; } =20 CopyMem (Ptr, Seed, (Length % sizeof (Seed))); =20 - return Status; + return EFI_SUCCESS; } =20 /** --=20 2.36.0.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 (#95622): https://edk2.groups.io/g/devel/message/95622 Mute This Topic: https://groups.io/mt/94591739/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-