}\r
}\r
\r
- // If all the other methods have failed, use the default method from the RngProtocol\r
- Status = mRngProtocol->GetRNG (mRngProtocol, NULL, BufferSize, Buffer);\r
- DEBUG ((DEBUG_INFO, "%a: GetRNG algorithm default - Status = %r\n", __func__, Status));\r
- if (!EFI_ERROR (Status)) {\r
- return Status;\r
+ if (!PcdGetBool (PcdEnforceSecureRngAlgorithms)) {\r
+ // If all the other methods have failed, use the default method from the RngProtocol\r
+ Status = mRngProtocol->GetRNG (mRngProtocol, NULL, BufferSize, Buffer);\r
+ DEBUG ((DEBUG_INFO, "%a: GetRNG algorithm default - Status = %r\n", __func__, Status));\r
+ if (!EFI_ERROR (Status)) {\r
+ return Status;\r
+ }\r
}\r
\r
// If we get to this point, we have failed\r