util/nvmutil: disable urandom if not found

disable random mac address generation on really old
operating systems.

Signed-off-by: Leah Rowe <leah@libreboot.org>
This commit is contained in:
Leah Rowe
2026-03-12 13:20:10 +00:00
parent 74f2d9a1f3
commit 1184dcb05c
+3 -5
View File
@@ -718,13 +718,8 @@ open_dev_urandom(void)
if (urandom_fd != -1)
return;
fprintf(stderr, "Can't open %s (will use %s instead)\n",
newrandom, oldrandom);
rname = oldrandom;
urandom_fd = open(rname, O_RDONLY | O_BINARY | O_NONBLOCK);
if (urandom_fd == -1)
err(errno, "%s: could not open", rname);
}
static void
@@ -1001,6 +996,9 @@ rhex(void)
static size_t n = 0;
static uint8_t rnum[12];
if (urandom_fd)
err(ECANCELED, "Your operating system has no /dev/[u]random");
if (!n) {
n = sizeof(rnum);
if (rw_file_exact(urandom_fd, rnum, n, 0, LESEN) == -1)