2 Application for Pseudorandom Number Generator Validation.
4 Copyright (c) 2010, Intel Corporation. All rights reserved.<BR>
5 This program and the accompanying materials
6 are licensed and made available under the terms and conditions of the BSD License
7 which accompanies this distribution. The full text of the license may be found at
8 http://opensource.org/licenses/bsd-license.php
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
17 #define RANDOM_NUMBER_SIZE 256
19 CONST UINT8 SeedString
[] = "This is the random seed for PRNG verification.";
21 UINT8 PreviousRandomBuffer
[RANDOM_NUMBER_SIZE
] = { 0x0 };
23 UINT8 RandomBuffer
[RANDOM_NUMBER_SIZE
] = { 0x0 };
26 Validate UEFI-OpenSSL pseudorandom number generator interfaces.
28 @retval EFI_SUCCESS Validation succeeded.
29 @retval EFI_ABORTED Validation failed.
40 Print (L
" \nUEFI-OpenSSL PRNG Engine Testing:\n");
42 Print (L
"- Random Generation...");
44 Status
= RandomSeed (SeedString
, sizeof (SeedString
));
50 for (Index
= 0; Index
< 10; Index
++) {
51 Status
= RandomBytes (RandomBuffer
, RANDOM_NUMBER_SIZE
);
57 if (CompareMem (PreviousRandomBuffer
, RandomBuffer
, RANDOM_NUMBER_SIZE
) == 0) {
62 CopyMem (PreviousRandomBuffer
, RandomBuffer
, RANDOM_NUMBER_SIZE
);