REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2438

The EFI_RNG_PROTOCOL conformance test checks that the size returned by
GetInfo() is a multiple of 16. This would be fulfilled by size == 0.

The UEFI specification requires that at least one algorithm is implemented.
So we should check that size is non-zero too.

Signed-off-by: Heinrich Schuchardt <[email protected]>
---
 .../RandomNumber/BlackBoxTest/RandomNumberBBTestConformance.c  | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git 
a/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/RandomNumber/BlackBoxTest/RandomNumberBBTestConformance.c
 
b/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/RandomNumber/BlackBoxTest/RandomNumberBBTestConformance.c
index f0a7c030..cd419d68 100644
--- 
a/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/RandomNumber/BlackBoxTest/RandomNumberBBTestConformance.c
+++ 
b/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/RandomNumber/BlackBoxTest/RandomNumberBBTestConformance.c
@@ -169,7 +169,8 @@ BBTestGetInfoConformanceTestCheckpoint1 (
     return Status;
   }
 
-  if (EFI_BUFFER_TOO_SMALL == Status && RNGAlgorithmListSize % 
sizeof(EFI_RNG_ALGORITHM) == 0) {
+  if (EFI_BUFFER_TOO_SMALL == Status && RNGAlgorithmListSize &&
+      RNGAlgorithmListSize % sizeof(EFI_RNG_ALGORITHM) == 0) {
     AssertionType = EFI_TEST_ASSERTION_PASSED;
   } else {
     AssertionType = EFI_TEST_ASSERTION_FAILED;
-- 
2.24.1


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#52599): https://edk2.groups.io/g/devel/message/52599
Mute This Topic: https://groups.io/mt/69304206/21656
Group Owner: [email protected]
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to