Main index | Section 4 | 日本語 | Options |
The generator will start in an unseeded state, and will block reads until it is seeded for the first time.
To provide prompt access to the random device at boot time, FreeBSD automatically persists some entropy data in /boot/entropy for the loader to provide to the kernel. Additional entropy is regularly saved in /var/db/entropy. This saved entropy is sufficient to unblock the random device on devices with writeable media.
Embedded applications without writable media must determine their own scheme for re-seeding the random device on boot, or accept that the device will remain unseeded and block reads indefinitely. See SECURITY CONSIDERATIONS for more detail.
In addition to read(2), the direct output of the abstract kernel entropy device can be read with getrandom(2), getentropy(3), or the sysctl(8) pseudo-variable kern.arandom.
To see the current settings of the software random device, use the command line:
sysctl kern.random
which results in something like:
kern.random.block_seeded_status: 0 kern.random.fortuna.minpoolsize: 64 kern.random.harvest.mask_symbolic: ENABLEDSOURCE,[DISABLEDSOURCE],...,CACHED kern.random.harvest.mask_bin: 00000010000000111011111 kern.random.harvest.mask: 66015 kern.random.use_chacha20_cipher: 0 kern.random.random_sources: 'Intel Secure Key RNG'
Other than kern.random.block_seeded_status, kern.random.fortuna.minpoolsize, and kern.random.harvest.mask, all settings are read-only.
The kern.random.fortuna.minpoolsize sysctl is used to set the seed threshold. A smaller number gives a faster seed, but a less secure one. In practice, values between 64 and 256 are acceptable.
The kern.random.harvest.mask bitmask is used to select the possible entropy sources. A 0 (zero) value means the corresponding source is not considered as an entropy source. Set the bit to 1 (one) if you wish to use that source. The kern.random.harvest.mask_bin and kern.random.harvest.mask_symbolic sysctls can be used to confirm settings in a human readable form. Disabled items in the latter item are listed in square brackets. See random_harvest(9) for more on the harvesting of entropy.
/dev/random
/dev/urandom | |
Cryptography Engineering, ISBN 978-0-470-47424-2, Wiley,
, , ,The Fortuna algorithm was designed by Niels Ferguson, Bruce Schneier, and Tadayoshi Kohno.
When options RANDOM_ENABLE_UMA is enabled, the /dev/random device will obtain entropy from the zone allocator. This is a very high rate source with significant performance impact. Therefore, it is disabled by default.
When options RANDOM_ENABLE_ETHER is enabled, the random device will obtain entropy from mbuf structures passing through the network stack. This source is both extremely expensive and a poor source of entropy, so it is disabled by default.
In some embedded cases, it may be difficult to find enough randomness to seed a random number generator until a system is fully operational. In these cases, is the responsibility of the system architect to ensure that blocking is acceptable, or that the random device is seeded. (This advice does not apply to typical consumer systems.)
To emulate embedded systems, developers may set the kern.random.block_seeded_status tunable to 1 to verify boot does not require early availability of the random device.
RANDOM (4) | April 15, 2019 |
Main index | Section 4 | 日本語 | Options |
Please direct any comments about this manual page service to Ben Bullock. Privacy policy.