summaryrefslogtreecommitdiff
path: root/misc
diff options
context:
space:
mode:
authorwrowe <wrowe@13f79535-47bb-0310-9956-ffa450edef68>2005-05-16 21:40:28 +0000
committerwrowe <wrowe@13f79535-47bb-0310-9956-ffa450edef68>2005-05-16 21:40:28 +0000
commitc409228101800794dd3fbfb6667e78931312bc33 (patch)
tree576073999652a39c9f7ac996e12016f7becead82 /misc
parentd6cee65346572603318d5f486de300ed6732f431 (diff)
downloadlibapr-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
Diffstat (limited to 'misc')
-rw-r--r--misc/win32/rand.c6
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);