Allow compilation for targets without EGD (ie LibreSSL)

This commit is contained in:
Hamcha 2014-08-03 12:30:51 +02:00
parent 027b2310ca
commit 0cea0c17d2
1 changed files with 7 additions and 0 deletions

View File

@ -563,6 +563,11 @@ rb_ssl_start_connected(rb_fde_t *F, CNCB * callback, void *data, int timeout)
int int
rb_init_prng(const char *path, prng_seed_t seed_type) rb_init_prng(const char *path, prng_seed_t seed_type)
{ {
#ifndef HAVE_SSL_RAND_EGD
/* We may not have EGD (old OpenSSL / LibreSSL), fall back to default */
seed_type = RB_PRNG_DEFAULT;
#endif
if(seed_type == RB_PRNG_DEFAULT) if(seed_type == RB_PRNG_DEFAULT)
{ {
#ifdef _WIN32 #ifdef _WIN32
@ -575,10 +580,12 @@ rb_init_prng(const char *path, prng_seed_t seed_type)
switch (seed_type) switch (seed_type)
{ {
#ifdef HAVE_SSL_RAND_EGD
case RB_PRNG_EGD: case RB_PRNG_EGD:
if(RAND_egd(path) == -1) if(RAND_egd(path) == -1)
return -1; return -1;
break; break;
#endif
case RB_PRNG_FILE: case RB_PRNG_FILE:
if(RAND_load_file(path, -1) == -1) if(RAND_load_file(path, -1) == -1)
return -1; return -1;