From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from walk.intel-email.com (walk.intel-email.com [101.227.64.242]) by mx.groups.io with SMTP id smtpd.web12.2125.1666746622996399310 for ; Tue, 25 Oct 2022 18:10:25 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@byosoft.com.cn header.s=cloud-union header.b=JE0+SJWt; spf=pass (domain: byosoft.com.cn, ip: 101.227.64.242, mailfrom: gaoliming@byosoft.com.cn) Received: from walk.intel-email.com (localhost [127.0.0.1]) by walk.intel-email.com (Postfix) with ESMTP id 38BE8CD1F6C9 for ; Wed, 26 Oct 2022 09:10:20 +0800 (CST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=byosoft.com.cn; s=cloud-union; t=1666746620; bh=G+KtNqrpj8IlHijkQmpqH3bJ1h8jICnkxx/o4hUzpqE=; h=From:To:Cc:References:In-Reply-To:Subject:Date; b=JE0+SJWtdULqQuPo1Z8/t1Yu/EHirqpXcgOR8hSLlMZAk2gmR9I4KS+KHM5K2JxOk hV8OR5QRCjIirrzrdiSYbwGBW+a/AFofwj//zk5UdYEg7RcLQsdlrqw8r2bq3ph8MA /FRXliV51amoEGGEK+PrCqsdDC2fNZ/sZt9zCgYo= Received: from localhost (localhost [127.0.0.1]) by walk.intel-email.com (Postfix) with ESMTP id 34540CD1F696 for ; Wed, 26 Oct 2022 09:10:20 +0800 (CST) Received: from walk.intel-email.com (localhost [127.0.0.1]) by walk.intel-email.com (Postfix) with ESMTP id 0038FCD1F685 for ; Wed, 26 Oct 2022 09:10:19 +0800 (CST) Authentication-Results: walk.intel-email.com; none Received: from mail.byosoft.com.cn (mail.byosoft.com.cn [58.240.74.242]) by walk.intel-email.com (Postfix) with SMTP id 80981CD1F76D for ; Wed, 26 Oct 2022 09:10:16 +0800 (CST) Received: from DESKTOPS6D0PVI ([58.246.60.130]) (envelope-sender ) by 192.168.6.13 with ESMTP for ; Wed, 26 Oct 2022 09:10:07 +0800 X-WM-Sender: gaoliming@byosoft.com.cn X-Originating-IP: 58.246.60.130 X-WM-AuthFlag: YES X-WM-AuthUser: gaoliming@byosoft.com.cn From: "gaoliming" To: , Cc: "'Sami Mujawar'" , "'Leif Lindholm'" , "'Ard Biesheuvel'" , "'Rebecca Cran'" , "'Michael D Kinney'" , "'Jiewen Yao'" , "'Jian J Wang'" References: <171F2CF84A83B997.20472@groups.io> <158e9c86-8788-bbdd-e1c2-f31499e5382d@arm.com> <030101d8e4ea$59c91460$0d5b3d20$@byosoft.com.cn> <0c7e644b-ac10-a64f-0705-9402f26c245b@arm.com> In-Reply-To: <0c7e644b-ac10-a64f-0705-9402f26c245b@arm.com> Subject: =?UTF-8?B?5Zue5aSNOiDlm57lpI06IFtlZGsyLWRldmVsXSBbUEFUQ0ggdjggMDAvMTldIEFkZCBSYXcgYWxnb3JpdGhtIHN1cHBvcnQgdXNpbmcgQXJtIEZXLVRSTkcgaW50ZXJmYWNl?= Date: Wed, 26 Oct 2022 09:10:08 +0800 Message-ID: <06a701d8e8d7$b0d82e80$12888b80$@byosoft.com.cn> MIME-Version: 1.0 X-Mailer: Microsoft Outlook 16.0 Thread-Index: AQCX5dYZHKrIQSdWSEgxb3MGUXd/LAJot78zAg98JxIBwz5bu7BwBxjA Sender: "gaoliming" Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Content-Language: zh-cn Pierre: > -----=E9=82=AE=E4=BB=B6=E5=8E=9F=E4=BB=B6----- > =E5=8F=91=E4=BB=B6=E4=BA=BA: devel@edk2.groups.io = =E4=BB=A3=E8=A1=A8 > PierreGondois > =E5=8F=91=E9=80=81=E6=97=B6=E9=97=B4: 2022=E5=B9=B410=E6=9C=8821=E6=97=A5= 15:29 > =E6=94=B6=E4=BB=B6=E4=BA=BA: gaoliming ; devel@= edk2.groups.io > =E6=8A=84=E9=80=81: 'Sami Mujawar' ; 'Leif Lindholm= ' > ; 'Ard Biesheuvel' = ; > 'Rebecca Cran' ; 'Michael D Kinney' > ; 'Jiewen Yao' ; 'Jian = J > Wang' > =E4=B8=BB=E9=A2=98: Re: =E5=9B=9E=E5=A4=8D: [edk2-devel] [PATCH v8 00/19]= Add Raw algorithm support > using Arm FW-TRNG interface >=20 > Hello Liming, >=20 > On 10/21/22 03:13, gaoliming wrote: > > Pierre: > > Is MdePkg BaseTrngLibNull Library instance only for build? > > > > Is it possible to be used in the platform without RNG support? If ye= s, I > suggest to remove ASSERT in API implementation. >=20 > The BaseTrngLibNull is only here to have a default Null library when buil= ding > the MdePkg (TrngLib.h is in the MdePkg). I don't think it would be possib= le to > use the Null implementation on a platform. >=20 > > > > Last, I suggest to add BaseTrngLibNull as the default TrngLib librar= y > instance in MdePkg/MdeLibs.dsc.inc. >=20 > This would mean building the BaseTrngLibNull for many packages that don't > require it. If this is ok for you I can move it there. >=20 [Liming] BaseTrngLibNull will be built when it is consumed by the module. If the package has no module to consume TrngLib, BaseTrngLibNull will not b= e built.=20 With this change, if the platform doesn't use the real TrngLib, they don't = specify TrngLib library instance in their DSC file.=20 > Thanks for the review, > Pierre >=20 > > > > Thanks > > Liming > >> -----=E9=82=AE=E4=BB=B6=E5=8E=9F=E4=BB=B6----- > >> =E5=8F=91=E4=BB=B6=E4=BA=BA: Pierre Gondois > >> =E5=8F=91=E9=80=81=E6=97=B6=E9=97=B4: 2022=E5=B9=B410=E6=9C=8819=E6=97= =A5 22:46 > >> =E6=94=B6=E4=BB=B6=E4=BA=BA: devel@edk2.groups.io > >> =E6=8A=84=E9=80=81: Sami Mujawar ; Leif Lindholm > >> ; Ard Biesheuvel > ; > >> Rebecca Cran ; Michael D Kinney > >> ; Liming Gao ; > >> Jiewen Yao ; Jian J Wang > >> =E4=B8=BB=E9=A2=98: Re: [edk2-devel] [PATCH v8 00/19] Add Raw algorith= m support using > >> Arm FW-TRNG interface > >> > >> Hello, > >> I finally found back the message from Liming on the v4: > >> https://edk2.groups.io/g/devel/message/91800 > >> > >> There has been some changes to the patches affecting the MdePkg, > >> but it should not be significant changes: > >> - Renamed FID_TRNG_* macros to ARM_SMC_ID_TRNG_*. > >> - Added RISCV64 to the list of VALID_ARCHITECTURES for BaseTrngLibNull > >> - Dropped patch: '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. > >> > >> Liming's Rb is not currently added to the MdePkg patches. > >> > >> Regards, > >> Pierre > >> > >> On 10/18/22 15:20, PierreGondois via groups.io wrote: > >>> From: Pierre Gondois > >>> > >>> Bugzilla: Bug 3668 (https://bugzilla.tianocore.org/show_bug.cgi?id=3D= 3668) > >>> > >>> The Arm True Random Number Generator Firmware, Interface 1.0, > >> specification > >>> defines an interface between an Operating System (OS) executing at EL= 1 > >> and > >>> Firmware (FW) exposing a conditioned entropy source that is provided = by > a > >>> TRNG back end. > >>> This patch-set: > >>> - defines a TRNG library class that provides an interface to access t= he > >>> entropy source on a platform. > >>> - implements a TRNG library instance that uses the Arm FW-TRNG > >> interface. > >>> - Adds RawAlgorithm support to RngDxe for Arm architecture using the > Arm > >>> FW-TRNG interface. > >>> - Enables RNG support using FW-TRNG interface for Kvmtool > Guest/Virtual > >>> firmware. > >>> > >>> This patch-set is based on the v2 from Sami Mujawar: > >>> [PATCH v2 0/8] Add Raw algorithm support using Arm FW-TRNG interface > >>> v2: > >>> https://edk2.groups.io/g/devel/message/83775 > >>> v3: > >>> https://edk2.groups.io/g/devel/message/90845 > >>> https://github.com/PierreARM/edk2/tree/Arm_Trng_v3 > >>> v4: > >>> https://github.com/PierreARM/edk2/tree/Arm_Trng_v4 > >>> v5: > >>> https://github.com/PierreARM/edk2/tree/Arm_Trng_v5 > >>> v6: > >>> https://github.com/PierreARM/edk2/tree/Arm_Trng_v6 > >>> v7: > >>> https://github.com/PierreARM/edk2/tree/Arm_Trng_v7 > >>> v8: > >>> https://github.com/PierreARM/edk2/tree/Arm_Trng_v8 > >>> > >>> v8: > >>> - Added Reviewed-by/Acked-by from Leif on ArmPkg/SecurityPkg > >>> patches. [Leif] > >>> - Renamed FID_TRNG_* macros to ARM_SMC_ID_TRNG_*. [Leif] > >>> v7: > >>> - Removed Reviewed-by from Leif. > >>> - Remove Sami's Signed-off. > >>> V6: > >>> - 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 > >> [Leif] > >>> - Renmaed ArmHvcNullLib to ArmHvcLibNull. [Leif] > >>> - Added RISCV64 to the list of VALID_ARCHITECTURES for > >> BaseTrngLibNull. [Leif] > >>> - Removed unnecessary space in function parameter documentation > >>> ('[in, out]'). [Rebecca] > >>> - Updated INF_VERSION to latest spec (1.29) for new libraries. > [Rebecca] > >>> - Dropped the following patches [Leif]: > >>> - ArmPkg/ArmLib: Add ArmHasRngExt() > >>> - ArmPkg/ArmLib: Add ArmReadIdIsar0() helper > >>> - MdePkg/BaseRngLib: Rename ArmReadIdIsar0() to > ArmGetFeatRng() > >>> V5: > >>> - 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] > >>> V4: > >>> - Removed dependencies on ArmPkg and dropped patch: > >>> [PATCH v3 12/22] SecurityPkg: Update Securitypkg.ci.yaml > >>> [Jiewen] > >>> - 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] > >>> V3: > >>> - 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. > >>> V2: > >>> - 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, th= e > >>> 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 > >>> PcdCpuRngSupportedAlgorithm > >>> 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/TrngLib: Definition for TRNG library class interface > >>> MdePkg/TrngLib: Add NULL instance of TRNG Library > >>> ArmPkg: Add FID definitions for Firmware TRNG > >>> ArmPkg/TrngLib: Add Arm Firmware TRNG library > >>> SecurityPkg/RngDxe: Rename RdRandGenerateEntropy to generic > >> name > >>> SecurityPkg/RngDxe: Add AArch64 RawAlgorithm support through > >> TrngLib > >>> ArmVirtPkg: Kvmtool: Add RNG support using FW-TRNG interface > >>> > >>> ArmPkg/ArmPkg.dec | 12 +- > >>> ArmPkg/ArmPkg.dsc | 5 +- > >>> ArmPkg/Include/IndustryStandard/ArmStdSmc.h | 109 ++++- > >>> ArmPkg/Include/Library/ArmMonitorLib.h | 42 ++ > >>> ArmPkg/Library/ArmFwTrngLib/ArmFwTrngDefs.h | 50 +++ > >>> ArmPkg/Library/ArmFwTrngLib/ArmFwTrngLib.c | 388 > >> ++++++++++++++++++ > >>> ArmPkg/Library/ArmFwTrngLib/ArmFwTrngLib.inf | 29 ++ > >>> ArmPkg/Library/ArmHvcLibNull/ArmHvcLibNull.c | 29 ++ > >>> .../Library/ArmHvcLibNull/ArmHvcLibNull.inf | 22 + > >>> ArmPkg/Library/ArmMonitorLib/ArmMonitorLib.c | 34 ++ > >>> .../Library/ArmMonitorLib/ArmMonitorLib.inf | 29 ++ > >>> ArmVirtPkg/ArmVirtKvmTool.dsc | 10 + > >>> ArmVirtPkg/ArmVirtKvmTool.fdf | 5 + > >>> MdePkg/Include/Library/TrngLib.h | 103 +++++ > >>> .../Library/BaseTrngLibNull/BaseTrngLibNull.c | 117 ++++++ > >>> .../BaseTrngLibNull/BaseTrngLibNull.inf | 30 ++ > >>> .../BaseTrngLibNull/BaseTrngLibNull.uni | 12 + > >>> MdePkg/MdePkg.dec | 5 + > >>> MdePkg/MdePkg.dsc | 1 + > >>> .../RngDxe/AArch64/AArch64Algo.c | 72 ++++ > >>> .../RngDxe/Arm/ArmAlgo.c | 51 +++ > >>> .../RngDxe/{AArch64/RngDxe.c =3D> 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 +- > >>> 30 files changed, 1454 insertions(+), 156 deletions(-) > >>> create mode 100644 ArmPkg/Include/Library/ArmMonitorLib.h > >>> create mode 100644 > ArmPkg/Library/ArmFwTrngLib/ArmFwTrngDefs.h > >>> create mode 100644 ArmPkg/Library/ArmFwTrngLib/ArmFwTrngLib.c > >>> create mode 100644 > ArmPkg/Library/ArmFwTrngLib/ArmFwTrngLib.inf > >>> 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 MdePkg/Include/Library/TrngLib.h > >>> create mode 100644 > >> MdePkg/Library/BaseTrngLibNull/BaseTrngLibNull.c > >>> create mode 100644 > >> MdePkg/Library/BaseTrngLibNull/BaseTrngLibNull.inf > >>> create mode 100644 > >> MdePkg/Library/BaseTrngLibNull/BaseTrngLibNull.uni > >>> create mode 100644 > >> SecurityPkg/RandomNumberGenerator/RngDxe/AArch64/AArch64Algo.c > >>> create mode 100644 > >> SecurityPkg/RandomNumberGenerator/RngDxe/Arm/ArmAlgo.c > >>> rename > >> SecurityPkg/RandomNumberGenerator/RngDxe/{AArch64/RngDxe.c =3D> > >> ArmRngDxe.c} (64%) > >>> create mode 100644 > >> SecurityPkg/RandomNumberGenerator/RngDxe/ArmTrng.c > >>> delete mode 100644 > >> SecurityPkg/RandomNumberGenerator/RngDxe/Rand/RdRand.h > >>> > > > > >=20 >=20 >=20 >=20