]> git.proxmox.com Git - mirror_edk2.git/commitdiff
SecurityPkg/RngDxe: Add debug warning for NULL PcdCpuRngSupportedAlgorithm
authorPierre Gondois <pierre.gondois@arm.com>
Fri, 28 Oct 2022 15:32:56 +0000 (17:32 +0200)
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Sun, 6 Nov 2022 16:32:28 +0000 (16:32 +0000)
PcdCpuRngSupportedAlgorithm should allow to identify the the algorithm
used by the RNDR CPU instruction to generate a random number.
Add a debug warning if the Pcd is not set.

Signed-off-by: Pierre Gondois <pierre.gondois@arm.com>
Acked-by: Jiewen Yao <jiewen.yao@intel.com>
SecurityPkg/RandomNumberGenerator/RngDxe/AArch64/RngDxe.c

index ceddc8f08a45463448f5a69a934afab9f20cdf90..318876d6933042362dd88d40e8fe29ec800318bb 100644 (file)
@@ -67,6 +67,16 @@ GetAvailableAlgorithms (
       sizeof (EFI_RNG_ALGORITHM)\r
       );\r
     mAvailableAlgoArrayCount++;\r
+\r
+    DEBUG_CODE_BEGIN ();\r
+    if (IsZeroGuid (PcdGetPtr (PcdCpuRngSupportedAlgorithm))) {\r
+      DEBUG ((\r
+        DEBUG_WARN,\r
+        "PcdCpuRngSupportedAlgorithm should be a non-zero GUID\n"\r
+        ));\r
+    }\r
+\r
+    DEBUG_CODE_END ();\r
   }\r
 \r
   // Raw algorithm (Trng)\r