diff options
author | Nikos Mavrogiannopoulos <nmav@gnutls.org> | 2016-07-15 18:51:14 +0200 |
---|---|---|
committer | Nikos Mavrogiannopoulos <nmav@gnutls.org> | 2016-07-15 18:51:14 +0200 |
commit | 69e650c7aceedf1d6d4e0254a66954a10e93ce48 (patch) | |
tree | 2214240e46bc7ddc2b361bbffa49194d419cf141 /lib/nettle | |
parent | 6bc896b9e2069ae88c4bb39b94fb2cefdc552b65 (diff) | |
download | gnutls-69e650c7aceedf1d6d4e0254a66954a10e93ce48.tar.gz |
rnd-common: added faster detection of getrandom based on GRND_NONBLOCK
Diffstat (limited to 'lib/nettle')
-rw-r--r-- | lib/nettle/rnd-common.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/nettle/rnd-common.c b/lib/nettle/rnd-common.c index 5cb9e88042..992d1cd3cf 100644 --- a/lib/nettle/rnd-common.c +++ b/lib/nettle/rnd-common.c @@ -187,7 +187,9 @@ void _rnd_system_entropy_deinit(void) static unsigned have_getrandom(void) { char c; - if (getrandom(&c, 1, 0) == 1) + int ret; + ret = getrandom(&c, 1, 1/*GRND_NONBLOCK*/); + if (ret == 1 || (ret == -1 && errno == EAGAIN)) return 1; return 0; } |