Source-Changes-HG archive

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

[src/trunk]: src/sys/lib/libkern Keep arc4_i and arc4_j synchronised after a ...



details:   https://anonhg.NetBSD.org/src/rev/66083b4a2d6f
branches:  trunk
changeset: 750918:66083b4a2d6f
user:      joerg <joerg%NetBSD.org@localhost>
date:      Mon Jan 18 20:54:54 2010 +0000

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

diffstat:

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

diffs (17 lines):

diff -r 3de8f0e8c03e -r 66083b4a2d6f sys/lib/libkern/arc4random.c
--- a/sys/lib/libkern/arc4random.c      Mon Jan 18 20:54:22 2010 +0000
+++ b/sys/lib/libkern/arc4random.c      Mon Jan 18 20:54:54 2010 +0000
@@ -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;



Home | Main Index | Thread Index | Old Index