summaryrefslogtreecommitdiff
path: root/util/libreboot-utils/nvmutil.c
diff options
context:
space:
mode:
authorLeah Rowe <leah@libreboot.org>2026-03-25 17:52:53 +0000
committerLeah Rowe <leah@libreboot.org>2026-03-26 06:59:42 +0000
commit00b56c0278966edfd2acc29e55efac734982013e (patch)
tree1dc786fca0aad88519b201cfb862d00d6cc65454 /util/libreboot-utils/nvmutil.c
parent6c8cf9a9e0bbeae87845f602794d9f4ac6635ab1 (diff)
libreboot-utils: tidy up rand
also re-add /dev/urandom support, as a config option Signed-off-by: Leah Rowe <leah@libreboot.org>
Diffstat (limited to 'util/libreboot-utils/nvmutil.c')
-rw-r--r--util/libreboot-utils/nvmutil.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/util/libreboot-utils/nvmutil.c b/util/libreboot-utils/nvmutil.c
index e02f60af..313390c0 100644
--- a/util/libreboot-utils/nvmutil.c
+++ b/util/libreboot-utils/nvmutil.c
@@ -44,8 +44,14 @@ main(int argc, char *argv[])
#if (OpenBSD) >= 604
if (pledge("stdio flock rpath wpath cpath unveil", NULL) == -1)
err_no_cleanup(0, errno, "pledge plus unveil, main");
+#if defined(USE_URANDOM) && \
+ ((USE_URANDOM) > 0)
if (unveil("/dev/null", "r") == -1)
err_no_cleanup(0, errno, "unveil r: /dev/null");
+#else
+ if (unveil("/dev/urandom", "r") == -1)
+ err_no_cleanup(0, errno, "unveil r: /dev/urandom");
+#endif
#elif (OpenBSD) >= 509
if (pledge("stdio flock rpath wpath cpath", NULL) == -1)
err_no_cleanup(0, errno, "pledge, main");