Skip to content

Commit

Permalink
MdePkg/DxeRngLib: Add gEfiRngAlgorithmArmRndr to the secure algorithms
Browse files Browse the repository at this point in the history
DxeRngLib iterates over a list of secure algorithms before trying
to use the default algorithm provided by the Rng protocol. Add
gEfiRngAlgorithmArmRndr to this list. The algorithm represented by
this GUID is a secure DRBG of an unknown type, implemented by the
aarch64 RNDR instruction.
On AARCH64 platform, use the RNDR instruction as the first option
if it is available.

Signed-off-by: Pierre Gondois <[email protected]>
  • Loading branch information
pierregondois committed Sep 13, 2024
1 parent 9ee1e9a commit 066da6b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
7 changes: 7 additions & 0 deletions MdePkg/Library/DxeRngLib/DxeRngLib.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,13 @@ typedef struct {
// the RNG protocol and are generally considered secure.
//
GLOBAL_REMOVE_IF_UNREFERENCED SECURE_RNG_ALGO_ARRAY mSecureHashAlgorithms[] = {
#ifdef MDE_CPU_AARCH64
{
&gEfiRngAlgorithmArmRndr, // unspecified SP800-90A DRBG (through RNDR instr.)
"ARM-RNDR",
FALSE,
},
#endif
{
&gEfiRngAlgorithmSp80090Ctr256Guid, // SP800-90A DRBG CTR using AES-256
"DRBG-CTR",
Expand Down
3 changes: 3 additions & 0 deletions MdePkg/Library/DxeRngLib/DxeRngLib.inf
Original file line number Diff line number Diff line change
Expand Up @@ -40,5 +40,8 @@
gEfiRngAlgorithmSp80090Hmac256Guid
gEfiRngAlgorithmRaw

[Guids.AARCH64]
gEfiRngAlgorithmArmRndr

[FixedPcd]
gEfiMdePkgTokenSpaceGuid.PcdEnforceSecureRngAlgorithms ## CONSUMES

0 comments on commit 066da6b

Please sign in to comment.