mp_rand: use #else after arcrandom
This commit is contained in:
parent
2a0021a447
commit
9e28ef9fa2
12
bn_mp_rand.c
12
bn_mp_rand.c
@ -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;
|
||||||
|
Loading…
Reference in New Issue
Block a user