mp_rand: use #else after arcrandom

This commit is contained in:
Daniel Mendler 2019-05-08 15:14:50 +02:00
parent 2a0021a447
commit 9e28ef9fa2
No known key found for this signature in database
GPG Key ID: D88ADB2A2693CA43

View File

@ -130,35 +130,35 @@ static int s_read_ltm_rng(void *p, size_t n)
static int s_mp_rand_source_platform(void *p, size_t n) static int s_mp_rand_source_platform(void *p, size_t n)
{ {
int ret = MP_ERR;
#if defined(MP_ARC4RANDOM) #if defined(MP_ARC4RANDOM)
arc4random_buf(p, n); arc4random_buf(p, n);
return MP_OKAY; return MP_OKAY;
#endif #else
int ret = MP_ERR;
#if defined(MP_WIN_CSP) #if defined(MP_WIN_CSP)
ret = s_read_win_csp(p, n); ret = s_read_win_csp(p, n);
if (ret == MP_OKAY) return ret; if (ret == MP_OKAY) return ret;
#else #endif
#if defined(MP_GETRANDOM) #if defined(MP_GETRANDOM)
ret = s_read_getrandom(p, n); ret = s_read_getrandom(p, n);
if (ret == MP_OKAY) return ret; if (ret == MP_OKAY) return ret;
#endif #endif
#if defined(MP_DEV_URANDOM) #if defined(MP_DEV_URANDOM)
ret = s_read_dev_urandom(p, n); ret = s_read_dev_urandom(p, n);
if (ret == MP_OKAY) return ret; if (ret == MP_OKAY) return ret;
#endif #endif
#endif /* MP_WIN_CSP */
#if defined(MP_PRNG_ENABLE_LTM_RNG) #if defined(MP_PRNG_ENABLE_LTM_RNG)
ret = s_read_ltm_rng(p, n); ret = s_read_ltm_rng(p, n);
if (ret == MP_OKAY) return ret; if (ret == MP_OKAY) return ret;
#endif #endif
return ret; return ret;
#endif
} }
static int (*s_rand_source)(void *, size_t) = s_mp_rand_source_platform; static int (*s_rand_source)(void *, size_t) = s_mp_rand_source_platform;