REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4090
The function GetRandomNumber128 returns a BOOLEAN and not EFI_STATUS. Update the code to correctly handle the BOOLEAN return type. Cc: Jiewen Yao <jiewen....@intel.com> Cc: Jian J Wang <jian.j.w...@intel.com> Signed-off-by: Erik Bjorge <erik.c.bjo...@intel.com> --- .../PeiDxeTpmPlatformHierarchyLib.c | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/SecurityPkg/Library/PeiDxeTpmPlatformHierarchyLib/PeiDxeTpmPlatformHierarchyLib.c b/SecurityPkg/Library/PeiDxeTpmPlatformHierarchyLib/PeiDxeTpmPlatformHierarchyLib.c index b8838766bc..8e3b7ce9fd 100644 --- a/SecurityPkg/Library/PeiDxeTpmPlatformHierarchyLib/PeiDxeTpmPlatformHierarchyLib.c +++ b/SecurityPkg/Library/PeiDxeTpmPlatformHierarchyLib/PeiDxeTpmPlatformHierarchyLib.c @@ -46,12 +46,10 @@ RdRandGenerateEntropy ( OUT UINT8 *Entropy ) { - EFI_STATUS Status; UINTN BlockCount; UINT64 Seed[2]; UINT8 *Ptr; - Status = EFI_NOT_READY; BlockCount = Length / sizeof (Seed); Ptr = (UINT8 *)Entropy; @@ -59,9 +57,8 @@ RdRandGenerateEntropy ( // Generate high-quality seed for DRBG Entropy // while (BlockCount > 0) { - Status = GetRandomNumber128 (Seed); - if (EFI_ERROR (Status)) { - return Status; + if (!GetRandomNumber128 (Seed)) { + return EFI_NOT_READY; } CopyMem (Ptr, Seed, sizeof (Seed)); @@ -73,14 +70,13 @@ RdRandGenerateEntropy ( // // Populate the remained data as request. // - Status = GetRandomNumber128 (Seed); - if (EFI_ERROR (Status)) { - return Status; + if (!GetRandomNumber128 (Seed)) { + return EFI_NOT_READY; } CopyMem (Ptr, Seed, (Length % sizeof (Seed))); - return Status; + return EFI_SUCCESS; } /** -- 2.36.0.windows.1 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#95622): https://edk2.groups.io/g/devel/message/95622 Mute This Topic: https://groups.io/mt/94591739/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-