summaryrefslogtreecommitdiff
path: root/util/libreboot-utils/lib/rand.c
diff options
context:
space:
mode:
authorLeah Rowe <leah@libreboot.org>2026-03-25 19:50:01 +0000
committerLeah Rowe <leah@libreboot.org>2026-03-25 19:50:01 +0000
commitdbfd80497db7d1d099a247e2466832301e5067ec (patch)
tree2539913b950a8527283addeddf920be2ea88a880 /util/libreboot-utils/lib/rand.c
parent302ebbedee7b7c0a5e70d402d94615814ed35bc7 (diff)
cleanup
Signed-off-by: Leah Rowe <leah@libreboot.org>
Diffstat (limited to 'util/libreboot-utils/lib/rand.c')
-rw-r--r--util/libreboot-utils/lib/rand.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/util/libreboot-utils/lib/rand.c b/util/libreboot-utils/lib/rand.c
index 8e707ba8..b5d6d459 100644
--- a/util/libreboot-utils/lib/rand.c
+++ b/util/libreboot-utils/lib/rand.c
@@ -59,7 +59,7 @@ retry_rand:
#elif defined(__linux__)
retry_rand:
if ((rc = (ssize_t)syscall(SYS_getrandom,
- buf + off, n - off, 0)) < 0) {
+ (unsigned char *)buf + off, n - off, 0)) < 0) {
#else
#error Unsupported operating system (possibly unsecure randomisation)
#endif
@@ -80,6 +80,10 @@ retry_rand:
goto out;
err:
+ /* since arc4random always returns
+ * successful, we treat urandom/getrandom
+ * failures as fatal and abort accordingly
+ */
err_no_cleanup(1, ECANCELED,
"Randomisation failure, possibly unsupported in your kernel.");
exit(EXIT_FAILURE);