diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 2010-12-29 17:51:49 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 2010-12-29 17:51:49 +0000 |
commit | a7da0ea7b17a1ffea64fe1ef52117a4718917498 (patch) | |
tree | 68ddb90754241d089bd523f0907a8a28d60fabaa | |
parent | c3e160d707f0afa39cc7ec59bdfb727386471934 (diff) |
the random ioctl stuff is not very useful. I want to see all the
non-essential parts of rnd.c removed so that we can keep our eye on
what the code should be doing.
ok tedu who had a similar diff in the past
-rw-r--r-- | share/man/man4/random.4 | 5 | ||||
-rw-r--r-- | sys/dev/rnd.c | 50 | ||||
-rw-r--r-- | sys/dev/rndioctl.h | 52 | ||||
-rw-r--r-- | usr.bin/kdump/Makefile | 3 | ||||
-rw-r--r-- | usr.bin/kdump/mkioctls | 3 |
5 files changed, 5 insertions, 108 deletions
diff --git a/share/man/man4/random.4 b/share/man/man4/random.4 index 765ef98f12c..0912ff2a3c4 100644 --- a/share/man/man4/random.4 +++ b/share/man/man4/random.4 @@ -1,4 +1,4 @@ -.\" $OpenBSD: random.4,v 1.23 2010/10/03 23:14:22 tedu Exp $ +.\" $OpenBSD: random.4,v 1.24 2010/12/29 17:51:47 deraadt Exp $ .\" .\" Copyright (c) 1996, 1997 Michael Shalayeff .\" @@ -23,7 +23,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd $Mdocdate: October 3 2010 $ +.Dd $Mdocdate: December 29 2010 $ .Dt RANDOM 4 .Os .Sh NAME @@ -33,7 +33,6 @@ .Sh SYNOPSIS .Fd #include <sys/types.h> .Fd #include <dev/rndvar.h> -.Fd #include <dev/rndioctl.h> .Sh DESCRIPTION The various .Nm diff --git a/sys/dev/rnd.c b/sys/dev/rnd.c index 3607f48aab5..0709f5dac4c 100644 --- a/sys/dev/rnd.c +++ b/sys/dev/rnd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rnd.c,v 1.106 2010/12/24 06:23:36 deraadt Exp $ */ +/* $OpenBSD: rnd.c,v 1.107 2010/12/29 17:51:48 deraadt Exp $ */ /* * rnd.c -- A strong random number generator @@ -189,7 +189,6 @@ #include <crypto/arc4.h> #include <dev/rndvar.h> -#include <dev/rndioctl.h> #ifdef RNDEBUG int rnd_debug = 0x0000; @@ -1075,7 +1074,6 @@ int randomioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct proc *p) { int ret = 0; - u_int cnt; switch (cmd) { case FIOASYNC: @@ -1086,52 +1084,6 @@ randomioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct proc *p) /* Handled in the upper FS layer. */ break; - case RNDGETENTCNT: - mtx_enter(&rndlock); - *(u_int *)data = random_state.entropy_count; - mtx_leave(&rndlock); - break; - case RNDADDTOENTCNT: - if (suser(p, 0) != 0) - ret = EPERM; - else { - cnt = *(u_int *)data; - mtx_enter(&rndlock); - random_state.entropy_count += cnt; - if (random_state.entropy_count > POOLBITS) - random_state.entropy_count = POOLBITS; - mtx_leave(&rndlock); - } - break; - case RNDZAPENTCNT: - if (suser(p, 0) != 0) - ret = EPERM; - else { - mtx_enter(&rndlock); - random_state.entropy_count = 0; - mtx_leave(&rndlock); - } - break; - case RNDSTIRARC4: - if (suser(p, 0) != 0) - ret = EPERM; - else if (random_state.entropy_count < 64) - ret = EAGAIN; - else { - mtx_enter(&rndlock); - arc4random_initialized = 0; - mtx_leave(&rndlock); - } - break; - case RNDCLRSTATS: - if (suser(p, 0) != 0) - ret = EPERM; - else { - mtx_enter(&rndlock); - bzero(&rndstats, sizeof(rndstats)); - mtx_leave(&rndlock); - } - break; default: ret = ENOTTY; } diff --git a/sys/dev/rndioctl.h b/sys/dev/rndioctl.h deleted file mode 100644 index e70e8478416..00000000000 --- a/sys/dev/rndioctl.h +++ /dev/null @@ -1,52 +0,0 @@ -/* $OpenBSD: rndioctl.h,v 1.10 2003/06/02 19:24:22 mickey Exp $ */ - -/* - * Copyright (c) 1996,2000 Michael Shalayeff. - * - * This software derived from one contributed by Theodore Ts'o. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * 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. - * - */ - - -#ifndef __RNDIOCTL_H__ -#define __RNDIOCTL_H__ - -/* ioctl()'s for the random number generator */ - -struct rnd_pool_info { - size_t entropy_count; - size_t buf_size; - u_int32_t *buf; -}; - -#define RNDGETENTCNT _IOR('R', 0, u_int) -#define RNDADDTOENTCNT _IOW('R', 1, u_int) -#define RNDGETPOOL _IOWR('R', 2, struct rnd_pool_info) -#define RNDADDENTROPY _IOW('R', 3, u_int) -#define RNDZAPENTCNT _IO( 'R', 4) -#define RNDSTIRARC4 _IO( 'R', 5) -#define RNDCLRSTATS _IO( 'R', 6) - - -#endif /* __RNDIOCTL_H__ */ diff --git a/usr.bin/kdump/Makefile b/usr.bin/kdump/Makefile index 7e3369a6f3c..34c1d0936be 100644 --- a/usr.bin/kdump/Makefile +++ b/usr.bin/kdump/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.16 2005/07/31 10:11:19 deraadt Exp $ +# $OpenBSD: Makefile,v 1.17 2010/12/29 17:51:48 deraadt Exp $ LDSTATIC=${STATIC} PROG= kdump @@ -15,7 +15,6 @@ ioctl.c: ${.CURDIR}/Makefile ${.CURDIR}/mkioctls ${DESTDIR}/usr/include/dev/biovar.h \ ${DESTDIR}/usr/include/dev/ccdvar.h \ ${DESTDIR}/usr/include/dev/ramdisk.h \ - ${DESTDIR}/usr/include/dev/rndioctl.h \ ${DESTDIR}/usr/include/dev/systrace.h \ ${DESTDIR}/usr/include/dev/wscons/wsconsio.h \ ${DESTDIR}/usr/include/dev/vndioctl.h \ diff --git a/usr.bin/kdump/mkioctls b/usr.bin/kdump/mkioctls index a45caac4a4f..c680d44dbf2 100644 --- a/usr.bin/kdump/mkioctls +++ b/usr.bin/kdump/mkioctls @@ -1,5 +1,5 @@ #!/bin/sh - -# $OpenBSD: mkioctls,v 1.22 2007/06/02 15:14:36 deraadt Exp $ +# $OpenBSD: mkioctls,v 1.23 2010/12/29 17:51:48 deraadt Exp $ # # Copyright (c) 1994 @@ -77,7 +77,6 @@ BEGIN { print "#include <dev/biovar.h>" print "#include <dev/ccdvar.h>" print "#include <dev/ramdisk.h>" - print "#include <dev/rndioctl.h>" print "#include <dev/systrace.h>" print "#include <dev/wscons/wsconsio.h>" print "#include <dev/vndioctl.h>" |