mirror of
https://github.com/jedisct1/libsodium.git
synced 2026-08-26 11:47:13 +09:00
getentropy() only returns 0 or -1 and is atomic
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user