Source-Changes-HG archive

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

[src/trunk]: src/sys/kern entropy(9): Allow changing flags on all entropy sou...



details:   https://anonhg.NetBSD.org/src/rev/7346eb9d82d1
branches:  trunk
changeset: 373809:7346eb9d82d1
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Fri Mar 03 12:52:49 2023 +0000

description:
entropy(9): Allow changing flags on all entropy sources at once.

Entropy sources should all have nonempty names, and this will enable
an operator to, for example, disable all but a specific entropy
source.

XXX pullup-10

diffstat:

 sys/kern/kern_entropy.c |  8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)

diffs (36 lines):

diff -r 15c2626589a0 -r 7346eb9d82d1 sys/kern/kern_entropy.c
--- a/sys/kern/kern_entropy.c   Fri Mar 03 10:02:51 2023 +0000
+++ b/sys/kern/kern_entropy.c   Fri Mar 03 12:52:49 2023 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: kern_entropy.c,v 1.58 2023/03/01 08:13:54 riastradh Exp $      */
+/*     $NetBSD: kern_entropy.c,v 1.59 2023/03/03 12:52:49 riastradh Exp $      */
 
 /*-
  * Copyright (c) 2019 The NetBSD Foundation, Inc.
@@ -75,7 +75,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_entropy.c,v 1.58 2023/03/01 08:13:54 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_entropy.c,v 1.59 2023/03/03 12:52:49 riastradh Exp $");
 
 #include <sys/param.h>
 #include <sys/types.h>
@@ -1634,6 +1634,8 @@
        uint32_t extra[4];
        unsigned i = 0;
 
+       KASSERTMSG(name[0] != '\0', "rndsource must have nonempty name");
+
        /* Grab cycle counter to mix extra into the pool.  */
        extra[i++] = entropy_timer();
 
@@ -2387,7 +2389,7 @@
                        if (rndctl->type != 0xff) {
                                if (rs->type != rndctl->type)
                                        continue;
-                       } else {
+                       } else if (rndctl->name[0] != '\0') {
                                if (strncmp(rs->name, rndctl->name, n) != 0)
                                        continue;
                        }



Home | Main Index | Thread Index | Old Index