Source-Changes-HG archive

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

[src/netbsd-6]: src/sys/kern Pull up following revision(s) (requested by msai...



details:   https://anonhg.NetBSD.org/src/rev/114788685118
branches:  netbsd-6
changeset: 775502:114788685118
user:      riz <riz%NetBSD.org@localhost>
date:      Fri Nov 23 16:16:56 2012 +0000

description:
Pull up following revision(s) (requested by msaitoh in ticket #696):
        sys/kern/kern_rndq.c: revision 1.6
Fix hardware RNGs -- accept their entropy estimates *rather than* using
timestamps to estimate the entropy of their input.  I'd accidentally
made it so no entropy was ever counted from them at all.

diffstat:

 sys/kern/kern_rndq.c |  11 +++++++----
 1 files changed, 7 insertions(+), 4 deletions(-)

diffs (39 lines):

diff -r 74d297c27746 -r 114788685118 sys/kern/kern_rndq.c
--- a/sys/kern/kern_rndq.c      Fri Nov 23 16:12:35 2012 +0000
+++ b/sys/kern/kern_rndq.c      Fri Nov 23 16:16:56 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: kern_rndq.c,v 1.1.2.3 2012/10/17 21:27:12 riz Exp $    */
+/*     $NetBSD: kern_rndq.c,v 1.1.2.4 2012/11/23 16:16:56 riz Exp $    */
 
 /*-
  * Copyright (c) 1997-2011 The NetBSD Foundation, Inc.
@@ -32,7 +32,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_rndq.c,v 1.1.2.3 2012/10/17 21:27:12 riz Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_rndq.c,v 1.1.2.4 2012/11/23 16:16:56 riz Exp $");
 
 #include <sys/param.h>
 #include <sys/ioctl.h>
@@ -640,6 +640,11 @@
 rnd_add_data(krndsource_t *rs, const void *const data, uint32_t len,
             uint32_t entropy)
 {
+       /*
+        * This interface is meant for feeding data which is,
+        * itself, random.  Don't estimate entropy based on
+        * timestamp, just directly add the data.
+        */
        rnd_add_data_ts(rs, data, len, entropy, rnd_counter());
 }
 
@@ -835,8 +840,6 @@
                SIMPLEQ_REMOVE_HEAD(&dq_samples, next);
                source = sample->source;
                entropy = sample->entropy;
-               if (source->flags & RND_FLAG_NO_ESTIMATE)
-                       entropy = 0;
 
                /*
                 * Hardware generators are great but sometimes they



Home | Main Index | Thread Index | Old Index