Module Name: src
Committed By: riastradh
Date: Fri Mar 3 12:52:50 UTC 2023
Modified Files:
src/sys/kern: kern_entropy.c
Log Message:
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
To generate a diff of this commit:
cvs rdiff -u -r1.58 -r1.59 src/sys/kern/kern_entropy.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/kern/kern_entropy.c
diff -u src/sys/kern/kern_entropy.c:1.58 src/sys/kern/kern_entropy.c:1.59
--- src/sys/kern/kern_entropy.c:1.58 Wed Mar 1 08:13:54 2023
+++ src/sys/kern/kern_entropy.c Fri Mar 3 12:52:49 2023
@@ -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 @@ rnd_attach_source(struct krndsource *rs,
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 @@ entropy_ioctl(unsigned long cmd, void *d
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;
}