public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH v3 0/6] SecurityPkg/MdePkg: Update RngLib GUID identification
@ 2023-07-06  8:51 PierreGondois
  2023-07-06  8:51 ` [PATCH v3 1/6] SecurityPkg/SecurityPkg.dec: Move PcdCpuRngSupportedAlgorithm to MdePkg PierreGondois
                   ` (7 more replies)
  0 siblings, 8 replies; 20+ messages in thread
From: PierreGondois @ 2023-07-06  8:51 UTC (permalink / raw)
  To: devel
  Cc: Michael D Kinney, Liming Gao, Zhiguang Liu, Jiewen Yao,
	Jian J Wang, Ard Biesheuvel, Sami Mujawar, Jose Marinho, Kun Qin

From: Pierre Gondois <pierre.gondois@arm.com>

v3:
- As the unsafe algorithm GUID will not be added to the UEFI
  specification, rename:
  - gEfiRngAlgorithmUnSafe to gEdkiiRngAlgorithmUnSafe
  - EFI_RNG_ALGORITHM_UNSAFE to EDKII_RNG_ALGORITHM_UNSAFE

v2:
[1/8] MdePkg/ArmTrngLib: Remove ASSERTs in Null implementation
- Dropped
[2/8] MdePkg/MdePkg.dec: Move PcdCpuRngSupportedAlgorithm to MdePkg
- Change gEfiMdePkgTokenSpaceGuid.PcdCpuRngSupportedAlgorithm
  token number
- Rename to SecurityPkg/SecurityPkg.dec: Move
  PcdCpuRngSupportedAlgorithm to MdePkg
[5/8] MdePkg/Rng: Add GetRngGuid() to RngLib
- Remove gEfiRngAlgorithmUnSafe from inf file
- Split Guids definitions in arch specific sections
[6/8] SecurityPkg/RngDxe: Use GetRngGuid() when probing RngLib
- Remove RngFindDefaultAlgo() and change logic accordingly.
[7/8] SecurityPkg/RngDxe: Select safe default Rng algorithm
- Dropped due to changes in [6/8]

This patch also requires the following patch on top of the serie:
- https://edk2.groups.io/g/devel/message/106546

This patchset follows the 'code first' approach and relates to [1].
This patchset follows the thread at [3] that aims to solve [2].
[1] and [2] are bound and this patchset aims to solve both.

In this patchset:
a-
The RngDxe can rely on the RngLib. However the RngLib has no
interface allowing to describe which Rng algorithm is implemented.
The RngDxe must advertise the algorithm that are available through
the RngGetInfo() callback.
Add a GetRngGuid() for interface to the RngLib.

b-
The Arm Architecture states the RNDR that the DRBG algorithm should
be compliant with NIST SP800-90A, while not mandating a particular
algorithm, so as to be inclusive of different geographies.
The RngLib can rely on this Arm RNDR instruction. In order to
accurately describe the implementation using the RNDR instruction,
add a EFI_RNG_ALGORITHM_ARM_RNDR GUID [1].

c-
For the same reason as a/b, add a GUID describing unsafe RNG
algorithms, allowing to accurately describe the BaseRngLibTimerLib.

d-
Use a/b/c mechanisms/GUIDs to select a safe Rng algorithm in the
Arm implementation of the RngDxe.

[1] BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=4441
[2] BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=4151
[3] https://edk2.groups.io/g/devel/message/100806

Pierre Gondois (6):
  SecurityPkg/SecurityPkg.dec: Move PcdCpuRngSupportedAlgorithm to
    MdePkg
  MdePkg/DxeRngLib: Request raw algorithm instead of default
  MdePkg/Rng: Add GUIDs to describe Rng algorithms
  MdePkg/Rng: Add GetRngGuid() to RngLib
  SecurityPkg/RngDxe: Use GetRngGuid() when probing RngLib
  SecurityPkg/RngDxe: Simplify Rng algorithm selection for Arm

 MdePkg/Include/Library/RngLib.h               | 17 ++++++
 MdePkg/Include/Protocol/Rng.h                 | 20 +++++++
 MdePkg/Library/BaseRngLib/AArch64/Rndr.c      | 42 +++++++++++++++
 MdePkg/Library/BaseRngLib/BaseRngLib.inf      | 10 ++++
 MdePkg/Library/BaseRngLib/Rand/RdRand.c       | 26 +++++++++
 .../Library/BaseRngLibNull/BaseRngLibNull.c   | 22 ++++++++
 .../BaseRngLibTimerLib/BaseRngLibTimerLib.inf |  3 ++
 .../Library/BaseRngLibTimerLib/RngLibTimer.c  | 28 ++++++++++
 MdePkg/Library/DxeRngLib/DxeRngLib.c          | 36 ++++++++++++-
 MdePkg/MdePkg.dec                             |  7 +++
 .../RngDxe/AArch64/AArch64Algo.c              | 54 +++++++++++++------
 .../RandomNumberGenerator/RngDxe/ArmRngDxe.c  | 23 ++++----
 .../RandomNumberGenerator/RngDxe/RngDxe.inf   |  5 +-
 SecurityPkg/SecurityPkg.dec                   |  2 -
 14 files changed, 258 insertions(+), 37 deletions(-)

-- 
2.25.1


^ permalink raw reply	[flat|nested] 20+ messages in thread

end of thread, other threads:[~2023-07-12 13:38 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-07-06  8:51 [PATCH v3 0/6] SecurityPkg/MdePkg: Update RngLib GUID identification PierreGondois
2023-07-06  8:51 ` [PATCH v3 1/6] SecurityPkg/SecurityPkg.dec: Move PcdCpuRngSupportedAlgorithm to MdePkg PierreGondois
2023-07-06  8:51 ` [PATCH v3 2/6] MdePkg/DxeRngLib: Request raw algorithm instead of default PierreGondois
2023-07-06  8:51 ` [PATCH v3 3/6] MdePkg/Rng: Add GUIDs to describe Rng algorithms PierreGondois
2023-07-07  9:14   ` [edk2-devel] " Yao, Jiewen
2023-07-07 12:49     ` PierreGondois
2023-07-07 12:56       ` Yao, Jiewen
     [not found]       ` <176F972B57840483.2683@groups.io>
2023-07-07 13:05         ` Yao, Jiewen
2023-07-07 14:25           ` PierreGondois
2023-07-07 14:28             ` Yao, Jiewen
     [not found]             ` <176F9C2F554052EE.2683@groups.io>
2023-07-07 14:34               ` Yao, Jiewen
2023-07-10  1:26                 ` 回复: " gaoliming
2023-07-11 12:23                   ` PierreGondois
2023-07-06  8:51 ` [PATCH v3 4/6] MdePkg/Rng: Add GetRngGuid() to RngLib PierreGondois
2023-07-06  8:51 ` [PATCH v3 5/6] SecurityPkg/RngDxe: Use GetRngGuid() when probing RngLib PierreGondois
2023-07-07  8:07   ` Sami Mujawar
2023-07-06  8:51 ` [PATCH v3 6/6] SecurityPkg/RngDxe: Simplify Rng algorithm selection for Arm PierreGondois
2023-07-06 19:01 ` [PATCH v3 0/6] SecurityPkg/MdePkg: Update RngLib GUID identification Kun Qin
2023-07-12 13:38   ` PierreGondois
2023-07-07  8:26 ` Sami Mujawar

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox