Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/tls-earlyentropy]: src/sys/kern Fix rndctl accounting.
details: https://anonhg.NetBSD.org/src/rev/026d04675d13
branches: tls-earlyentropy
changeset: 795280:026d04675d13
user: tls <tls%NetBSD.org@localhost>
date: Sun Aug 10 08:30:18 2014 +0000
description:
Fix rndctl accounting.
diffstat:
sys/kern/kern_rndpool.c | 14 ++++++++++++--
1 files changed, 12 insertions(+), 2 deletions(-)
diffs (36 lines):
diff -r 46e082d1847b -r 026d04675d13 sys/kern/kern_rndpool.c
--- a/sys/kern/kern_rndpool.c Sun Aug 10 08:10:31 2014 +0000
+++ b/sys/kern/kern_rndpool.c Sun Aug 10 08:30:18 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: kern_rndpool.c,v 1.5.2.1 2014/04/07 02:00:00 tls Exp $ */
+/* $NetBSD: kern_rndpool.c,v 1.5.2.2 2014/08/10 08:30:18 tls Exp $ */
/*-
* Copyright (c) 1997 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_rndpool.c,v 1.5.2.1 2014/04/07 02:00:00 tls Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_rndpool.c,v 1.5.2.2 2014/08/10 08:30:18 tls Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -88,7 +88,17 @@
void
rndpool_set_entropy_count(rndpool_t *rp, u_int32_t count)
{
+ int32_t difference = count - rp->stats.curentropy;
+
+ if (__predict_true(difference > 0)) {
+ rp->stats.added += difference;
+ }
+
rp->stats.curentropy = count;
+ if (rp->stats.curentropy > RND_POOLBITS) {
+ rp->stats.discarded += (rp->stats.curentropy - RND_POOLBITS);
+ rp->stats.curentropy = RND_POOLBITS;
+ }
}
void rndpool_get_stats(rndpool_t *rp, void *rsp, int size)
Home |
Main Index |
Thread Index |
Old Index