Merge pull request #22 from Hamcha/master

Allow compilation for targets without EGD (ie LibreSSL)
This commit is contained in:
Sam Dodrill 2014-11-21 04:30:48 +00:00
commit 05b16194a3
1 changed files with 9 additions and 0 deletions

View File

@ -520,6 +520,13 @@ 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)
{ {
/* We may not have EGD (old OpenSSL / LibreSSL), fall back to default */
#ifndef HAVE_SSL_RAND_EGD
if (seed_type == RB_PRNG_EGD) {
seed_type = RB_PRNG_DEFAULT;
}
#endif
if(seed_type == RB_PRNG_DEFAULT) { if(seed_type == RB_PRNG_DEFAULT) {
#ifdef _WIN32 #ifdef _WIN32
RAND_screen(); RAND_screen();
@ -530,10 +537,12 @@ rb_init_prng(const char *path, prng_seed_t seed_type)
return RAND_status(); return RAND_status();
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;