diff options
author | Bruce Evans <bde@FreeBSD.org> | 2001-08-30 12:30:58 +0000 |
---|---|---|
committer | Bruce Evans <bde@FreeBSD.org> | 2001-08-30 12:30:58 +0000 |
commit | 60f8e3af927efe398a78f8fe960ab14a132a066b (patch) | |
tree | 6543986f5269b8b1dc58bbe8fea5201be7231364 /sys/libkern/arc4random.c | |
parent | 142277ce04c11a43d86fe89b2e7b57402fe724b9 (diff) | |
download | src-test2-60f8e3af927efe398a78f8fe960ab14a132a066b.tar.gz src-test2-60f8e3af927efe398a78f8fe960ab14a132a066b.zip |
Notes
Diffstat (limited to 'sys/libkern/arc4random.c')
-rw-r--r-- | sys/libkern/arc4random.c | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/sys/libkern/arc4random.c b/sys/libkern/arc4random.c index 71616dc21d05..993f764f2d7b 100644 --- a/sys/libkern/arc4random.c +++ b/sys/libkern/arc4random.c @@ -46,11 +46,12 @@ arc4_randomstir (void) u_int8_t key[256]; int r, n; - /* XXX read_random() returns unsafe numbers if the entropy - * devce is not loaded - MarkM + /* + * XXX read_random() returns unsafe numbers if the entropy + * device is not loaded -- MarkM. */ r = read_random(key, ARC4_KEYBYTES); - /* if r == 0 || -1, just use what was on the stack */ + /* If r == 0 || -1, just use what was on the stack. */ if (r > 0) { for (n = r; n < sizeof(key); n++) @@ -84,11 +85,10 @@ arc4_init(void) arc4_randomstir(); arc4_initialized = 1; - /* Now, throw away the first N words out output, as suggested - * in the paper "Weaknesses in the Key Scheduling Algorithm - * of RC4" by Fluher, Mantin, and Shamir. - * - * (N = 256 in our case.) + /* + * 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(); @@ -121,9 +121,7 @@ arc4random(void) if (!arc4_initialized) arc4_init(); - /* Get current time. */ getmicrotime(&tv_now); - if ((++arc4_numruns > ARC4_MAXRUNS) || (tv_now.tv_sec > arc4_tv_nextreseed.tv_sec)) { |