A DWORD is the maximum CryptGenRandom() can support.

This commit is contained in:
Frank Denis 2014-04-09 19:07:41 -07:00
parent 433ba6be9e
commit 8fc8d2f380

View File

@ -169,7 +169,10 @@ randombytes_sysrandom_buf(void * const buf, const size_t size)
abort();
}
#else
if (! CryptGenRandom(stream.hcrypt_prov, size, (BYTE *) buf)) {
if (size > 0xffffffff) {
abort();
}
if (! CryptGenRandom(stream.hcrypt_prov, (DWORD) size, (BYTE *) buf)) {
abort();
}
#endif