From: Susovan Mohapatra <susovan.mohapatra@intel.com>
To: devel@edk2.groups.io
Cc: Chasel Chiu <chasel.chiu@intel.com>,
Nate DeSimone <nathaniel.l.desimone@intel.com>,
Isaac Oram <isaac.w.oram@intel.com>,
Liming Gao <gaoliming@byosoft.com.cn>,
Eric Dong <eric.dong@intel.com>
Subject: [edk2-devel] [PATCH v2] MinPlatformPkg: Fix/Update code design gap.
Date: Thu, 5 Oct 2023 17:51:05 +0530 [thread overview]
Message-ID: <6fe43ef6050a2891bb6c77648f0ecc93810d1b82.1696504657.git.susovan.mohapatra@intel.com> (raw)
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 | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
diff --git a/Platform/Intel/MinPlatformPkg/Tcg/Library/PeiDxeTpmPlatformHierarchyLib/PeiDxeTpmPlatformHierarchyLib.c b/Platform/Intel/MinPlatformPkg/Tcg/Library/PeiDxeTpmPlatformHierarchyLib/PeiDxeTpmPlatformHierarchyLib.c
index 9812ab99ab..0c18c74028 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;
@@ -78,7 +77,7 @@ RdRandGenerateEntropy (
if (EFI_ERROR (Status)) {
return Status;
}
- CopyMem (Ptr, Seed, (Length % 64));
+ CopyMem (Ptr, Seed, 64);
return Status;
}
--
2.26.2.windows.1
-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#109362): https://edk2.groups.io/g/devel/message/109362
Mute This Topic: https://groups.io/mt/101792759/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-
reply other threads:[~2023-10-06 6:58 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-list from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=6fe43ef6050a2891bb6c77648f0ecc93810d1b82.1696504657.git.susovan.mohapatra@intel.com \
--to=devel@edk2.groups.io \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox