xref: /openbsd/share/man/man4/random.4 (revision 133306f0)
1.\"	$OpenBSD: random.4,v 1.10 2000/06/19 03:21:51 deraadt 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.Pp
54.Bl -hang -width /dev/srandomX
55.It /dev/random
56This device is reserved for future support of hardware
57random generators.
58.It /dev/srandom
59Strong random data.  This device returns reliable random data.
60If sufficient entropy is not currently available (i.e., the entropy
61pool quality starts to run low), the driver pauses while more of
62such data is collected.
63The entropy pool data is converted into output data using MD5.
64.It /dev/urandom
65Same as above, but does not guarantee the data to be strong.
66The entropy pool data is converted into output data using MD5.
67When the entropy pool quality runs low, the driver will continue
68to output data.
69.It /dev/prandom
70Simple pseudo-random generator.
71.It /dev/arandom
72As required, entropy pool data re-seeds an ARC4 generator,
73which then generates high-quality pseudo-random output data.
74The
75.Xr arc4random 3
76function in userland libraries seeds itself from this device,
77providing a second level of ARC4 hashed data.
78.Sh SEE ALSO
79.Xr arc4random 3 ,
80.Xr md5 3 ,
81.Xr random 3 ,
82.Xr pchb 4 ,
83.Xr md5 9 ,
84.Xr random 9
85.Sh FILES
86.Bl -tag -width /dev/srandom
87.It Pa /dev/random, /dev/srandom, /dev/urandom, /dev/prandom, /dev/arandom
88.El
89.Sh BUGS
90No randomness testing suite provided.
91.Sh HISTORY
92A
93.Nm
94device first appeared in Linux operating system.  This is a cloned interface.
95.Pp
96ARC4 routines added by David Mazieres.
97