28 #if defined(POLARSSL_ENTROPY_C)
33 #if defined(POLARSSL_TIMING_C)
36 #if defined(POLARSSL_HAVEGE_C)
40 #if !defined(POLARSSL_NO_PLATFORM_ENTROPY)
43 #if !defined(_WIN32_WINNT)
44 #define _WIN32_WINNT 0x0400
56 if( CryptAcquireContext( &provider, NULL, NULL,
57 PROV_RSA_FULL, CRYPT_VERIFYCONTEXT ) == FALSE )
62 if( CryptGenRandom( provider, (DWORD) len, output ) == FALSE )
65 CryptReleaseContext( provider, 0 );
75 unsigned char *output,
size_t len,
size_t *olen )
83 file = fopen(
"/dev/urandom",
"rb" );
87 ret = fread( output, 1, len, file );
102 #if defined(POLARSSL_TIMING_C)
104 unsigned char *output,
size_t len,
size_t *olen )
110 if( len <
sizeof(
unsigned long) )
113 memcpy( output, &timer,
sizeof(
unsigned long) );
114 *olen =
sizeof(
unsigned long);
120 #if defined(POLARSSL_HAVEGE_C)
121 int havege_poll(
void *data,
122 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.