From 92bd44676ab92407e837d87db790fac674f2214a Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Sun, 8 Mar 2026 13:15:54 +0000 Subject: util/nvmutil: err if arc4random disused on bsd arc4random is superior, so using /dev/urandom would be a mistake. we only use that on linux, or old/weird unix. we would also use it on linux, but GNU prohibits nice things (its implementations are spotty, and old glibc doesn't have it - before 2022 there is libbsd, but i'm not importing that). not that it matters. we're not doing encryption. i'm just a stickler for technical correctness. Signed-off-by: Leah Rowe --- util/nvmutil/nvmutil.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/util/nvmutil/nvmutil.c b/util/nvmutil/nvmutil.c index 93cbc459..34bca222 100644 --- a/util/nvmutil/nvmutil.c +++ b/util/nvmutil/nvmutil.c @@ -268,9 +268,15 @@ main(int argc, char *argv[]) if (cmd_index == CMD_SETMAC) printf("Randomisation method: arc4random_buf\n"); #else +#if defined(__OpenBSD__) || defined(__FreeBSD__) || \ + defined(__NetBSD__) || defined(__APPLE__) || \ + defined(__DragonFly__) + err(ECANCELED, "Maintainer error: arc4random disabled on BSD/MacOS"); +#endif if (cmd_index == CMD_SETMAC) open_dev_urandom(); #endif + open_gbe_file(); #ifdef __OpenBSD__ -- cgit v1.2.1