public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [edk2-devel] [edk2-platforms: PATCH] MinPlatformPkg: Fix/Update code design gap.
@ 2023-08-10 10:30 Susovan Mohapatra
  0 siblings, 0 replies; only message in thread
From: Susovan Mohapatra @ 2023-08-10 10:30 UTC (permalink / raw)
  To: devel; +Cc: Chasel Chiu, Nate DeSimone, Isaac Oram, Liming Gao, Eric Dong

https://bugzilla.tianocore.org/show_bug.cgi?id=4461
1. The function GetRandomNumber128() returns a boolean TRUE/FALSE.
   The existing code was getting data in EFI_STATUS.0==FALSE==EFI_SUCCESS
   Updated code to check for the return value before proceeding further.
2. The 'seed' from the GetRandomNumber128() is in bits.
   Changed the copymem to the way it is done in other place in same code.

Cc: Chasel Chiu <chasel.chiu@intel.com>
Cc: Nate DeSimone <nathaniel.l.desimone@intel.com>
Cc: Isaac Oram <isaac.w.oram@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Eric Dong <eric.dong@intel.com>

Signed-off-by: Susovan Mohapatra <susovan.mohapatra@intel.com>
---
 .../PeiDxeTpmPlatformHierarchyLib.c                        | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/Platform/Intel/MinPlatformPkg/Tcg/Library/PeiDxeTpmPlatformHierarchyLib/PeiDxeTpmPlatformHierarchyLib.c b/Platform/Intel/MinPlatformPkg/Tcg/Library/PeiDxeTpmPlatformHierarchyLib/PeiDxeTpmPlatformHierarchyLib.c
index 9812ab99ab..b944c11cec 100644
--- a/Platform/Intel/MinPlatformPkg/Tcg/Library/PeiDxeTpmPlatformHierarchyLib/PeiDxeTpmPlatformHierarchyLib.c
+++ b/Platform/Intel/MinPlatformPkg/Tcg/Library/PeiDxeTpmPlatformHierarchyLib/PeiDxeTpmPlatformHierarchyLib.c
@@ -61,11 +61,10 @@ 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_DEVICE_ERROR;
     }
-    CopyMem (Ptr, Seed, 64);
+    CopyMem (Ptr, Seed, (Length % 64));
 
     BlockCount--;
     Ptr = Ptr + 64;
-- 
2.39.1.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#107690): https://edk2.groups.io/g/devel/message/107690
Mute This Topic: https://groups.io/mt/100663198/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-



^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2023-08-10 13:34 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-08-10 10:30 [edk2-devel] [edk2-platforms: PATCH] MinPlatformPkg: Fix/Update code design gap Susovan Mohapatra

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