From 4b3e9d80bedf5909a4ec901425ed9c0a738fc76f Mon Sep 17 00:00:00 2001 From: Pierre Gondois Date: Fri, 28 Oct 2022 17:32:54 +0200 Subject: SecurityPkg/RngDxe: Check before advertising Cpu Rng algo RngGetBytes() relies on the RngLib. The RngLib might use the RNDR instruction if the FEAT_RNG feature is present. RngGetInfo and RngGetRNG both must check that RngGetBytes() is working before advertising/using it. To do so, allocate an array storing the available algorithms. The Rng algorithm at the lowest index will be the default Rng algorithm. The array is shared between RngGetInfo and RngGetRNG. This array is allocated when the driver is loaded, and freed when unloaded. This patch also prevents from having PcdCpuRngSupportedAlgorithm let to a zero GUID, but let the possibility to have no valid Rng algorithm in such case. Signed-off-by: Pierre Gondois Acked-by: Jiewen Yao --- SecurityPkg/RandomNumberGenerator/RngDxe/RngDxe.inf | 1 + 1 file changed, 1 insertion(+) (limited to 'SecurityPkg/RandomNumberGenerator/RngDxe/RngDxe.inf') diff --git a/SecurityPkg/RandomNumberGenerator/RngDxe/RngDxe.inf b/SecurityPkg/RandomNumberGenerator/RngDxe/RngDxe.inf index 60efb5562e..1985dfbb46 100644 --- a/SecurityPkg/RandomNumberGenerator/RngDxe/RngDxe.inf +++ b/SecurityPkg/RandomNumberGenerator/RngDxe/RngDxe.inf @@ -22,6 +22,7 @@ MODULE_TYPE = DXE_DRIVER VERSION_STRING = 1.0 ENTRY_POINT = RngDriverEntry + UNLOAD_IMAGE = RngDriverUnLoad MODULE_UNI_FILE = RngDxe.uni # -- cgit v1.2.3