1
mirror of https://github.com/jedisct1/libsodium.git synced 2024-12-19 18:15:18 -07:00

abort() if nacl_secure_random() ever returns 0 but the wrong size

This commit is contained in:
Frank Denis 2016-04-29 10:08:45 +02:00
parent 40db481236
commit 681176e187

View File

@ -15,10 +15,9 @@ randombytes_nativeclient_buf(void * const buf, const size_t size)
{
size_t readnb;
if (nacl_secure_random(buf, size, &readnb) != 0) {
if (nacl_secure_random(buf, size, &readnb) != 0 || readnb != size) {
abort();
}
assert(readnb == size);
}
static uint32_t