Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/lib/libkern discard 256 bytes of output every time we st...



details:   https://anonhg.NetBSD.org/src/rev/b7c50b2a9e1d
branches:  trunk
changeset: 532747:b7c50b2a9e1d
user:      itojun <itojun%NetBSD.org@localhost>
date:      Fri Jun 14 03:05:46 2002 +0000

description:
discard 256 bytes of output every time we stir (not just when initializing)

diffstat:

 sys/lib/libkern/arc4random.c |  18 +++++++++---------
 1 files changed, 9 insertions(+), 9 deletions(-)

diffs (39 lines):

diff -r d0c9c5d0ebf4 -r b7c50b2a9e1d sys/lib/libkern/arc4random.c
--- a/sys/lib/libkern/arc4random.c      Fri Jun 14 02:39:50 2002 +0000
+++ b/sys/lib/libkern/arc4random.c      Fri Jun 14 03:05:46 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: arc4random.c,v 1.3 2002/05/29 06:27:15 itojun Exp $    */
+/*     $NetBSD: arc4random.c,v 1.4 2002/06/14 03:05:46 itojun Exp $    */
 
 /*-
  * THE BEER-WARE LICENSE
@@ -75,6 +75,14 @@
        arc4_tv_nextreseed = mono_time;
        arc4_tv_nextreseed.tv_sec += ARC4_RESEED_SECONDS;
        arc4_numruns = 0;
+
+       /*
+        * Throw away the first N words of output, as suggested in the
+        * paper "Weaknesses in the Key Scheduling Algorithm of RC4"
+        * by Fluher, Mantin, and Shamir.  (N = 256 in our case.)
+        */
+       for (n = 0; n < 256 * 4; n++)
+               arc4_randbyte();
 }
 
 /*
@@ -91,14 +99,6 @@
 
        arc4_randomstir();
        arc4_initialized = 1;
-
-       /*
-        * Throw away the first N words of output, as suggested in the
-        * paper "Weaknesses in the Key Scheduling Algorithm of RC4"
-        * by Fluher, Mantin, and Shamir.  (N = 256 in our case.)
-        */
-       for (n = 0; n < 256 * 4; n++)
-               arc4_randbyte();
 }
 
 /*



Home | Main Index | Thread Index | Old Index