Re: 回复: [PATCH v9 00/19] Add Raw algorithm support using Arm TRNG interface

Ard Biesheuvel

On Fri, 4 Nov 2022 at 02:16, gaoliming via
<gaoliming@...> wrote:

Sami, Leif, Ard:
Can you give your Reviewed-by for this patch set this week? If so, this
feature can catch stable tag 202211.

Stable202211 tag soft feature freeze will start on next Monday Nov 7th.
I will try to look at this before monday.

发件人: Yao, Jiewen <jiewen.yao@...>
发送时间: 2022年11月1日 16:56
收件人: Pierre.Gondois@...;
抄送: Sami Mujawar <sami.mujawar@...>; Leif Lindholm
<quic_llindhol@...>; Ard Biesheuvel <ardb+tianocore@...>;
Rebecca Cran <rebecca@...>; Kinney, Michael D
<michael.d.kinney@...>; Gao, Liming <gaoliming@...>;
Wang, Jian J <>
主题: RE: [PATCH v9 00/19] Add Raw algorithm support using Arm TRNG

Thanks for the update.

For SecurityPkg (11~18), Acked-by: Jiewen Yao <Jiewen.yao@...>
Since the update is for AARCH64, I recommend to have an ARM people to give

Thank you
Yao Jiewen

-----Original Message-----
From: Pierre.Gondois@... <Pierre.Gondois@...>
Sent: Friday, October 28, 2022 11:33 PM
Cc: Sami Mujawar <sami.mujawar@...>; Leif Lindholm
<quic_llindhol@...>; Ard Biesheuvel
<ardb+tianocore@...>; Rebecca Cran <rebecca@...>;
Michael D <michael.d.kinney@...>; Gao, Liming
<gaoliming@...>; Yao, Jiewen <jiewen.yao@...>; Wang,
Jian J <>
Subject: [PATCH v9 00/19] Add Raw algorithm support using Arm TRNG

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

Bugzilla: Bug 3668 (

The Arm True Random Number Generator Firmware, Interface 1.0,
defines an interface between an Operating System (OS) executing at EL1
Firmware (FW) exposing a conditioned entropy source that is provided by
TRNG back end.
This patch-set:
- defines an Arm TRNG library class that provides an interface to access
the entropy source on a platform.
- implements an Arm TRNG library instance that uses the Arm FW-TRNG
- Adds RawAlgorithm support to RngDxe for Arm architecture using the Arm
TRNG interface.
- Enables RNG support using Arm TRNG interface for Kvmtool Guest/Virtual

This patch-set is based on the v2 from Sami Mujawar:
[PATCH v2 0/8] Add Raw algorithm support using Arm FW-TRNG interface

- Added BaseArmTrngLibNull as default in MdePkg/
- Renamed TrngLib to ArmTrngLib and updated documentation, commit
messages, function names accordingly. [Jiewen, Leif]
- Added Reviewed-by/Acked-by from Leif on ArmPkg/SecurityPkg
patches. [Leif]
- Renamed FID_TRNG_* macros to ARM_SMC_ID_TRNG_*. [Leif]
- Removed Reviewed-by from Leif.
- Remove Sami's Signed-off.
- Added my signed-off on patches authored by Sami. [Leif]
- New patch to make it easier to add new libraries in alphabetical
order: ArmPkg: Sort HVC/SMC section alphbetically in ArmPkg.dsc
- Renmaed ArmHvcNullLib to ArmHvcLibNull. [Leif]
- Added RISCV64 to the list of VALID_ARCHITECTURES for
- Removed unnecessary space in function parameter documentation
('[in, out]'). [Rebecca]
- Updated INF_VERSION to latest spec (1.29) for new libraries.
- Dropped the following patches [Leif]:
- ArmPkg/ArmLib: Add ArmHasRngExt()
- ArmPkg/ArmLib: Add ArmReadIdIsar0() helper
- MdePkg/BaseRngLib: Rename ArmReadIdIsar0() to ArmGetFeatRng()
- Removed references in Trnglib.h to 'Special Publication'
800-90A and 800-90C, and only reference 'Arm True Random
Number Generator Firmware, Interface 1.0' in the Arm
implementation of the TrngLib. [Jiewen]
- Removed dependencies on ArmPkg and dropped patch:
[PATCH v3 12/22] SecurityPkg: Update
- Use a dynamically allocated array to hold available algorithms.
The array is freed in a new UNLOAD_IMAGE function and
allocated in arch specific implementations of
GetAvailableAlgorithms(), available in AArch64/AArch64Algo.c
and Arm/ArmAlgo.c.
- Correctly reference gEfiRngAlgorithmSp80090Ctr256Guid
Guid by copying its address (add missing '&'). [Jiewen]
- Address Leif's comment (moving definitions, optimizations, ...)
- Add ArmMonitorLib to choose Hvc/Smc conduit depending on a Pcd.
- Re-factor some parts of SecurityPkg/RngDxe/ to ease the addition
of new algorithms.
- Add ArmHasRngExt() function to check Arm's FEAT_RNG extension.
- Updates TrngLib definitions to use RETURN_STATUS as the return type
from the interface functions as TrngLib is base type library.
- Drops the patch "MdePkg: Add definition for NULL GUID" as there is
already an equivalent definition provided by gZeroGuid. Thus, the
use of gNullGuid has been replaced with gZeroGuid.

Pierre Gondois (11):
ArmPkg/ArmMonitorLib: Definition for ArmMonitorLib library class
ArmPkg/ArmMonitorLib: Add ArmMonitorLib
ArmPkg: Sort HVC/SMC section alphbetically in ArmPkg.dsc
ArmPkg/ArmHvcLibNull: Add NULL instance of ArmHvcLib
SecurityPkg/RngDxe: Replace Pcd with Sp80090Ctr256Guid
SecurityPkg/RngDxe: Remove ArchGetSupportedRngAlgorithms()
SecurityPkg/RngDxe: Documentation/include/parameter cleanup
SecurityPkg/RngDxe: Check before advertising Cpu Rng algo
SecurityPkg/RngDxe: Add debug warning for NULL
SecurityPkg/RngDxe: Rename AArch64/RngDxe.c
SecurityPkg/RngDxe: Add Arm support of RngDxe

Sami Mujawar (8):
ArmPkg: PCD to select conduit for monitor calls
MdePkg/ArmTrngLib: Definition for Arm TRNG library class interface
MdePkg/ArmTrngLib: Add NULL instance of Arm TRNG Library
ArmPkg: Add FID definitions for Arm TRNG
ArmPkg/ArmTrngLib: Add Arm TRNG library
SecurityPkg/RngDxe: Rename RdRandGenerateEntropy to generic name
SecurityPkg/RngDxe: Add AArch64 RawAlgorithm support through
ArmVirtPkg: Kvmtool: Add RNG support using Arm TRNG interface

ArmPkg/ArmPkg.dec | 12 +-
ArmPkg/ArmPkg.dsc | 5 +-
ArmPkg/Include/IndustryStandard/ArmStdSmc.h | 109 ++++-
ArmPkg/Include/Library/ArmMonitorLib.h | 42 ++
ArmPkg/Library/ArmHvcLibNull/ArmHvcLibNull.c | 29 ++
.../Library/ArmHvcLibNull/ArmHvcLibNull.inf | 22 +
ArmPkg/Library/ArmMonitorLib/ArmMonitorLib.c | 34 ++
.../Library/ArmMonitorLib/ArmMonitorLib.inf | 29 ++
ArmPkg/Library/ArmTrngLib/ArmTrngDefs.h | 50 +++
ArmPkg/Library/ArmTrngLib/ArmTrngLib.c | 388
ArmPkg/Library/ArmTrngLib/ArmTrngLib.inf | 29 ++
ArmVirtPkg/ArmVirtKvmTool.dsc | 10 +
ArmVirtPkg/ArmVirtKvmTool.fdf | 5 +
MdePkg/Include/Library/ArmTrngLib.h | 106 +++++
.../BaseArmTrngLibNull/BaseArmTrngLibNull.c | 121 ++++++
.../BaseArmTrngLibNull/BaseArmTrngLibNull.inf | 30 ++
.../BaseArmTrngLibNull/BaseArmTrngLibNull.uni | 12 +
MdePkg/ | 1 +
MdePkg/MdePkg.dec | 5 +
MdePkg/MdePkg.dsc | 1 +
.../RngDxe/AArch64/AArch64Algo.c | 72 ++++
.../RngDxe/Arm/ArmAlgo.c | 51 +++
.../RngDxe/{AArch64/RngDxe.c => ArmRngDxe.c} | 81 +++-
.../RandomNumberGenerator/RngDxe/ArmTrng.c | 71 ++++
.../RngDxe/Rand/RdRand.c | 14 +-
.../RngDxe/Rand/RdRand.h | 43 --
.../RngDxe/Rand/RngDxe.c | 62 ++-
.../RandomNumberGenerator/RngDxe/RngDxe.c | 90 ++--
.../RandomNumberGenerator/RngDxe/RngDxe.inf | 18 +-
.../RngDxe/RngDxeInternals.h | 71 ++--
SecurityPkg/SecurityPkg.dsc | 5 +-
31 files changed, 1462 insertions(+), 156 deletions(-)
create mode 100644 ArmPkg/Include/Library/ArmMonitorLib.h
create mode 100644 ArmPkg/Library/ArmHvcLibNull/ArmHvcLibNull.c
create mode 100644 ArmPkg/Library/ArmHvcLibNull/ArmHvcLibNull.inf
create mode 100644 ArmPkg/Library/ArmMonitorLib/ArmMonitorLib.c
create mode 100644 ArmPkg/Library/ArmMonitorLib/ArmMonitorLib.inf
create mode 100644 ArmPkg/Library/ArmTrngLib/ArmTrngDefs.h
create mode 100644 ArmPkg/Library/ArmTrngLib/ArmTrngLib.c
create mode 100644 ArmPkg/Library/ArmTrngLib/ArmTrngLib.inf
create mode 100644 MdePkg/Include/Library/ArmTrngLib.h
create mode 100644
create mode 100644
create mode 100644
create mode 100644
create mode 100644
SecurityPkg/RandomNumberGenerator/RngDxe/{AArch64/RngDxe.c =>
ArmRngDxe.c} (64%)
create mode 100644
delete mode 100644


Join { to automatically receive all group messages.