Skip to content

Commit

Permalink
Platform/ARM/Juno: Use DxeRngLib.inf as default RngLib implementation
Browse files Browse the repository at this point in the history
Juno's RngLib implementation is:
- BaseRngLib.inf if a secure RngLib is enforced
- BaseRngLibTimerLib.inf if a non-secure RngLib is tolerated

BaseRngLib.inf relies on the Arm's RNDR instruction. The instruction
returns a DRBG-generated random number. The DRBG used is considered
as secure.
The RNDR instruction is available if FEAT_RNG is set. The Juno doesn't
support it.

When security is enforced (i.e. ENABLE_UNSAFE_RNGLIB is not set),
the Juno cannot generate secure random numbers through the RngLib.
Secure random numbers could be generated by using the Juno's TRNG.
This can be done by:
- using the RngDxeLib implementation of the RngLib
- RngDxeLib relies on the RngDxe
- the RngDxe has access to the TRNG

Signed-off-by: Pierre Gondois <[email protected]>
  • Loading branch information
pierregondois committed Sep 13, 2024
1 parent 3892eb5 commit f27e204
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions Platform/ARM/JunoPkg/ArmJuno.dsc
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@
# Trng Supports.
ArmMonitorLib|ArmPkg/Library/ArmMonitorLib/ArmMonitorLib.inf
ArmTrngLib|ArmPkg/Library/ArmTrngLib/ArmTrngLib.inf
# Rng
RngLib|MdePkg/Library/DxeRngLib/DxeRngLib.inf

NorFlashDeviceLib|Platform/ARM/Library/P30NorFlashDeviceLib/P30NorFlashDeviceLib.inf
NorFlashPlatformLib|Platform/ARM/JunoPkg/Library/NorFlashJunoLib/NorFlashJunoLib.inf
Expand Down Expand Up @@ -407,6 +409,18 @@
# SCMI Driver
ArmPkg/Drivers/ArmScmiDxe/ArmScmiDxe.inf
#
# Rng
#
SecurityPkg/RandomNumberGenerator/RngDxe/RngDxe.inf {
<LibraryClasses>
!if $(ENABLE_UNSAFE_RNGLIB) == TRUE
RngLib|MdeModulePkg/Library/BaseRngLibTimerLib/BaseRngLibTimerLib.inf
!else
RngLib|MdePkg/Library/BaseRngLib/BaseRngLib.inf
!endif
}
[Components.AARCH64]
#
# EBC
Expand Down

0 comments on commit f27e204

Please sign in to comment.