MdePkg/Rng: Add GetRngGuid() to RngLib
The EFI_RNG_PROTOCOL can use the RngLib. The RngLib has multiple implementations, some of them are unsafe (e.g. BaseRngLibTimerLib). To allow the RngDxe to detect when such implementation is used, add a GetRngGuid() function to the RngLib. Signed-off-by: Pierre Gondois <pierre.gondois@arm.com> Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn> Reviewed-by: Sami Mujawar <sami.mujawar@arm.com> Acked-by: Ard Biesheuvel <ardb@kernel.org> Tested-by: Kun Qin <kun.qin@microsoft.com>
This commit is contained in:
committed by
mergify[bot]
parent
414c0f2089
commit
5443c2dc31
@@ -1,6 +1,7 @@
|
||||
/** @file
|
||||
Provides an implementation of the library class RngLib that uses the Rng protocol.
|
||||
|
||||
Copyright (c) 2023, Arm Limited. All rights reserved.
|
||||
Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
|
||||
@@ -207,3 +208,30 @@ GetRandomNumber128 (
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/**
|
||||
Get a GUID identifying the RNG algorithm implementation.
|
||||
|
||||
@param [out] RngGuid If success, contains the GUID identifying
|
||||
the RNG algorithm implementation.
|
||||
|
||||
@retval EFI_SUCCESS Success.
|
||||
@retval EFI_UNSUPPORTED Not supported.
|
||||
@retval EFI_INVALID_PARAMETER Invalid parameter.
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
GetRngGuid (
|
||||
GUID *RngGuid
|
||||
)
|
||||
{
|
||||
/* It is not possible to know beforehand which Rng algorithm will
|
||||
* be used by this library.
|
||||
* This API is mainly used by RngDxe. RngDxe relies on the RngLib.
|
||||
* The RngLib|DxeRngLib.inf implementation locates and uses an installed
|
||||
* EFI_RNG_PROTOCOL.
|
||||
* It is thus not possible to have both RngDxe and RngLib|DxeRngLib.inf.
|
||||
* and it is ok not to support this API.
|
||||
*/
|
||||
return EFI_UNSUPPORTED;
|
||||
}
|
||||
|
Reference in New Issue
Block a user