mirror of
https://github.com/jedisct1/libsodium.git
synced 2024-12-19 10:05:05 -07:00
getentropy() only returns 0 or -1 and is atomic
This commit is contained in:
parent
0299203305
commit
015dfe9978
@ -178,14 +178,11 @@ randombytes_internal_random_init(void)
|
||||
static int
|
||||
_randombytes_getentropy(void * const buf, const size_t size)
|
||||
{
|
||||
int readnb;
|
||||
|
||||
assert(size <= 256U);
|
||||
do {
|
||||
readnb = getentropy(buf, size);
|
||||
} while (readnb < 0 && (errno == EINTR || errno == EAGAIN));
|
||||
|
||||
return (readnb == (int) size) - 1;
|
||||
if (getentropy(buf, size) != 0) {
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
|
Loading…
Reference in New Issue
Block a user