From: Pierre Gondois <pierre.gond...@arm.com> On Arm platforms, the number of available RNG algorithms is dynamically detected and can be 0 in the absence of FEAT_RNG and firmware TRNG. In this case, the EFI_RNG_PROTOCOL should not be installed to prevent from installing an empty protocol.
Signed-off-by: Pierre Gondois <pierre.gond...@arm.com> --- .../RandomNumberGenerator/RngDxe/RngDxe.c | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/SecurityPkg/RandomNumberGenerator/RngDxe/RngDxe.c b/SecurityPkg/RandomNumberGenerator/RngDxe/RngDxe.c index 421abb52b8bf..d30cb7f47696 100644 --- a/SecurityPkg/RandomNumberGenerator/RngDxe/RngDxe.c +++ b/SecurityPkg/RandomNumberGenerator/RngDxe/RngDxe.c @@ -63,6 +63,18 @@ RngDriverEntry ( EFI_STATUS Status; EFI_HANDLE Handle; + // + // Get the list of available algorithm. + // + Status = GetAvailableAlgorithms (); + if (EFI_ERROR (Status)) { + return Status; + } + + if (mAvailableAlgoArrayCount == 0) { + return EFI_UNSUPPORTED; + } + // // Install UEFI RNG (Random Number Generator) Protocol // @@ -74,13 +86,10 @@ RngDriverEntry ( NULL ); if (EFI_ERROR (Status)) { - return Status; + FreeAvailableAlgorithms (); } - // - // Get the list of available algorithm. - // - return GetAvailableAlgorithms (); + return Status; } /** -- 2.25.1 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#96620): https://edk2.groups.io/g/devel/message/96620 Mute This Topic: https://groups.io/mt/95240507/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-