26 #if !defined(POLARSSL_CONFIG_FILE)
29 #include POLARSSL_CONFIG_FILE
32 #if defined(POLARSSL_ENTROPY_C)
37 #if defined(POLARSSL_TIMING_C)
40 #if defined(POLARSSL_HAVEGE_C)
44 #if !defined(POLARSSL_NO_PLATFORM_ENTROPY)
45 #if defined(_WIN32) && !defined(EFIX64) && !defined(EFI32)
47 #if !defined(_WIN32_WINNT)
48 #define _WIN32_WINNT 0x0400
60 if( CryptAcquireContext( &provider, NULL, NULL,
61 PROV_RSA_FULL, CRYPT_VERIFYCONTEXT ) == FALSE )
66 if( CryptGenRandom( provider, (DWORD) len, output ) == FALSE )
69 CryptReleaseContext( provider, 0 );
79 unsigned char *output,
size_t len,
size_t *olen )
87 file = fopen(
"/dev/urandom",
"rb" );
91 ret = fread( output, 1, len, file );
106 #if defined(POLARSSL_TIMING_C)
108 unsigned char *output,
size_t len,
size_t *olen )
114 if( len <
sizeof(
unsigned long) )
117 memcpy( output, &timer,
sizeof(
unsigned long) );
118 *olen =
sizeof(
unsigned long);
124 #if defined(POLARSSL_HAVEGE_C)
125 int havege_poll(
void *data,
126 unsigned char *output,
size_t len,
size_t *olen )
Configuration options (set of defines)
unsigned long hardclock(void)
Return the CPU cycle counter value.
Platform-specific and custom entropy polling functions.
Entropy accumulator implementation.
HAVEGE: HArdware Volatile Entropy Gathering and Expansion.
int platform_entropy_poll(void *data, unsigned char *output, size_t len, size_t *olen)
Platform-specific entropy poll callback.
int havege_random(void *p_rng, unsigned char *output, size_t len)
HAVEGE rand function.
#define POLARSSL_ERR_ENTROPY_SOURCE_FAILED
Critical entropy source failure.
int hardclock_poll(void *data, unsigned char *output, size_t len, size_t *olen)
hardclock-based entropy poll callback
Portable interface to the CPU cycle counter.