From: "Kun Qin" <kuqin12@gmail.com>
To: devel@edk2.groups.io
Cc: Jiewen Yao <jiewen.yao@intel.com>,
Jian J Wang <jian.j.wang@intel.com>,
Sami Mujawar <Sami.Mujawar@arm.com>,
Pierre Gondois <pierre.gondois@arm.com>
Subject: [PATCH v1 1/2] SecurityPkg: RngDxe: Unify handling of zero guid
Date: Wed, 28 Jun 2023 13:33:55 -0700 [thread overview]
Message-ID: <20230628203357.2001-2-kuqin12@gmail.com> (raw)
In-Reply-To: <20230628203357.2001-1-kuqin12@gmail.com>
From: Kun Qin <kuqin@microsoft.com>
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4491
The existing logic of initializing `mAvailableAlgoArrayCount` will treat
the zero GUID in `PcdCpuRngSupportedAlgorithm` as a legit case and
increment `mAvailableAlgoArrayCount`, causing the RNG protocol be
published.
However, when the protocol is invoked, any zero GUID will be filtered
out, leaving a possible edge case where the protocol only has a zero GUID
based algorithm and being filtered out will always result in an ASSERT.
This change marked the zero GUID as an issue and will not increment the
counter and thus avoid publishing the protocol completely.
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Jian J Wang <jian.j.wang@intel.com>
Cc: Sami Mujawar <Sami.Mujawar@arm.com>
Cc: Pierre Gondois <pierre.gondois@arm.com>
Signed-off-by: Kun Qin <kuqin@microsoft.com>
---
SecurityPkg/RandomNumberGenerator/RngDxe/AArch64/AArch64Algo.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/SecurityPkg/RandomNumberGenerator/RngDxe/AArch64/AArch64Algo.c b/SecurityPkg/RandomNumberGenerator/RngDxe/AArch64/AArch64Algo.c
index e8be217f8a8c..de279cdadeea 100644
--- a/SecurityPkg/RandomNumberGenerator/RngDxe/AArch64/AArch64Algo.c
+++ b/SecurityPkg/RandomNumberGenerator/RngDxe/AArch64/AArch64Algo.c
@@ -47,15 +47,16 @@ GetAvailableAlgorithms (
);
mAvailableAlgoArrayCount++;
- DEBUG_CODE_BEGIN ();
if (IsZeroGuid (PcdGetPtr (PcdCpuRngSupportedAlgorithm))) {
+ DEBUG_CODE_BEGIN ();
DEBUG ((
DEBUG_WARN,
"PcdCpuRngSupportedAlgorithm should be a non-zero GUID\n"
));
+
+ DEBUG_CODE_END ();
+ mAvailableAlgoArrayCount--;
}
-
- DEBUG_CODE_END ();
}
// Raw algorithm (Trng)
--
2.41.0.windows.1
next prev parent reply other threads:[~2023-06-28 20:34 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-28 20:33 [PATCH v1 0/2] Fixing RngDxe error for ARM/AARCH64 Kun Qin
2023-06-28 20:33 ` Kun Qin [this message]
2023-06-29 10:33 ` [PATCH v1 1/2] SecurityPkg: RngDxe: Unify handling of zero guid Sami Mujawar
2023-06-28 20:33 ` [PATCH v1 2/2] SecurityPkg: RngDxe: Fixing mAvailableAlgoArray allocator Kun Qin
2023-06-29 10:33 ` Sami Mujawar
2023-06-29 6:43 ` [PATCH v1 0/2] Fixing RngDxe error for ARM/AARCH64 PierreGondois
2023-06-29 20:28 ` Kun Qin
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=20230628203357.2001-2-kuqin12@gmail.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