mirror of
https://github.com/acidanthera/audk.git
synced 2025-07-27 07:34:06 +02:00
SecurityPkg/RngDxe: Conditionally install EFI_RNG_PROTOCOL
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.Gondois@arm.com> [ardb: return EFI_REQUEST_UNLOAD_IMAGE instead of an error] Reviewed-by: Ard Biesheuvel <ardb@kernel.org>
This commit is contained in:
parent
bfb574db11
commit
75fb0cfc82
@ -63,6 +63,18 @@ RngDriverEntry (
|
|||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
EFI_HANDLE Handle;
|
EFI_HANDLE Handle;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Get the list of available algorithm.
|
||||||
|
//
|
||||||
|
Status = GetAvailableAlgorithms ();
|
||||||
|
if (EFI_ERROR (Status)) {
|
||||||
|
return Status;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mAvailableAlgoArrayCount == 0) {
|
||||||
|
return EFI_REQUEST_UNLOAD_IMAGE;
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Install UEFI RNG (Random Number Generator) Protocol
|
// Install UEFI RNG (Random Number Generator) Protocol
|
||||||
//
|
//
|
||||||
@ -74,13 +86,10 @@ RngDriverEntry (
|
|||||||
NULL
|
NULL
|
||||||
);
|
);
|
||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
return Status;
|
FreeAvailableAlgorithms ();
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
return Status;
|
||||||
// Get the list of available algorithm.
|
|
||||||
//
|
|
||||||
return GetAvailableAlgorithms ();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user