mirror of
https://codeberg.org/libreboot/lbmk.git
synced 2026-07-20 14:40:54 +02:00
libreboot-utils: tidy up rand
also re-add /dev/urandom support, as a config option Signed-off-by: Leah Rowe <leah@libreboot.org>
This commit is contained in:
@@ -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;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user