Module Name:    src
Committed By:   joerg
Date:           Mon Jan 18 20:54:54 UTC 2010

Modified Files:
        src/sys/lib/libkern: arc4random.c

Log Message:
Keep arc4_i and arc4_j synchronised after a rekeying. This prevents
accidentally ending up in a short ARC4 cycle.


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/sys/lib/libkern/arc4random.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/lib/libkern/arc4random.c
diff -u src/sys/lib/libkern/arc4random.c:1.20 src/sys/lib/libkern/arc4random.c:1.21
--- src/sys/lib/libkern/arc4random.c:1.20	Mon Apr 28 20:24:06 2008
+++ src/sys/lib/libkern/arc4random.c	Mon Jan 18 20:54:54 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: arc4random.c,v 1.20 2008/04/28 20:24:06 martin Exp $	*/
+/*	$NetBSD: arc4random.c,v 1.21 2010/01/18 20:54:54 joerg Exp $	*/
 
 /*-
  * Copyright (c) 2002 The NetBSD Foundation, Inc.
@@ -136,6 +136,7 @@
 		arc4_j = (arc4_j + arc4_sbox[n] + key[n]) % 256;
 		arc4_swap(&arc4_sbox[n], &arc4_sbox[arc4_j]);
 	}
+	arc4_i = arc4_j;
 
 	/* Reset for next reseed cycle. */
 	arc4_nextreseed = time_uptime + ARC4_RESEED_SECONDS;

Reply via email to