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
This commit is contained in:
parent
f8079ac547
commit
30c052bdf9
|
@ -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, const char *name, uint32_t type,
|
|||
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 *data)
|
|||
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;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue