summaryrefslogtreecommitdiff
path: root/util/libreboot-utils/lib/mkhtemp.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/lib/mkhtemp.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/lib/mkhtemp.c')
-rw-r--r--util/libreboot-utils/lib/mkhtemp.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/util/libreboot-utils/lib/mkhtemp.c b/util/libreboot-utils/lib/mkhtemp.c
index 191d657c..d22f526a 100644
--- a/util/libreboot-utils/lib/mkhtemp.c
+++ b/util/libreboot-utils/lib/mkhtemp.c
@@ -903,11 +903,12 @@ mkhtemp_fill_random(char *p, size_t xc)
for (chx = 0; chx < xc; chx++) {
retry_rand:
- /* on bsd: uses arc4random
- on linux: uses getrandom
- *never returns error*
+ /* /dev/urandom if enabled, OR:
+ * on bsd: uses arc4random
+ * on linux: uses getrandom
+ NOTE: *aborts* on error, regardless of method
*/
- r = rlong(); /* always returns successful */
+ r = rlong(); /* always *returns* successfully */
if (r >= limit)
goto retry_rand;