From nobody Mon Feb 9 14:35:38 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+100808+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+100808+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=arm.com ARC-Seal: i=1; a=rsa-sha256; t=1678209465; cv=none; d=zohomail.com; s=zohoarc; b=Gx0iNCo6b8dBCqNCSsRMRYIO0ZEhTLlUriFSgmo7JgDpsLW/VlsIQ/Gn2zxe/Dw0Bl+u7MbM7zISFsdU2DkM6PO88xone+1jKxaAkTJ5qvCEXA+qHpG7fJWSbi0tEUWn/Uj3ZIDtOWbMB+En6rOfL6OSR2MdCgrYESv1tGJgWOY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1678209465; 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=ihQowcb9m4xNdcMAZNajT1gEUf0B9dv4iIyLTb8kg90=; b=B6wIjngIUf0fzXGFo2NGmPNngLFbSUbalze1JRFOajEKm7lUO2+SHrEvGS0a2q5vEsB+I7cEES0fymL5d9WCfPF2MZKSF5WLJX6qks6QX1+4iM/IEltY7BG2wt5FsHyqmigvzLOH+2AqijmPc3RDvUhG6rAbxD1Yb/caN2j+9s4= 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+100808+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 16782094651585.582581179296994; Tue, 7 Mar 2023 09:17:45 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id uEUCYY1788612xLmgdajvjrD; Tue, 07 Mar 2023 09:17:44 -0800 X-Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web10.53.1678209397175697012 for ; Tue, 07 Mar 2023 09:16:37 -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 405A71CDD; Tue, 7 Mar 2023 09:17:20 -0800 (PST) X-Received: from cam-smtp0.cambridge.arm.com (pierre123.nice.arm.com [10.34.100.129]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id C8E333F67D; Tue, 7 Mar 2023 09:16:35 -0800 (PST) From: "PierreGondois" To: devel@edk2.groups.io Cc: ardb+tianocore@kernel.org, leif@nuviainc.com, sami.mujawar@arm.com, Jiewen Yao , Jian J Wang Subject: [edk2-devel] [PATCH v4 2/2] SecurityPkg/RngDxe: Check for NULL PcdCpuRngSupportedAlgorithm Date: Tue, 7 Mar 2023 18:15:50 +0100 Message-Id: <20230307171550.555541-3-pierre.gondois@arm.com> In-Reply-To: <20230307171550.555541-1-pierre.gondois@arm.com> References: <20230307171550.555541-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: L2O1epfCJ3lFqEBPLA5WzHGFx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1678209464; bh=EpQJC6QH6v1t30fKCc6rE6/zlCvZ4NHMF2FtiCQz9To=; h=Cc:Date:From:Reply-To:Subject:To; b=wU3yHmeUA6hf9fg8O8LXA4fyN/A84ChHuYdGBFEBfAJDdgNNZmtOj15RFp38hflr0DG jTtl5QqTR9XiPzL28gZCRWkQ7q8wKQIHv8qJwqlkGfLT6E2Irr1NtKLBbM326TgD6205F ejTNlZ8itH0sjyys6Br1VdN1jhCu9biga8Y= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1678209465703100005 Content-Type: text/plain; charset="utf-8" From: Pierre Gondois BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=3D4151 The EFI_RNG_PROTOCOL can advertise multiple algorithms through Guids. The PcdCpuRngSupportedAlgorithm contains a Guid that can be configured. It represents the algorithm used in RngLib and using CPU instructions. When adding support for the Firmware Trng interface, it was made available through in the RngDxe module. In RngDxe, the algorithm associated with PcdCpuRngSupportedAlgorithm (implemented by the RngLib) was always advertised by default. It was assumed that support for RngLib and RNDR instructions should be kept in ArmVirtPkg. However this support did not exist as all ArmVirtPkg use the BaseRngLibTimerLib.inf implementation of the RngLib. Do not advertise the RngLib and PcdCpuRngSupportedAlgorithm if PcdCpuRngSupportedAlgorithm is NULL. Reported-by: Sami Mujawar Signed-off-by: Pierre Gondois --- .../RngDxe/AArch64/AArch64Algo.c | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/SecurityPkg/RandomNumberGenerator/RngDxe/AArch64/AArch64Algo.c= b/SecurityPkg/RandomNumberGenerator/RngDxe/AArch64/AArch64Algo.c index e8be217f8a8c..c98e09363e25 100644 --- a/SecurityPkg/RandomNumberGenerator/RngDxe/AArch64/AArch64Algo.c +++ b/SecurityPkg/RandomNumberGenerator/RngDxe/AArch64/AArch64Algo.c @@ -39,23 +39,15 @@ GetAvailableAlgorithms ( } =20 // Check RngGetBytes() before advertising PcdCpuRngSupportedAlgorithm. - if (!EFI_ERROR (RngGetBytes (sizeof (DummyRand), (UINT8 *)&DummyRand))) { + if (!IsZeroGuid (PcdGetPtr (PcdCpuRngSupportedAlgorithm)) && + !EFI_ERROR (RngGetBytes (sizeof (DummyRand), (UINT8 *)&DummyRand))) + { CopyMem ( &mAvailableAlgoArray[mAvailableAlgoArrayCount], PcdGetPtr (PcdCpuRngSupportedAlgorithm), sizeof (EFI_RNG_ALGORITHM) ); mAvailableAlgoArrayCount++; - - DEBUG_CODE_BEGIN (); - if (IsZeroGuid (PcdGetPtr (PcdCpuRngSupportedAlgorithm))) { - DEBUG (( - DEBUG_WARN, - "PcdCpuRngSupportedAlgorithm should be a non-zero GUID\n" - )); - } - - DEBUG_CODE_END (); } =20 // Raw algorithm (Trng) --=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 (#100808): https://edk2.groups.io/g/devel/message/100808 Mute This Topic: https://groups.io/mt/97454018/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-