11#define RANDOM_NUMBER_SIZE 256
13CONST UINT8 SeedString[] =
"This is the random seed for PRNG verification.";
15UINT8 PreviousRandomBuffer[RANDOM_NUMBER_SIZE] = { 0x0 };
17UINT8 RandomBuffer[RANDOM_NUMBER_SIZE] = { 0x0 };
21TestVerifyPrngGeneration (
28 Status =
RandomSeed (SeedString,
sizeof (SeedString));
31 for (Index = 0; Index < 10; Index++) {
32 Status =
RandomBytes (RandomBuffer, RANDOM_NUMBER_SIZE);
35 Status = (
CompareMem (PreviousRandomBuffer, RandomBuffer, RANDOM_NUMBER_SIZE) == 0);
38 CopyMem (PreviousRandomBuffer, RandomBuffer, RANDOM_NUMBER_SIZE);
41 return UNIT_TEST_PASSED;
48 {
"TestVerifyPrngGeneration()",
"CryptoPkg.BaseCryptLib.Prng", TestVerifyPrngGeneration,
NULL,
NULL,
NULL },
BOOLEAN EFIAPI RandomBytes(OUT UINT8 *Output, IN UINTN Size)
BOOLEAN EFIAPI RandomSeed(IN CONST UINT8 *Seed OPTIONAL, IN UINTN SeedSize)
INTN EFIAPI CompareMem(IN CONST VOID *DestinationBuffer, IN CONST VOID *SourceBuffer, IN UINTN Length)
VOID *EFIAPI CopyMem(OUT VOID *DestinationBuffer, IN CONST VOID *SourceBuffer, IN UINTN Length)
#define ARRAY_SIZE(Array)
#define UT_ASSERT_TRUE(Expression)
#define UT_ASSERT_FALSE(Expression)