You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Originally, the high_quality_required boolean argument controlled two
things: whether to extend any random data we successfully read with
pseudo-random data, and whether to return -ENODATA if we couldn't read
any data at all.
The boolean got replaced by RANDOM_EXTEND_WITH_PSEUDO, but this name
doesn't really cover the second part nicely. Moreover hiding both
changes of behaviour under a single flag is confusing. Hence, let's
split this part off under a new flag, and use it from random_bytes().
Copy file name to clipboardExpand all lines: src/basic/random-util.h
+1Lines changed: 1 addition & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -8,6 +8,7 @@
8
8
typedefenumRandomFlags {
9
9
RANDOM_EXTEND_WITH_PSEUDO=1 << 0, /* If we can't get enough genuine randomness, but some, fill up the rest with pseudo-randomness */
10
10
RANDOM_BLOCK=1 << 1, /* Rather block than return crap randomness (only if the kernel supports that) */
11
+
RANDOM_DONT_DRAIN=1 << 2, /* If we can't get any randomness at all, return early with -EAGAIN */
11
12
} RandomFlags;
12
13
13
14
intgenuine_random_bytes(void*p, size_tn, RandomFlagsflags); /* returns "genuine" randomness, optionally filled upwith pseudo random, if not enough is available */
0 commit comments