Fix invalid parameter case according to the UEFI spec 2.9,
section 37.5 EFI_RNG_PROTOCOL.GetRNG. The spec said,
"RNGValue is null or RNGValueLength is zero." instead of
"RNGValue is NULL and RNGValueLength is non-zero."
This fixes the mOpteeRng::GetRNG() to check the invalid
parameter case correctly.
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Masami Hiramatsu <masami.hiramatsu@linaro.org>
Reported-by: Kazuhiko Sakamoto <sakamoto.kazuhiko@socionext.com>
---
Changes in v2:
- Update changelog.
---
.../SynQuacer/Drivers/OpteeRngDxe/OpteeRng.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/Silicon/Socionext/SynQuacer/Drivers/OpteeRngDxe/OpteeRng.c b/Silicon/Socionext/SynQuacer/Drivers/OpteeRngDxe/OpteeRng.c
index 51c15b1b94..333a3e625c 100644
--- a/Silicon/Socionext/SynQuacer/Drivers/OpteeRngDxe/OpteeRng.c
+++ b/Silicon/Socionext/SynQuacer/Drivers/OpteeRngDxe/OpteeRng.c
@@ -98,8 +98,7 @@ GetInfo (
@retval EFI_NOT_READY There is not enough random data available to
satisfy the length requested by
RNGValueLength.
- @retval EFI_INVALID_PARAMETER RNGValue is NULL and RNGValueLength is
- non-zero.
+ @retval EFI_INVALID_PARAMETER RNGValue is NULL or RNGValueLength is zero.
**/
STATIC
@@ -119,7 +118,7 @@ GetRNG (
UINTN OutSize;
UINTN WaitMiliSeconds;
- if ((Value == NULL) && (ValueLength != 0)) {
+ if ((Value == NULL) || (ValueLength == 0)) {
return EFI_INVALID_PARAMETER;
}
-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#78167): https://edk2.groups.io/g/devel/message/78167
Mute This Topic: https://groups.io/mt/84454412/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-