Module Name: src Committed By: martin Date: Mon Jul 31 15:57:43 UTC 2023
Modified Files: src/sbin/rndctl [netbsd-10]: rndctl.c src/sys/kern [netbsd-10]: kern_entropy.c Log Message: Pull up following revision(s) (requested by riastradh in ticket #273): sys/kern/kern_entropy.c: revision 1.59 sbin/rndctl/rndctl.c: revision 1.41 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. rndctl(8): Take omitted name/type as empty device name. This can now be used to change flags for all sources at once. To generate a diff of this commit: cvs rdiff -u -r1.40 -r1.40.6.1 src/sbin/rndctl/rndctl.c cvs rdiff -u -r1.57.4.1 -r1.57.4.2 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/sbin/rndctl/rndctl.c diff -u src/sbin/rndctl/rndctl.c:1.40 src/sbin/rndctl/rndctl.c:1.40.6.1 --- src/sbin/rndctl/rndctl.c:1.40 Sun Apr 4 13:37:17 2021 +++ src/sbin/rndctl/rndctl.c Mon Jul 31 15:57:43 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: rndctl.c,v 1.40 2021/04/04 13:37:17 nia Exp $ */ +/* $NetBSD: rndctl.c,v 1.40.6.1 2023/07/31 15:57:43 martin Exp $ */ /*- * Copyright (c) 1997 Michael Graff. @@ -31,7 +31,7 @@ #include <sys/cdefs.h> #ifndef lint -__RCSID("$NetBSD: rndctl.c,v 1.40 2021/04/04 13:37:17 nia Exp $"); +__RCSID("$NetBSD: rndctl.c,v 1.40.6.1 2023/07/31 15:57:43 martin Exp $"); #endif #include <sys/param.h> @@ -570,7 +570,7 @@ main(int argc, char **argv) rndctl_t rctl; int ch, cmd, lflag, mflag, sflag; u_int32_t type; - char name[16]; + char name[16] = ""; const char *filename = NULL; if (SHA3_Selftest() != 0) @@ -695,12 +695,6 @@ main(int argc, char **argv) usage(); /* - * If not listing, we need a device name or a type. - */ - if (lflag == 0 && cmd == 0 && sflag == 0) - usage(); - - /* * Modify request. */ if (mflag != 0) { Index: src/sys/kern/kern_entropy.c diff -u src/sys/kern/kern_entropy.c:1.57.4.1 src/sys/kern/kern_entropy.c:1.57.4.2 --- src/sys/kern/kern_entropy.c:1.57.4.1 Mon Jul 31 15:43:33 2023 +++ src/sys/kern/kern_entropy.c Mon Jul 31 15:57:43 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: kern_entropy.c,v 1.57.4.1 2023/07/31 15:43:33 martin Exp $ */ +/* $NetBSD: kern_entropy.c,v 1.57.4.2 2023/07/31 15:57:43 martin 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.57.4.1 2023/07/31 15:43:33 martin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: kern_entropy.c,v 1.57.4.2 2023/07/31 15:57:43 martin 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; }