aboutsummaryrefslogtreecommitdiff
path: root/usr.sbin
diff options
context:
space:
mode:
authorPhilippe Charnier <charnier@FreeBSD.org>1997-10-13 11:08:47 +0000
committerPhilippe Charnier <charnier@FreeBSD.org>1997-10-13 11:08:47 +0000
commit5dbfe9a1380b39d1cdf17ec8d9bcbcdaa5f1cc3a (patch)
treeda54c0d06f566cf3d3f3de4c11d6d1d6e95dff2c /usr.sbin
parent12873ebf5693791f06eedf5a90ae32417df2aa42 (diff)
Notes
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/rndcontrol/random.431
-rw-r--r--usr.sbin/rndcontrol/rndcontrol.844
-rw-r--r--usr.sbin/rndcontrol/rndcontrol.c33
3 files changed, 63 insertions, 45 deletions
diff --git a/usr.sbin/rndcontrol/random.4 b/usr.sbin/rndcontrol/random.4
index 1fc820fdce1c..b563e56dd90a 100644
--- a/usr.sbin/rndcontrol/random.4
+++ b/usr.sbin/rndcontrol/random.4
@@ -36,7 +36,7 @@
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
.\" OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
-.\" $Id$
+.\" $Id: random.4,v 1.5 1997/02/22 16:12:46 peter Exp $
.\"
.Dd October 21, 1995
.Dt RANDOM 4 i386
@@ -109,16 +109,18 @@ This interface will return the requested number of random bytes,
and place it in the requested buffer.
.Pp
The two other interfaces are two character devices
-.Nm /dev/random
+.Pa /dev/random
and
-.Nm /dev/urandom . /dev/random
-is suitable for use when very high quality randomness is desired
-(for example, for key generation.), as it will only return a maximum
+.Pa /dev/urandom .
+The
+.Pa /dev/random
+device is suitable for use when very high quality randomness is desired
+(e.g. for key generation), as it will only return a maximum
of the number of bits of randomness (as estimated by the random number
generator) contained in the entropy pool.
.Pp
The
-.Nm /dev/urandom
+.Pa /dev/urandom
device does not have this limit, and will return as many bytes as are
requested. As more and more random bytes are requested without giving
time for the entropy pool to recharge, this will result in lower quality
@@ -145,9 +147,16 @@ unpredictable. The routines try to estimate how many bits of
randomness a particular interrupt channel offers, by keeping track
of the first and second order deltas in the interrupt timings.
.Sh ACKNOWLEDGEMENTS
-The original core code was written by Theodore Ts'o, and was intended
-for the Linux platform. This was ported to FreeBSD by Mark Murray,
-who also wrote the rndcontrol utility.
+The original core code was written by
+.An Theodore Ts'o ,
+and was intended
+for the Linux platform. This was ported to
+.Bx Free
+by
+.An Mark Murray ,
+who also wrote the
+.Xr rndcontrol 8
+utility.
.Pp
Ideas for constructing this random number generator were derived
from the Pretty Good Privacy's random number generator, and from
@@ -172,7 +181,7 @@ Eastlake, Steve Crocker, and Jeff Schiller.
.El
.Sh HISTORY
The
-.Nm random ,
-.Nm urandom
+.Pa random ,
+.Pa urandom
files appeared in
.Fx 2.1.5 .
diff --git a/usr.sbin/rndcontrol/rndcontrol.8 b/usr.sbin/rndcontrol/rndcontrol.8
index 477ca9567798..d2dedbfd2b64 100644
--- a/usr.sbin/rndcontrol/rndcontrol.8
+++ b/usr.sbin/rndcontrol/rndcontrol.8
@@ -30,61 +30,67 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $Id$
+.\" $Id: rndcontrol.8,v 1.6 1997/02/22 16:12:47 peter Exp $
.\"
.Dd October 20, 1995
.Dt RNDCONTROL 8
.Os FreeBSD 2
.Sh NAME
-.Nm \&rndcontrol
-.Nd a utility for manipulating the /dev/random device.
+.Nm rndcontrol
+.Nd a utility for manipulating the /dev/random device
.Sh SYNOPSIS
-.Nm \&rndcontrol
+.Nm rndcontrol
.Op Fl q
.Op Fl s Ar irq_no
.Op Fl c Ar irq_no
.Sh DESCRIPTION
The
-.Nm rndcontrol
+.Nm
command is used to set which interrupts are used to help randomise
the ``pool of entropy'' maintained by the kernel. The
-.Em /dev/random
+.Pa /dev/random
and
-.Em /dev/urandom
+.Pa /dev/urandom
devices are the user interface to this source of randomness.
Any changes take effect immediately.
.Sh OPTIONS
-.TP
The following command line options are supported:
.Bl -tag -width indent
.It Fl q
-Turns off all output except errors.
+Turn off all output except errors.
.It Fl s Ar n
-Allows IRQ
-.Em n
+Allow IRQ
+.Ar n
to be used as a source of randomness. This option may be repeated for
more than one IRQ.
.It Fl c Ar n
-Stops IRQ
-.Em n
+Stop IRQ
+.Ar n
from being used as a source of randomness. This option may be repeated for
more than one IRQ.
+.El
.Pp
The default is to have no IRQ's being used.
.Pp
.Sh FILES
-.Bl -tag -width indent -compact
-.It Pa /dev/random - Secure random device
-.It Pa /dev/urandom - Random device
+.Bl -tag -width /dev/urandom -compact
+.It Pa /dev/random
+secure random device
+.It Pa /dev/urandom
+random device
.El
.Sh BUGS
Sure to be some.
.Sh "SEE ALSO"
.Xr random 4
.Sh AUTHOR
-Theodore Ts'o wrote the core code. Mark Murray ported this code to
-FreeBSD and wrote the support routines and constructed the man pages.
+.An Theodore Ts'o
+wrote the core code.
+.An Mark Murray
+ported this code to
+.Bx Free
+and wrote the support routines and constructed the man pages.
.Sh HISTORY
-.Nm rndcontrol
+.Nm Rndcontrol
first appeared in
.Fx 2.1.5 .
diff --git a/usr.sbin/rndcontrol/rndcontrol.c b/usr.sbin/rndcontrol/rndcontrol.c
index a03225c029ab..581bb0e9a074 100644
--- a/usr.sbin/rndcontrol/rndcontrol.c
+++ b/usr.sbin/rndcontrol/rndcontrol.c
@@ -29,22 +29,26 @@
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
- *
- * $Id: rndcontrol.c,v 1.7 1997/03/11 15:56:09 peter Exp $
- *
*/
+#ifndef lint
+static const char rcsid[] =
+ "$Id$";
+#endif /* not lint */
+
+#include <err.h>
+#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
-#include <stdio.h>
#include <fcntl.h>
#include <sys/ioctl.h>
-#include <sys/errno.h>
#include <machine/random.h>
-void usage(char *myname)
+static void
+usage()
{
- fprintf(stderr, "usage: %s [ [-q ] [-s N | -c M]... ]\n", myname);
+ fprintf(stderr, "usage: rndcontrol [-q] [-s irq_no] [-c irq_no]\n");
+ exit(1);
}
int
@@ -57,7 +61,7 @@ main(int argc, char *argv[])
fd = open("/dev/random", O_RDONLY, 0);
if (fd == -1) {
- perror("/dev/random");
+ warn("/dev/random");
return (1);
}
else {
@@ -72,7 +76,7 @@ main(int argc, char *argv[])
printf("%s: setting irq %d\n", argv[0], irq);
result = ioctl(fd, MEM_SETIRQ, (char *)&irq);
if (result == -1) {
- perror(argv[0]);
+ warn("%s", argv[0]);
return (1);
}
break;
@@ -82,23 +86,22 @@ main(int argc, char *argv[])
printf("%s: clearing irq %d\n", argv[0], irq);
result = ioctl(fd, MEM_CLEARIRQ, (char *)&irq);
if (result == -1) {
- perror(argv[0]);
+ warn("%s", argv[0]);
return (1);
}
break;
case '?':
default:
- usage(argv[0]);
- return (1);
+ usage();
}
}
if (verbose) {
result = ioctl(fd, MEM_RETURNIRQ, (char *)&irq);
if (result == -1) {
- perror(argv[0]);
+ warn("%s", argv[0]);
return (1);
}
- printf("%s: Interrupts in use:", argv[0]);
+ printf("%s: interrupts in use:", argv[0]);
for (i = 0; i < 16; i++)
if (irq & (1 << i))
printf(" %d", i);
@@ -108,7 +111,7 @@ main(int argc, char *argv[])
argv += optind;
if (argc) {
- fprintf(stderr, "%s: Unknown argument(s):", argv[-optind]);
+ fprintf(stderr, "%s: unknown argument(s): ", argv[-optind]);
for (i = 0; i < argc; i++)
fprintf(stderr, " %s", argv[i]);
fprintf(stderr, "\n");