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 <leah@libreboot.org>
This commit is contained in:
Leah Rowe
2026-03-08 13:15:54 +00:00
parent e5d0dee668
commit 92bd44676a
+6
View File
@@ -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__