summaryrefslogtreecommitdiff
path: root/util/nvmutil
diff options
context:
space:
mode:
authorLeah Rowe <leah@libreboot.org>2026-03-12 13:20:10 +0000
committerLeah Rowe <leah@libreboot.org>2026-03-12 13:21:03 +0000
commit1184dcb05c9923936c121ee2ad61ea966bc562ea (patch)
tree98b5e5299f34fc56d406e498312326584dbe89f7 /util/nvmutil
parent74f2d9a1f353d86a29cbf5a2baf82d5d31a76572 (diff)
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>
Diffstat (limited to 'util/nvmutil')
-rw-r--r--util/nvmutil/nvmutil.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/util/nvmutil/nvmutil.c b/util/nvmutil/nvmutil.c
index a8d97d09..475e0a7e 100644
--- a/util/nvmutil/nvmutil.c
+++ b/util/nvmutil/nvmutil.c
@@ -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)