xref: /openbsd-src/share/man/man4/random.4 (revision 2b0358df1d88d06ef4139321dd05bd5e05d91eaf)
1.\"	$OpenBSD: random.4,v 1.22 2008/10/10 20:13:29 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.\"
14.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
15.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
18.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24.\" SUCH DAMAGE.
25.\"
26.Dd $Mdocdate: October 10 2008 $
27.Dt RANDOM 4
28.Os
29.Sh NAME
30.Nm random ,
31.Nm srandom ,
32.Nm urandom ,
33.Nm arandom
34.Nd random data source devices
35.Sh SYNOPSIS
36.Fd #include <sys/types.h>
37.Fd #include <dev/rndvar.h>
38.Fd #include <dev/rndioctl.h>
39.Sh DESCRIPTION
40The various
41.Nm
42devices produce random output data with different random qualities.
43Entropy data is collected from system activity (like disk and
44network device interrupts and such), and then run through various
45hash or message digest functions to generate the output.
46.Bl -hang -width /dev/srandomX
47.It Pa /dev/random
48This device is reserved for future support of hardware
49random generators.
50.It Pa /dev/srandom
51Strong random data.
52This device returns reliable random data.
53If sufficient entropy is not currently available (i.e., the entropy
54pool quality starts to run low), the driver pauses while more of
55such data is collected.
56The entropy pool data is converted into output data using MD5.
57.It Pa /dev/urandom
58Same as above, but does not guarantee the data to be strong.
59The entropy pool data is converted into output data using MD5.
60When the entropy pool quality runs low, the driver will continue
61to output data.
62.It Pa /dev/arandom
63As required, entropy pool data re-seeds an ARC4 generator,
64which then generates high-quality pseudo-random output data.
65.Pp
66The
67.Xr arc4random 3
68function in userland libraries seeds itself from this device,
69providing a second level of ARC4 hashed data.
70.El
71.Sh FILES
72.Bl -tag -width /dev/srandom -compact
73.It Pa /dev/random
74.It Pa /dev/srandom
75.It Pa /dev/urandom
76.It Pa /dev/arandom
77.El
78.Sh SEE ALSO
79.Xr arc4random 3 ,
80.Xr md5 3 ,
81.Xr random 3 ,
82.Xr amdpm 4 ,
83.Xr glxsb 4 ,
84.Xr pchb 4 ,
85.Xr md5 9 ,
86.Xr random 9
87.Sh HISTORY
88A
89.Nm
90device first appeared in the Linux operating system.
91This is a cloned interface.
92.Pp
93ARC4 routines added by David Mazieres.
94.Sh BUGS
95No randomness testing suite provided.
96