You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@apr.apache.org by wr...@apache.org on 2005/05/16 23:40:45 UTC
svn commit: r170461 - /apr/apr/trunk/misc/win32/rand.c
Author: wrowe
Date: Mon May 16 14:40:28 2005
New Revision: 170461
URL: http://svn.apache.org/viewcvs?rev=170461&view=rev
Log:
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)
Modified:
apr/apr/trunk/misc/win32/rand.c
Modified: apr/apr/trunk/misc/win32/rand.c
URL: http://svn.apache.org/viewcvs/apr/apr/trunk/misc/win32/rand.c?rev=170461&r1=170460&r2=170461&view=diff
==============================================================================
--- apr/apr/trunk/misc/win32/rand.c (original)
+++ apr/apr/trunk/misc/win32/rand.c Mon May 16 14:40:28 2005
@@ -37,7 +37,11 @@
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);