|RANDOM(4)||Device Drivers Manual||RANDOM(4)|
— random data source device
urandom device produces high quality
pseudo-random output data without ever blocking.
Entropy data stored previously is provided to the kernel during the boot sequence and used as inner-state of a stream cipher. High quality data is available immediately upon kernel startup. System activity (such as disk, network, and clock device interrupts), and hardware random generator output is collected, whitened with a crc and hash, then periodically folded together with stream cipher inner-state and outer-state to create a new inner state. Reads from all consumers (including the kernel itself, which makes many requests per second) are sliced from the same output stream, which carves the stream cipher output unpredictably and helps improve forward and backtracking protection beyond the strength of the stream cipher.
urandom device is intended to be used
in scripts. In C programs, use the
arc4random(3) family of functions
instead, which can be called in almost all coding environments, including
unveil(2), and which avoids accessing a
filesystem device every time.
For portability reasons, never use /dev/random. On OpenBSD, it is an alias for /dev/urandom, but on many other systems misbehaves by blocking because their random number generators lack a robust boot-time initialization sequence.
random device first appeared in Linux in
devices have been available since OpenBSD 2.0.
No randomness testing suite provided.
|September 28, 2019||OpenBSD-current|