Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/kern Fix hardware RNGs -- accept their entropy estimates...
details: https://anonhg.NetBSD.org/src/rev/de6ccbbe9bff
branches: trunk
changeset: 782303:de6ccbbe9bff
user: tls <tls%NetBSD.org@localhost>
date: Sat Oct 27 01:29:02 2012 +0000
description:
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 6d7435e7533f -r de6ccbbe9bff sys/kern/kern_rndq.c
--- a/sys/kern/kern_rndq.c Fri Oct 26 23:23:23 2012 +0000
+++ b/sys/kern/kern_rndq.c Sat Oct 27 01:29:02 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: kern_rndq.c,v 1.5 2012/09/05 18:57:34 tls Exp $ */
+/* $NetBSD: kern_rndq.c,v 1.6 2012/10/27 01:29:02 tls 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.5 2012/09/05 18:57:34 tls Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_rndq.c,v 1.6 2012/10/27 01:29:02 tls 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