summaryrefslogtreecommitdiffstats
path: root/sys/libkern
diff options
context:
space:
mode:
authorache <ache@FreeBSD.org>2008-07-25 15:53:32 +0000
committerache <ache@FreeBSD.org>2008-07-25 15:53:32 +0000
commitb9e628f6b387cc2f52eed1747e8f44a315762f86 (patch)
treef518ccb5238c6e0a8c17cb5534b8b21fa18a43f6 /sys/libkern
parent57dc8eb6fd3c27efac98d823ee5098d591635563 (diff)
downloadFreeBSD-src-b9e628f6b387cc2f52eed1747e8f44a315762f86.zip
FreeBSD-src-b9e628f6b387cc2f52eed1747e8f44a315762f86.tar.gz
Per rwatson's request:
"If you don't get a review within a day or two, I would firmly recommend backing out the changes" back out all my changes as unreviewed by secteam@ yet.
Diffstat (limited to 'sys/libkern')
-rw-r--r--sys/libkern/arc4random.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/sys/libkern/arc4random.c b/sys/libkern/arc4random.c
index c0d1583..3a3227c 100644
--- a/sys/libkern/arc4random.c
+++ b/sys/libkern/arc4random.c
@@ -69,21 +69,18 @@ arc4_randomstir (void)
arc4_j = (arc4_j + arc4_sbox[n] + key[n]) % 256;
arc4_swap(&arc4_sbox[n], &arc4_sbox[arc4_j]);
}
- arc4_i = arc4_j = 0;
/* Reset for next reseed cycle. */
arc4_t_reseed = tv_now.tv_sec + ARC4_RESEED_SECONDS;
arc4_numruns = 0;
/*
- * Throw away the first N bytes of output, as suggested in the
+ * 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=768 is based on
- * suggestions in the paper "(Not So) Random Shuffles of RC4"
- * by Ilya Mironov.
+ * by Fluher, Mantin, and Shamir. (N = 256 in our case.)
*/
- for (n = 0; n < 768; n++)
- (void)arc4_randbyte();
+ for (n = 0; n < 256*4; n++)
+ arc4_randbyte();
mtx_unlock(&arc4_mtx);
}
OpenPOWER on IntegriCloud