summaryrefslogtreecommitdiffstats
path: root/MdePkg/Library/DxeRngLib/DxeRngLib.c
diff options
context:
space:
mode:
Diffstat (limited to 'MdePkg/Library/DxeRngLib/DxeRngLib.c')
-rw-r--r--MdePkg/Library/DxeRngLib/DxeRngLib.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/MdePkg/Library/DxeRngLib/DxeRngLib.c b/MdePkg/Library/DxeRngLib/DxeRngLib.c
index 4b4efef0b4..17c932d802 100644
--- a/MdePkg/Library/DxeRngLib/DxeRngLib.c
+++ b/MdePkg/Library/DxeRngLib/DxeRngLib.c
@@ -197,11 +197,13 @@ GenerateRandomNumberViaNist800Algorithm (
}
}
- // If all the other methods have failed, use the default method from the RngProtocol
- Status = mRngProtocol->GetRNG (mRngProtocol, NULL, BufferSize, Buffer);
- DEBUG ((DEBUG_INFO, "%a: GetRNG algorithm default - Status = %r\n", __func__, Status));
- if (!EFI_ERROR (Status)) {
- return Status;
+ if (!PcdGetBool (PcdEnforceSecureRngAlgorithms)) {
+ // If all the other methods have failed, use the default method from the RngProtocol
+ Status = mRngProtocol->GetRNG (mRngProtocol, NULL, BufferSize, Buffer);
+ DEBUG ((DEBUG_INFO, "%a: GetRNG algorithm default - Status = %r\n", __func__, Status));
+ if (!EFI_ERROR (Status)) {
+ return Status;
+ }
}
// If we get to this point, we have failed