[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[or-cvs] Make 0.1.0.x bugfix for bug 151 more conservative.



Update of /home/or/cvsroot/tor/src/common
In directory moria:/tmp/cvs-serv2442/src/common

Modified Files:
      Tag: tor-0_1_0-patches
	crypto.c 
Log Message:
Make 0.1.0.x bugfix for bug 151 more conservative.

Index: crypto.c
===================================================================
RCS file: /home/or/cvsroot/tor/src/common/crypto.c,v
retrieving revision 1.137.2.1
retrieving revision 1.137.2.2
diff -u -d -r1.137.2.1 -r1.137.2.2
--- crypto.c	6 Jun 2005 20:10:02 -0000	1.137.2.1
+++ crypto.c	6 Jun 2005 21:33:41 -0000	1.137.2.2
@@ -1433,11 +1433,11 @@
     }
     provider_set = 1;
   }
-  if (!CryptGenRandom(provider, sizeof(buf), buf)) {
+  if (!CryptGenRandom(provider, DIGEST_LEN, buf)) {
     log_fn(LOG_ERR,"Can't get entropy from CryptoAPI.");
     return -1;
   }
-  RAND_seed(buf, sizeof(buf));
+  RAND_seed(buf, DIGEST_LEN);
   /* And add the current screen state to the entropy pool for
    * good measure. */
   RAND_screen();
@@ -1454,13 +1454,13 @@
     fd = open(filenames[i], O_RDONLY, 0);
     if (fd<0) continue;
     log_fn(LOG_INFO, "Seeding RNG from %s", filenames[i]);
-    n = read_all(fd, buf, sizeof(buf), 0);
+    n = read(fd, buf, DIGEST_LEN);
     close(fd);
-    if (n != sizeof(buf)) {
+    if (n != DIGEST_LEN) {
       log_fn(LOG_WARN, "Error reading from entropy source");
       return -1;
     }
-    RAND_seed(buf, sizeof(buf));
+    RAND_seed(buf, DIGEST_LEN);
     return 0;
   }