10#include "crypto/rand.h"
11#include <openssl/aes.h>
41 if (RandBuffer ==
NULL) {
42 DEBUG ((DEBUG_ERROR,
"[OPENSSL_RAND_POOL] NULL RandBuffer. No random numbers are generated and your system is not secure\n"));
43 ASSERT (RandBuffer !=
NULL);
55 if (Length >=
sizeof (TempRand)) {
56 *((UINT64 *)RandBuffer) = TempRand;
57 RandBuffer +=
sizeof (UINT64);
58 Length -=
sizeof (TempRand);
60 CopyMem (RandBuffer, &TempRand, Length);
77ossl_pool_acquire_entropy (
83 unsigned char *Buffer;
85 Bytes_needed = ossl_rand_pool_bytes_needed (pool, 1 );
86 if (Bytes_needed > 0) {
87 Buffer = ossl_rand_pool_add_begin (pool, Bytes_needed);
92 ossl_rand_pool_add_end (pool, 0, 0);
94 ossl_rand_pool_add_end (pool, Bytes_needed, 8 * Bytes_needed);
99 return ossl_rand_pool_entropy_available (pool);
108ossl_pool_add_nonce_data (
116 return ossl_rand_pool_add (pool, (
unsigned char *)&data,
sizeof (data), 0);
125rand_pool_add_additional_data (
133 return ossl_rand_pool_add (pool, (
unsigned char *)&data,
sizeof (data), 0);
155ossl_rand_pool_cleanup (
167ossl_rand_pool_keep_random_devices_open (
VOID *EFIAPI CopyMem(OUT VOID *DestinationBuffer, IN CONST VOID *SourceBuffer, IN UINTN Length)
BOOLEAN EFIAPI GetRandomNumber64(OUT UINT64 *Rand)
#define DEBUG(Expression)
STATIC BOOLEAN EFIAPI RandGetBytes(IN UINTN Length, OUT UINT8 *RandBuffer)