[edk2-devel] [PATCH v3 14/22] SecurityPkg/RngDxe: Replace Pcd with Sp80090Ctr256Guid

PierreGondois posted 22 patches 3 years, 7 months ago
There is a newer version of this series
[edk2-devel] [PATCH v3 14/22] SecurityPkg/RngDxe: Replace Pcd with Sp80090Ctr256Guid
Posted by PierreGondois 3 years, 7 months ago
From: Pierre Gondois <pierre.gondois@arm.com>

gEfiRngAlgorithmSp80090Ctr256Guid was used as the default algorithm
in RngGetRNG(). The commit below set the default algorithm to
PcdCpuRngSupportedAlgorithm, which is a zero GUID by default.

As the Pcd value is not defined for any platform in the edk2-platfoms
repository, assume it was an error and go back to the first version,
using gEfiRngAlgorithmSp80090Ctr256Guid.

Fixes 4e5ecdbac8bd ("SecurityPkg: Add support for RngDxe on AARCH64")
Signed-off-by: Pierre Gondois <Pierre.Gondois@arm.com>
---
 SecurityPkg/RandomNumberGenerator/RngDxe/Rand/RngDxe.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/SecurityPkg/RandomNumberGenerator/RngDxe/Rand/RngDxe.c b/SecurityPkg/RandomNumberGenerator/RngDxe/Rand/RngDxe.c
index 8d44f0636c3d..8cfe6b471192 100644
--- a/SecurityPkg/RandomNumberGenerator/RngDxe/Rand/RngDxe.c
+++ b/SecurityPkg/RandomNumberGenerator/RngDxe/Rand/RngDxe.c
@@ -126,8 +126,7 @@ ArchGetSupportedRngAlgorithms (
   OUT    EFI_RNG_ALGORITHM  *RNGAlgorithmList
   )
 {
-  UINTN              RequiredSize;
-  EFI_RNG_ALGORITHM  *CpuRngSupportedAlgorithm;
+  UINTN  RequiredSize;
 
   RequiredSize = 2 * sizeof (EFI_RNG_ALGORITHM);
 
@@ -136,9 +135,7 @@ ArchGetSupportedRngAlgorithms (
     return EFI_BUFFER_TOO_SMALL;
   }
 
-  CpuRngSupportedAlgorithm = PcdGetPtr (PcdCpuRngSupportedAlgorithm);
-
-  CopyMem (&RNGAlgorithmList[0], CpuRngSupportedAlgorithm, sizeof (EFI_RNG_ALGORITHM));
+  CopyMem (&RNGAlgorithmList[0], gEfiRngAlgorithmSp80090Ctr256Guid, sizeof (EFI_RNG_ALGORITHM));
 
   // x86 platforms also support EFI_RNG_ALGORITHM_RAW via RDSEED
   CopyMem (&RNGAlgorithmList[1], &gEfiRngAlgorithmRaw, sizeof (EFI_RNG_ALGORITHM));
-- 
2.25.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#90862): https://edk2.groups.io/g/devel/message/90862
Mute This Topic: https://groups.io/mt/92066746/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-
Re: [edk2-devel] [PATCH v3 14/22] SecurityPkg/RngDxe: Replace Pcd with Sp80090Ctr256Guid
Posted by Yao, Jiewen 3 years, 6 months ago
+  CopyMem (&RNGAlgorithmList[0], gEfiRngAlgorithmSp80090Ctr256Guid, sizeof (EFI_RNG_ALGORITHM));

Should it be &gEfiRngAlgorithmSp80090Ctr256Guid ? The dereference is missing.

Thank you
Yao Jiewen



> -----Original Message-----
> From: Pierre.Gondois@arm.com <Pierre.Gondois@arm.com>
> Sent: Wednesday, June 29, 2022 11:02 PM
> To: devel@edk2.groups.io
> Cc: Sami Mujawar <sami.mujawar@arm.com>; Leif Lindholm
> <quic_llindhol@quicinc.com>; Ard Biesheuvel <ardb+tianocore@kernel.org>;
> Rebecca Cran <rebecca@bsdio.com>; Kinney, Michael D
> <michael.d.kinney@intel.com>; Gao, Liming <gaoliming@byosoft.com.cn>; Yao,
> Jiewen <jiewen.yao@intel.com>; Wang, Jian J <jian.j.wang@intel.com>
> Subject: [PATCH v3 14/22] SecurityPkg/RngDxe: Replace Pcd with
> Sp80090Ctr256Guid
> 
> From: Pierre Gondois <pierre.gondois@arm.com>
> 
> gEfiRngAlgorithmSp80090Ctr256Guid was used as the default algorithm
> in RngGetRNG(). The commit below set the default algorithm to
> PcdCpuRngSupportedAlgorithm, which is a zero GUID by default.
> 
> As the Pcd value is not defined for any platform in the edk2-platfoms
> repository, assume it was an error and go back to the first version,
> using gEfiRngAlgorithmSp80090Ctr256Guid.
> 
> Fixes 4e5ecdbac8bd ("SecurityPkg: Add support for RngDxe on AARCH64")
> Signed-off-by: Pierre Gondois <Pierre.Gondois@arm.com>
> ---
>  SecurityPkg/RandomNumberGenerator/RngDxe/Rand/RngDxe.c | 7 ++-----
>  1 file changed, 2 insertions(+), 5 deletions(-)
> 
> diff --git a/SecurityPkg/RandomNumberGenerator/RngDxe/Rand/RngDxe.c
> b/SecurityPkg/RandomNumberGenerator/RngDxe/Rand/RngDxe.c
> index 8d44f0636c3d..8cfe6b471192 100644
> --- a/SecurityPkg/RandomNumberGenerator/RngDxe/Rand/RngDxe.c
> +++ b/SecurityPkg/RandomNumberGenerator/RngDxe/Rand/RngDxe.c
> @@ -126,8 +126,7 @@ ArchGetSupportedRngAlgorithms (
>    OUT    EFI_RNG_ALGORITHM  *RNGAlgorithmList
>    )
>  {
> -  UINTN              RequiredSize;
> -  EFI_RNG_ALGORITHM  *CpuRngSupportedAlgorithm;
> +  UINTN  RequiredSize;
> 
>    RequiredSize = 2 * sizeof (EFI_RNG_ALGORITHM);
> 
> @@ -136,9 +135,7 @@ ArchGetSupportedRngAlgorithms (
>      return EFI_BUFFER_TOO_SMALL;
>    }
> 
> -  CpuRngSupportedAlgorithm = PcdGetPtr (PcdCpuRngSupportedAlgorithm);
> -
> -  CopyMem (&RNGAlgorithmList[0], CpuRngSupportedAlgorithm, sizeof
> (EFI_RNG_ALGORITHM));
> +  CopyMem (&RNGAlgorithmList[0], gEfiRngAlgorithmSp80090Ctr256Guid,
> sizeof (EFI_RNG_ALGORITHM));
> 
>    // x86 platforms also support EFI_RNG_ALGORITHM_RAW via RDSEED
>    CopyMem (&RNGAlgorithmList[1], &gEfiRngAlgorithmRaw, sizeof
> (EFI_RNG_ALGORITHM));
> --
> 2.25.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#91633): https://edk2.groups.io/g/devel/message/91633
Mute This Topic: https://groups.io/mt/92066746/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-