diff options
Diffstat (limited to 'misc')
-rw-r--r-- | misc/win32/rand.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/misc/win32/rand.c b/misc/win32/rand.c index dddbbe04b..1dd5d4f84 100644 --- a/misc/win32/rand.c +++ b/misc/win32/rand.c @@ -37,7 +37,11 @@ APR_DECLARE(apr_status_t) apr_generate_random_bytes(unsigned char * buf, if (!CryptAcquireContext(&hProv, NULL, NULL, PROV_RSA_FULL, flags)) { return apr_get_os_error(); } - if (!CryptGenRandom(hProv, length, buf)) { + /* XXX: An ugly hack for Win64, randomness is such that noone should + * ever expect > 2^31 bytes of data at once without the prng + * coming to a complete halt. + */ + if (!CryptGenRandom(hProv, (DWORD)length, buf)) { res = apr_get_os_error(); } CryptReleaseContext(hProv, 0); |