mirror of
https://github.com/acidanthera/audk.git
synced 2025-07-23 13:44:33 +02:00
MdePkg/DxeRngLib: Use PcdEnforceSecureRngAlgorithms for default algorithm
Use PcdEnforceSecureRngAlgorithms to allow using the Rng protocol with the default algorithm. All previous call to the Rng protocol are requesting a secure Rng algorithm. Not specifying the Rng algorithm GUID to use is considered unsecure. Signed-off-by: Pierre Gondois <pierre.gondois@arm.com>
This commit is contained in:
parent
c04c4534c4
commit
5ed8f64647
@ -197,12 +197,14 @@ GenerateRandomNumberViaNist800Algorithm (
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!PcdGetBool (PcdEnforceSecureRngAlgorithms)) {
|
||||||
// If all the other methods have failed, use the default method from the RngProtocol
|
// If all the other methods have failed, use the default method from the RngProtocol
|
||||||
Status = mRngProtocol->GetRNG (mRngProtocol, NULL, BufferSize, Buffer);
|
Status = mRngProtocol->GetRNG (mRngProtocol, NULL, BufferSize, Buffer);
|
||||||
DEBUG ((DEBUG_INFO, "%a: GetRNG algorithm default - Status = %r\n", __func__, Status));
|
DEBUG ((DEBUG_INFO, "%a: GetRNG algorithm default - Status = %r\n", __func__, Status));
|
||||||
if (!EFI_ERROR (Status)) {
|
if (!EFI_ERROR (Status)) {
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// If we get to this point, we have failed
|
// If we get to this point, we have failed
|
||||||
DEBUG ((DEBUG_ERROR, "%a: GetRNG() failed, Status = %r\n", __func__, Status));
|
DEBUG ((DEBUG_ERROR, "%a: GetRNG() failed, Status = %r\n", __func__, Status));
|
||||||
|
@ -39,3 +39,6 @@
|
|||||||
gEfiRngAlgorithmSp80090Hash256Guid
|
gEfiRngAlgorithmSp80090Hash256Guid
|
||||||
gEfiRngAlgorithmSp80090Hmac256Guid
|
gEfiRngAlgorithmSp80090Hmac256Guid
|
||||||
gEfiRngAlgorithmRaw
|
gEfiRngAlgorithmRaw
|
||||||
|
|
||||||
|
[FixedPcd]
|
||||||
|
gEfiMdePkgTokenSpaceGuid.PcdEnforceSecureRngAlgorithms ## CONSUMES
|
||||||
|
Loading…
x
Reference in New Issue
Block a user