diff --git a/man2/getrandom.2 b/man2/getrandom.2 index 4914b1246..6442ce4d8 100644 --- a/man2/getrandom.2 +++ b/man2/getrandom.2 @@ -181,7 +181,7 @@ When reading from .IR /dev/urandom , a maximum of 33554431 bytes is returned by a single call to .BR getrandom () -on a system where +on systems where .I int has a size of 32 bits. .IP * @@ -189,7 +189,7 @@ When reading from .IR /dev/random , a maximum of 512 bytes is returned. .SS Initialization of the entropy pool -The kernel collects bits of entropy from environment. +The kernel collects bits of entropy from the environment. When a sufficient number of random bits has been collected, the .I /dev/urandom entropy pool is considered to be initialized. diff --git a/man4/random.4 b/man4/random.4 index 3fbb16184..3cf06b818 100644 --- a/man4/random.4 +++ b/man4/random.4 @@ -38,10 +38,13 @@ The generator also keeps an estimate of the number of bits of noise in the entropy pool. From this entropy pool, random numbers are created. .LP -Linux 3.17 and later provides the simpler and safer (see below) +Linux 3.17 and later provides the simpler and safer .BR getrandom (2) -interface which requires no special files. -.LP +interface which requires no special files; +see the +.BR getrandom (2) +manual page for details. + When read, the .I /dev/urandom device returns random bytes using a pseudorandom @@ -52,7 +55,6 @@ If this is of concern in your application, use .BR getrandom (2) or \fI/dev/random\fP instead. -.LP The \fI/dev/random\fP device is a legacy interface which dates back to a time where the cryptographic primitives used in the implementation of \fI/dev/urandom\fP were not widely trusted. @@ -60,15 +62,16 @@ It will return random bytes only within the estimated number of bits of fresh noise in the entropy pool, blocking if necessary. \fI/dev/random\fP is suitable for applications that need very high quality randomness, and can afford indeterminate delays. + When the entropy pool is empty, reads from \fI/dev/random\fP will block until additional environmental noise is gathered. If .BR open (2) is called for .I /dev/random -with the flag -.BR O_NONBLOCK , -a subsequent +with the +.BR O_NONBLOCK +flag, a subsequent .BR read (2) will not block if the requested number of bytes is not available. Instead, the available bytes are returned. @@ -79,9 +82,9 @@ will return -1 and will be set to .BR EAGAIN . -The flag +The .B O_NONBLOCK -has no effect when opening +flag has no effect when opening .IR /dev/urandom . When calling .BR read (2) @@ -119,7 +122,7 @@ read from both files, but it will not make reads from The .IR /dev/random interface is considered a legacy interface, and -.IR /dev/urandom , +.IR /dev/urandom is preferred and sufficient in all use cases, with the exception of applications which require randomness during early boot time; for these applications,