mirror of https://github.com/mkerrisk/man-pages
getrandom.2, random.7: wfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
This commit is contained in:
parent
379df7a0ec
commit
dce6b79650
|
@ -46,7 +46,7 @@ By default,
|
|||
.BR getrandom ()
|
||||
draws entropy from the
|
||||
.I urandom
|
||||
pool (i.e., the same source as the
|
||||
source (i.e., the same source as the
|
||||
.IR /dev/urandom
|
||||
device).
|
||||
This behavior can be changed via the
|
||||
|
@ -55,7 +55,7 @@ argument.
|
|||
|
||||
If the
|
||||
.I urandom
|
||||
pool has been initialized,
|
||||
source has been initialized,
|
||||
reads of up to 256 bytes will always return as many bytes as
|
||||
requested and will not be interrupted by signals.
|
||||
No such guarantees apply for larger buffer sizes.
|
||||
|
@ -65,7 +65,7 @@ it may return a partially filled buffer, or fail with the error
|
|||
|
||||
If the
|
||||
.I urandom
|
||||
pool has not yet been initialized, then
|
||||
source has not yet been initialized, then
|
||||
.BR getrandom ()
|
||||
will block, unless
|
||||
.B GRND_NONBLOCK
|
||||
|
@ -80,20 +80,20 @@ ORed together:
|
|||
.B GRND_RANDOM
|
||||
If this bit is set, then random bytes are drawn from the
|
||||
.I random
|
||||
pool
|
||||
source
|
||||
(i.e., the same source as the
|
||||
.IR /dev/random
|
||||
device)
|
||||
instead of the
|
||||
.I urandom
|
||||
pool.
|
||||
source.
|
||||
The
|
||||
.I random
|
||||
pool is limited based on the entropy that can be obtained from environmental
|
||||
source is limited based on the entropy that can be obtained from environmental
|
||||
noise.
|
||||
If the number of available bytes in the
|
||||
.I random
|
||||
pool is less than requested in
|
||||
source is less than requested in
|
||||
.IR buflen ,
|
||||
the call returns just the available random bytes.
|
||||
If no random bytes are available, the behavior depends on the presence of
|
||||
|
@ -105,12 +105,12 @@ argument.
|
|||
.B GRND_NONBLOCK
|
||||
By default, when reading from the
|
||||
.IR random
|
||||
pool,
|
||||
source,
|
||||
.BR getrandom ()
|
||||
blocks if no random bytes are available,
|
||||
and when reading from the
|
||||
.IR urandom
|
||||
pool, it blocks if the entropy pool has not yet been initialized.
|
||||
source, it blocks if the entropy pool has not yet been initialized.
|
||||
If the
|
||||
.B GRND_NONBLOCK
|
||||
flag is set, then
|
||||
|
@ -132,7 +132,7 @@ was specified in
|
|||
.IR flags
|
||||
and insufficient entropy was present in the
|
||||
.IR random
|
||||
pool or the system call was interrupted by a signal.
|
||||
source or the system call was interrupted by a signal.
|
||||
.PP
|
||||
On error, \-1 is returned, and
|
||||
.I errno
|
||||
|
@ -196,7 +196,7 @@ As of Linux 3.19 the following limits apply:
|
|||
.IP * 3
|
||||
When reading from the
|
||||
.IR urandom
|
||||
pool, a maximum of 33554431 bytes is returned by a single call to
|
||||
source, a maximum of 33554431 bytes is returned by a single call to
|
||||
.BR getrandom ()
|
||||
on systems where
|
||||
.I int
|
||||
|
@ -204,11 +204,11 @@ has a size of 32 bits.
|
|||
.IP *
|
||||
When reading from the
|
||||
.IR random
|
||||
pool, a maximum of 512 bytes is returned.
|
||||
source, a maximum of 512 bytes is returned.
|
||||
.SS Interruption by a signal handler
|
||||
When reading from the
|
||||
.I urandom
|
||||
pool
|
||||
source
|
||||
.RB ( GRND_RANDOM
|
||||
is not set),
|
||||
.BR getrandom ()
|
||||
|
@ -223,7 +223,7 @@ from kernel memory to
|
|||
.IR buf .
|
||||
When reading from the
|
||||
.I random
|
||||
pool
|
||||
source
|
||||
.RB ( GRND_RANDOM
|
||||
is set),
|
||||
.BR getrandom ()
|
||||
|
@ -236,7 +236,7 @@ The behavior when a call to
|
|||
.BR getrandom ()
|
||||
that is blocked while reading from the
|
||||
.I urandom
|
||||
pool is interrupted by a signal handler
|
||||
source is interrupted by a signal handler
|
||||
depends on the initialization state of the entropy buffer
|
||||
and on the request size,
|
||||
.IR buflen .
|
||||
|
@ -259,7 +259,7 @@ Instead, it will return all of the bytes that have been requested.
|
|||
|
||||
When reading from the
|
||||
.IR random
|
||||
pool, blocking requests of any size can be interrupted by a signal handler
|
||||
source, blocking requests of any size can be interrupted by a signal handler
|
||||
(the call fails with the error
|
||||
.BR EINTR ).
|
||||
|
||||
|
@ -267,7 +267,7 @@ Using
|
|||
.BR getrandom ()
|
||||
to read small buffers (<=\ 256 bytes) from the
|
||||
.I urandom
|
||||
pool is the preferred mode of usage.
|
||||
source is the preferred mode of usage.
|
||||
|
||||
The special treatment of small values of
|
||||
.I buflen
|
||||
|
|
|
@ -47,17 +47,17 @@ This system call provides access either to the same source as
|
|||
.I /dev/urandom
|
||||
(called the
|
||||
.I urandom
|
||||
pool in this page)
|
||||
source in this page)
|
||||
or to the same source as
|
||||
.I /dev/random
|
||||
(called the
|
||||
.I random
|
||||
pool in this page).
|
||||
source in this page).
|
||||
The default is the
|
||||
.I urandom
|
||||
pool; the
|
||||
source; the
|
||||
.I random
|
||||
pool is selected by specifying the
|
||||
source is selected by specifying the
|
||||
.BR GRND_RANDOM
|
||||
flag to the system call.
|
||||
.\"
|
||||
|
@ -85,7 +85,7 @@ flag or the
|
|||
device.
|
||||
The cryptographic algorithms used for the
|
||||
.IR urandom
|
||||
pool are quite conservative, and so should be sufficient for all purposes.
|
||||
source are quite conservative, and so should be sufficient for all purposes.
|
||||
|
||||
The disadvantage of
|
||||
.B GRND_RANDOM
|
||||
|
|
Loading…
Reference in New Issue