Hi Adeodato!

You wrote:

> # Bas, let's treat the BTS nice, now that it has version tracking. :)
> # Let me know if the version I'm giving is not accurate.

Oops, sorry about that (that was my locally patches version, obviously).
It seems I also forgot to attach the patch:

diff -Naur amule-2.1.0/src/CryptoPP.cpp amule-2.1.0.bas/src/CryptoPP.cpp
--- amule-2.1.0/src/CryptoPP.cpp        2005-11-20 02:15:12.000000000 +0100
+++ amule-2.1.0.bas/src/CryptoPP.cpp    2006-01-28 22:29:21.000000000 +0100
@@ -9228,23 +9228,21 @@
 NonblockingRng::NonblockingRng()
 {
 #ifndef CRYPTOPP_WIN32_AVAILABLE
-       m_fd = open("/dev/urandom",O_RDONLY);
-       if (m_fd == -1)
-               throw OS_RNG_Err("open /dev/urandom");
+       struct timeval tijd;
+       gettimeofday(&tijd,NULL);
+       srand(tijd.tv_usec);
 #endif
 }
 
 NonblockingRng::~NonblockingRng()
 {
-#ifndef CRYPTOPP_WIN32_AVAILABLE
-       close(m_fd);
-#endif
 }
 
 byte NonblockingRng::GenerateByte()
 {
        byte b;
-       GenerateBlock(&b, 1);
+       int i = rand();
+       memcpy(&b,&i,1);
        return b;
 }
 
@@ -9257,13 +9255,9 @@
        if (!CryptGenRandom(m_Provider.GetProviderHandle(), size, output))
                throw OS_RNG_Err("CryptGenRandom");
 #else
-       if ((unsigned int)read(m_fd, output, size) != size) {
-               // Kernel 2.6.10 has non-concurrent access to /dev/urandom, 
retry at least once
-               printf("Shamelessly retrying a random generation attempt\n");
-               if ((unsigned int)read(m_fd, output, size) != size) {
-                       printf("Error reading /dev/urandom! (kernel 
2.6.10?)\n");
-                       throw OS_RNG_Err("read /dev/urandom");
-               }
+       while (size--)
+       {
+               *(output++) = GenerateByte();
        }
 #endif
 }

-- 
Kind regards,
+--------------------------------------------------------------------+
| Bas Zoetekouw              | GPG key: 0644fab7                     |
|----------------------------| Fingerprint: c1f5 f24c d514 3fec 8bf6 |
| [EMAIL PROTECTED], [EMAIL PROTECTED] |              a2b1 2bae e41f 0644 fab7 |
+--------------------------------------------------------------------+ 


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to