apr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From wr...@apache.org
Subject svn commit: r170461 - /apr/apr/trunk/misc/win32/rand.c
Date Mon, 16 May 2005 21:40:45 GMT
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);



Mime
View raw message