From: Kun Qin <ku...@microsoft.com> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4491
The existing logic of initializing `mAvailableAlgoArrayCount` will treat the zero GUID in `PcdCpuRngSupportedAlgorithm` as a legit case and increment `mAvailableAlgoArrayCount`, causing the RNG protocol be published. However, when the protocol is invoked, any zero GUID will be filtered out, leaving a possible edge case where the protocol only has a zero GUID based algorithm and being filtered out will always result in an ASSERT. This change marked the zero GUID as an issue and will not increment the counter and thus avoid publishing the protocol completely. Cc: Jiewen Yao <jiewen....@intel.com> Cc: Jian J Wang <jian.j.w...@intel.com> Cc: Sami Mujawar <sami.muja...@arm.com> Cc: Pierre Gondois <pierre.gond...@arm.com> Signed-off-by: Kun Qin <ku...@microsoft.com> --- SecurityPkg/RandomNumberGenerator/RngDxe/AArch64/AArch64Algo.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/SecurityPkg/RandomNumberGenerator/RngDxe/AArch64/AArch64Algo.c b/SecurityPkg/RandomNumberGenerator/RngDxe/AArch64/AArch64Algo.c index e8be217f8a8c..de279cdadeea 100644 --- a/SecurityPkg/RandomNumberGenerator/RngDxe/AArch64/AArch64Algo.c +++ b/SecurityPkg/RandomNumberGenerator/RngDxe/AArch64/AArch64Algo.c @@ -47,15 +47,16 @@ GetAvailableAlgorithms ( ); mAvailableAlgoArrayCount++; - DEBUG_CODE_BEGIN (); if (IsZeroGuid (PcdGetPtr (PcdCpuRngSupportedAlgorithm))) { + DEBUG_CODE_BEGIN (); DEBUG (( DEBUG_WARN, "PcdCpuRngSupportedAlgorithm should be a non-zero GUID\n" )); + + DEBUG_CODE_END (); + mAvailableAlgoArrayCount--; } - - DEBUG_CODE_END (); } // Raw algorithm (Trng) -- 2.41.0.windows.1 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#106484): https://edk2.groups.io/g/devel/message/106484 Mute This Topic: https://groups.io/mt/99839047/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-