1.\" $OpenBSD: random.4,v 1.12 2001/06/22 12:15:46 mpech Exp $ 2.\" 3.\" Copyright (c) 1996, 1997 Michael Shalayeff 4.\" 5.\" Redistribution and use in source and binary forms, with or without 6.\" modification, are permitted provided that the following conditions 7.\" are met: 8.\" 1. Redistributions of source code must retain the above copyright 9.\" notice, this list of conditions and the following disclaimer. 10.\" 2. Redistributions in binary form must reproduce the above copyright 11.\" notice, this list of conditions and the following disclaimer in the 12.\" documentation and/or other materials provided with the distribution. 13.\" 3. All advertising materials mentioning features or use of this software 14.\" must display the following acknowledgement: 15.\" This product includes software developed by Michael Shalayeff. 16.\" 4. Neither the name of the University nor the names of its contributors 17.\" may be used to endorse or promote products derived from this software 18.\" without specific prior written permission. 19.\" 20.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 21.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 22.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 23.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 24.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 25.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 26.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 27.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 28.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 29.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 30.\" SUCH DAMAGE. 31.\" 32.Dd March 25, 1996 33.Dt RANDOM 4 34.Os 35.Sh NAME 36.Nm random , 37.Nm srandom , 38.Nm urandom , 39.Nm prandom , 40.Nm arandom 41.Nd random data source devices 42.Sh SYNOPSIS 43.Fd #include <sys/types.h> 44.Fd #include <dev/rndvar.h> 45.Fd #include <dev/rndioctl.h> 46.Sh DESCRIPTION 47The various 48.Nm 49devices produce random output data with different random qualities. 50Entropy data is collected from system activity (like disk and 51network device interrupts and such), and then run through various 52hash or message digest functions to generate the output. 53.Bl -hang -width /dev/srandomX 54.It /dev/random 55This device is reserved for future support of hardware 56random generators. 57.It /dev/srandom 58Strong random data. This device returns reliable random data. 59If sufficient entropy is not currently available (i.e., the entropy 60pool quality starts to run low), the driver pauses while more of 61such data is collected. 62The entropy pool data is converted into output data using MD5. 63.It /dev/urandom 64Same as above, but does not guarantee the data to be strong. 65The entropy pool data is converted into output data using MD5. 66When the entropy pool quality runs low, the driver will continue 67to output data. 68.It /dev/prandom 69Simple pseudo-random generator. 70.It /dev/arandom 71As required, entropy pool data re-seeds an ARC4 generator, 72which then generates high-quality pseudo-random output data. 73.El 74.Pp 75The 76.Xr arc4random 3 77function in userland libraries seeds itself from this device, 78providing a second level of ARC4 hashed data. 79.Sh SEE ALSO 80.Xr arc4random 3 , 81.Xr md5 3 , 82.Xr random 3 , 83.Xr pchb 4 , 84.Xr md5 9 , 85.Xr random 9 86.Sh FILES 87.Bl -tag -width /dev/srandom -compact 88.It Pa /dev/random 89.It Pa /dev/srandom 90.It Pa /dev/urandom 91.It Pa /dev/prandom 92.It Pa /dev/arandom 93.El 94.Sh BUGS 95No randomness testing suite provided. 96.Sh HISTORY 97A 98.Nm 99device first appeared in Linux operating system. This is a cloned interface. 100.Pp 101ARC4 routines added by David Mazieres. 102