Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Platform/ARM/Juno: Use RngDxeLib #202

Merged
merged 3 commits into from
Sep 16, 2024

Conversation

pierregondois
Copy link
Contributor

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

For a same MODELE_TYPE/ARCH LibraryClasses section, multiple
libraries can be defined. E.g.:
[LibraryClasses.AARCH64.DXE_DRIVER]
  ArmTrngLib|ArmPkg/Library/ArmTrngLib/ArmTrngLib.inf
  ArmTrngLib|MdePkg/Library/BaseArmTrngLibNull/BaseArmTrngLibNull.inf

In such case, the latest defined library is used. DSC files can
include other files. MdeLibs.dsc.inc is included after other
.dsc.inc files in some ARM platforms, even though it provides
NULL libraries and only aims to satisfy dependencies.

For the Juno, not having MdeLibs.dsc.inc as the fist included file
leads to overriding the ArmTrngLib with its NULL instance.

Place MdeLibs.dsc.inc as the first file included for all ARM
platforms.

Signed-off-by: Pierre Gondois <[email protected]>
Reflect the deplacement of PcdEnforceSecureRngAlgorithms from the
NetworkPkg to the MdePkg.

Signed-off-by: Pierre Gondois <[email protected]>
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]>
@pierregondois
Copy link
Contributor Author

@samimujawar

@samimujawar samimujawar merged commit dff92b8 into tianocore:master Sep 16, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants