diff options
author | wrowe <wrowe@13f79535-47bb-0310-9956-ffa450edef68> | 2005-05-16 21:40:28 +0000 |
---|---|---|
committer | wrowe <wrowe@13f79535-47bb-0310-9956-ffa450edef68> | 2005-05-16 21:40:28 +0000 |
commit | c409228101800794dd3fbfb6667e78931312bc33 (patch) | |
tree | 576073999652a39c9f7ac996e12016f7becead82 | |
parent | d6cee65346572603318d5f486de300ed6732f431 (diff) | |
download | libapr-c409228101800794dd3fbfb6667e78931312bc33.tar.gz |
Presume when we grab random data, 2^31 bytes is quite alot.
If this solution isn't sufficient (thus: the XXX comment),
we will need a loop where sizeof(apr_size_t) > sizeof(DWORD)
git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@170461 13f79535-47bb-0310-9956-ffa450edef68
-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); |