From nobody Tue Feb 10 05:45:39 2026 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+96619+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+96619+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=arm.com ARC-Seal: i=1; a=rsa-sha256; t=1669306713; cv=none; d=zohomail.com; s=zohoarc; b=eXfeKmhsrFAj1Vinz71tpFP9uHCQdHrOkhkopkyMgu2tY57rjqDekXzgsRo3pGWwIqCofniOXmbuqQn+LQjChWRbs+C9SSD5RYltoZABKp1RGqnAOwtMhhic5SZlhDZEjNKRlrIwpxbTcChekVIrcx8yfa4KA3chhlyhB9mIFfE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1669306713; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=V3cTqfExC+snMLoZ2goXzn0tVYfZQZXKVo61vRWJlC4=; b=e/+zeiDkBXv8PDKOilq6xjS75RsJtERoD+aRPK6A37u0drbg6u/pkUe17NJ1kyBakNyEZNWFh5+fllesrWnYTqwrij2oIfT/ceMbygDTi07N5KGPcoITDFT9y26jEE5+9JCq1DbwxGSM+c93lGOYdqFHmbQ6BJV5peAucGDrVsI= 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+96619+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 1669306713628598.1861083508165; Thu, 24 Nov 2022 08:18:33 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id 5yC2YY1788612xz0iwB4Y7YK; Thu, 24 Nov 2022 08:18:32 -0800 X-Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web11.27852.1669306712167278600 for ; Thu, 24 Nov 2022 08:18:32 -0800 X-Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 549D523A; Thu, 24 Nov 2022 08:18:38 -0800 (PST) X-Received: from pierre123.nice.arm.com (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 6129B3F587; Thu, 24 Nov 2022 08:18:30 -0800 (PST) From: "PierreGondois" To: devel@edk2.groups.io Cc: Ard Biesheuvel , Leif Lindholm , Sami Mujawar , Jiewen Yao , Jian J Wang Subject: [edk2-devel] [PATCH v3 2/4] SecurityPkg/RngDxe: Correctly update mAvailableAlgoArrayCount Date: Thu, 24 Nov 2022 17:17:54 +0100 Message-Id: <20221124161756.216996-3-Pierre.Gondois@arm.com> In-Reply-To: <20221124161756.216996-1-Pierre.Gondois@arm.com> References: <20221124161756.216996-1-Pierre.Gondois@arm.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,pierre.gondois@arm.com X-Gm-Message-State: i4WgAacWHoA2jVgXNytaI5HVx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1669306712; bh=yHOy7ccEFrCw6AxiY02FRVk4HDf6Of7E8ZNI873LCio=; h=Cc:Date:From:Reply-To:Subject:To; b=m0VP6ANRIwPmJgWp9EAlVwvmEbhBWcRSLLwFiNcHeDhHOpbNwxeRo1uMLTPVi7DaXOV cGnyDzLXyoGHNs5U9T4W8xVmJM5xXNUNN074xI3U5iSfIX4XLoSBlLBZI+Lq2gVr/o2TW o+Rg3Uc4rFJyEsOprBccdDJb7HDAzWjncH8= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1669306715191100003 Content-Type: text/plain; charset="utf-8" From: Pierre Gondois mAvailableAlgoArrayCount holds the count of available RNG algorithms. In a following patch, its value will be used to prevent the EFI_RNG_PROTOCOL to be installed if no RNG algorithm is available. Correctly set/reset the value for all implementations. Signed-off-by: Pierre Gondois --- SecurityPkg/RandomNumberGenerator/RngDxe/ArmRngDxe.c | 1 + SecurityPkg/RandomNumberGenerator/RngDxe/Rand/RngDxe.c | 9 ++++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/SecurityPkg/RandomNumberGenerator/RngDxe/ArmRngDxe.c b/Securit= yPkg/RandomNumberGenerator/RngDxe/ArmRngDxe.c index 5ba319899ce9..ce49ff7ae661 100644 --- a/SecurityPkg/RandomNumberGenerator/RngDxe/ArmRngDxe.c +++ b/SecurityPkg/RandomNumberGenerator/RngDxe/ArmRngDxe.c @@ -40,6 +40,7 @@ FreeAvailableAlgorithms ( VOID ) { + mAvailableAlgoArrayCount =3D 0; FreePool (mAvailableAlgoArray); return; } diff --git a/SecurityPkg/RandomNumberGenerator/RngDxe/Rand/RngDxe.c b/Secur= ityPkg/RandomNumberGenerator/RngDxe/Rand/RngDxe.c index 677600bed7ab..7e06e16e4be5 100644 --- a/SecurityPkg/RandomNumberGenerator/RngDxe/Rand/RngDxe.c +++ b/SecurityPkg/RandomNumberGenerator/RngDxe/Rand/RngDxe.c @@ -26,6 +26,11 @@ =20 #include "RngDxeInternals.h" =20 +// +// Count of Rng algorithms. +// +#define RNG_ALGORITHM_COUNT 2 + /** Allocate and initialize mAvailableAlgoArray with the available Rng algorithms. Also update mAvailableAlgoArrayCount. =20 @@ -38,6 +43,7 @@ GetAvailableAlgorithms ( VOID ) { + mAvailableAlgoArrayCount =3D RNG_ALGORITHM_COUNT; return EFI_SUCCESS; } =20 @@ -49,6 +55,7 @@ FreeAvailableAlgorithms ( VOID ) { + mAvailableAlgoArrayCount =3D 0; return; } =20 @@ -164,7 +171,7 @@ RngGetInfo ( return EFI_INVALID_PARAMETER; } =20 - RequiredSize =3D 2 * sizeof (EFI_RNG_ALGORITHM); + RequiredSize =3D RNG_ALGORITHM_COUNT * sizeof (EFI_RNG_ALGORITHM); =20 if (*RNGAlgorithmListSize < RequiredSize) { *RNGAlgorithmListSize =3D RequiredSize; --=20 2.25.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 (#96619): https://edk2.groups.io/g/devel/message/96619 Mute This Topic: https://groups.io/mt/95240505/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-