Remove the #ifdev DEVRANDOM's, as promised.

/dev/random is now a part of the kernel! you will need to make
the device in /dev: sh MAKEDEV random
and take a look at some test code in src/tools/test/random.
This commit is contained in:
markm 1995-11-04 16:00:56 +00:00
parent 79aa178bc7
commit 92ae7d4bbb
11 changed files with 11 additions and 75 deletions

View File

@ -35,7 +35,7 @@
* SUCH DAMAGE.
*
* from: @(#)machdep.c 7.4 (Berkeley) 6/3/91
* $Id: machdep.c,v 1.146 1995/10/31 19:07:53 peter Exp $
* $Id: machdep.c,v 1.147 1995/11/02 09:52:40 peter Exp $
*/
#include "npx.h"
@ -1377,9 +1377,7 @@ init386(first)
#if NISA >0
isa_defaultirq();
#endif
#ifdef DEVRANDOM
rand_initialize();
#endif
r_gdt.rd_limit = sizeof(gdt) - 1;
r_gdt.rd_base = (int) gdt;

View File

@ -38,7 +38,7 @@
*
* from: Utah $Hdr: mem.c 1.13 89/10/08$
* from: @(#)mem.c 7.2 (Berkeley) 5/9/91
* $Id: mem.c,v 1.17 1995/10/30 22:39:34 markm Exp $
* $Id: mem.c,v 1.18 1995/11/04 13:52:30 bde Exp $
*/
/*
@ -79,10 +79,8 @@ memdev_init(dummy)
x=dev_add("/misc", "mem", mmopen, 0, DV_CHR, 0, 2, 0640);
x=dev_add("/misc", "kmem", mmopen, 1, DV_CHR, 0, 2, 0640);
x=dev_add("/misc", "null", mmopen, 2, DV_CHR, 0, 0, 0666);
#ifdef DEVRANDOM
x=dev_add("/misc", "random", mmopen, 3, DV_CHR, 0, 0, 0666);
x=dev_add("/misc", "urandom", mmopen, 4, DV_CHR, 0, 0, 0666);
#endif
x=dev_add("/misc", "zero", mmopen, 12, DV_CHR, 0, 0, 0666);
x=dev_add("/misc", "io", mmopen, 14, DV_CHR, 0, 2, 0640);
}
@ -138,9 +136,7 @@ mmrw(dev, uio, flags)
{
register int o;
register u_int c, v;
#ifdef DEVRANDOM
u_int poolsize;
#endif
register struct iovec *iov;
int error = 0;
caddr_t buf = NULL;
@ -200,7 +196,6 @@ mmrw(dev, uio, flags)
c = iov->iov_len;
break;
#ifdef DEVRANDOM
/* minor device 3 (/dev/random) is source of filth on read, rathole on write */
case 3:
if (uio->uio_rw == UIO_WRITE) {
@ -235,7 +230,6 @@ mmrw(dev, uio, flags)
c = min(c, poolsize);
error = uiomove(buf, (int)c, uio);
continue;
#endif
/* minor device 12 (/dev/zero) is source of nulls on read, rathole on write */
case 12:
@ -351,7 +345,6 @@ mmioctl(dev, cmd, cmdarg, flags, p)
int flags;
struct proc *p;
{
#ifdef DEVRANDOM
int error;
if (minor(dev) != 3 && minor(dev) != 4)
@ -384,7 +377,4 @@ mmioctl(dev, cmd, cmdarg, flags, p)
return (ENOTTY);
}
return (0);
#else
return (ENODEV);
#endif /* DEVRANDOM */
}

View File

@ -1,6 +1,6 @@
/*
* from: vector.s, 386BSD 0.1 unknown origin
* $Id: vector.s,v 1.12 1995/04/15 21:32:18 bde Exp $
* $Id: vector.s,v 1.13 1995/10/28 16:58:05 markm Exp $
*/
#include <i386/isa/icu.h>
@ -53,15 +53,11 @@
#define MAYBE_PUSHL_ES
#endif
#ifdef DEVRANDOM
#define ADDENTROPY(irq_num) \
/* Add this interrupt to the pool of entropy */ \
pushl $irq_num ; \
call _add_interrupt_randomness ; \
addl $4,%esp
#else
#define ADDENTROPY(irq_num)
#endif
/*
* Macros for interrupt interrupt entry, call to handler, and exit.

View File

@ -1,6 +1,6 @@
/*
* from: vector.s, 386BSD 0.1 unknown origin
* $Id: vector.s,v 1.12 1995/04/15 21:32:18 bde Exp $
* $Id: vector.s,v 1.13 1995/10/28 16:58:05 markm Exp $
*/
#include <i386/isa/icu.h>
@ -53,15 +53,11 @@
#define MAYBE_PUSHL_ES
#endif
#ifdef DEVRANDOM
#define ADDENTROPY(irq_num) \
/* Add this interrupt to the pool of entropy */ \
pushl $irq_num ; \
call _add_interrupt_randomness ; \
addl $4,%esp
#else
#define ADDENTROPY(irq_num)
#endif
/*
* Macros for interrupt interrupt entry, call to handler, and exit.

View File

@ -25,7 +25,7 @@
* (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: syscons.c,v 1.126 1995/10/14 07:08:09 bde Exp $
* $Id: syscons.c,v 1.127 1995/10/28 16:58:04 markm Exp $
*/
#include "sc.h"
@ -2203,9 +2203,7 @@ scgetc(int noblock)
else
goto next_code;
#ifdef DEVRANDOM
add_keyboard_randomness(scancode);
#endif
if (cur_console->status & KBD_RAW_MODE)
return scancode;

View File

@ -35,7 +35,7 @@
* SUCH DAMAGE.
*
* from: @(#)machdep.c 7.4 (Berkeley) 6/3/91
* $Id: machdep.c,v 1.146 1995/10/31 19:07:53 peter Exp $
* $Id: machdep.c,v 1.147 1995/11/02 09:52:40 peter Exp $
*/
#include "npx.h"
@ -1377,9 +1377,7 @@ init386(first)
#if NISA >0
isa_defaultirq();
#endif
#ifdef DEVRANDOM
rand_initialize();
#endif
r_gdt.rd_limit = sizeof(gdt) - 1;
r_gdt.rd_base = (int) gdt;

View File

@ -38,7 +38,7 @@
*
* from: Utah $Hdr: mem.c 1.13 89/10/08$
* from: @(#)mem.c 7.2 (Berkeley) 5/9/91
* $Id: mem.c,v 1.17 1995/10/30 22:39:34 markm Exp $
* $Id: mem.c,v 1.18 1995/11/04 13:52:30 bde Exp $
*/
/*
@ -79,10 +79,8 @@ memdev_init(dummy)
x=dev_add("/misc", "mem", mmopen, 0, DV_CHR, 0, 2, 0640);
x=dev_add("/misc", "kmem", mmopen, 1, DV_CHR, 0, 2, 0640);
x=dev_add("/misc", "null", mmopen, 2, DV_CHR, 0, 0, 0666);
#ifdef DEVRANDOM
x=dev_add("/misc", "random", mmopen, 3, DV_CHR, 0, 0, 0666);
x=dev_add("/misc", "urandom", mmopen, 4, DV_CHR, 0, 0, 0666);
#endif
x=dev_add("/misc", "zero", mmopen, 12, DV_CHR, 0, 0, 0666);
x=dev_add("/misc", "io", mmopen, 14, DV_CHR, 0, 2, 0640);
}
@ -138,9 +136,7 @@ mmrw(dev, uio, flags)
{
register int o;
register u_int c, v;
#ifdef DEVRANDOM
u_int poolsize;
#endif
register struct iovec *iov;
int error = 0;
caddr_t buf = NULL;
@ -200,7 +196,6 @@ mmrw(dev, uio, flags)
c = iov->iov_len;
break;
#ifdef DEVRANDOM
/* minor device 3 (/dev/random) is source of filth on read, rathole on write */
case 3:
if (uio->uio_rw == UIO_WRITE) {
@ -235,7 +230,6 @@ mmrw(dev, uio, flags)
c = min(c, poolsize);
error = uiomove(buf, (int)c, uio);
continue;
#endif
/* minor device 12 (/dev/zero) is source of nulls on read, rathole on write */
case 12:
@ -351,7 +345,6 @@ mmioctl(dev, cmd, cmdarg, flags, p)
int flags;
struct proc *p;
{
#ifdef DEVRANDOM
int error;
if (minor(dev) != 3 && minor(dev) != 4)
@ -384,7 +377,4 @@ mmioctl(dev, cmd, cmdarg, flags, p)
return (ENOTTY);
}
return (0);
#else
return (ENODEV);
#endif /* DEVRANDOM */
}

View File

@ -1,7 +1,7 @@
/*
* random.c -- A strong random number generator
*
* $Id$
* $Id: random.c,v 1.1 1995/10/28 16:58:02 markm Exp $
*
* Version 0.92, last modified 21-Sep-95
*
@ -40,8 +40,6 @@
*
*/
#ifdef DEVRANDOM
#include <sys/param.h>
#include <sys/cdefs.h>
#include <sys/kernel.h>
@ -430,23 +428,3 @@ read_random_unlimited(char * buf, u_int nbytes)
{
return extract_entropy(&random_state, buf, nbytes);
}
#ifdef linux
int
read_random(struct inode * inode,struct file * file,char * buf,int nbytes)
{
if ((nbytes * 8) > random_state.entropy_count)
nbytes = random_state.entropy_count / 8;
return extract_entropy(&random_state, buf, nbytes, 1);
}
int
read_random_unlimited(struct inode * inode,struct file * file,
char * buf,int nbytes)
{
return extract_entropy(&random_state, buf, nbytes, 1);
}
#endif
#endif /* DEVRANDOM */

View File

@ -25,7 +25,7 @@
* (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: syscons.c,v 1.126 1995/10/14 07:08:09 bde Exp $
* $Id: syscons.c,v 1.127 1995/10/28 16:58:04 markm Exp $
*/
#include "sc.h"
@ -2203,9 +2203,7 @@ scgetc(int noblock)
else
goto next_code;
#ifdef DEVRANDOM
add_keyboard_randomness(scancode);
#endif
if (cur_console->status & KBD_RAW_MODE)
return scancode;

View File

@ -1,6 +1,6 @@
/*
* from: vector.s, 386BSD 0.1 unknown origin
* $Id: vector.s,v 1.12 1995/04/15 21:32:18 bde Exp $
* $Id: vector.s,v 1.13 1995/10/28 16:58:05 markm Exp $
*/
#include <i386/isa/icu.h>
@ -53,15 +53,11 @@
#define MAYBE_PUSHL_ES
#endif
#ifdef DEVRANDOM
#define ADDENTROPY(irq_num) \
/* Add this interrupt to the pool of entropy */ \
pushl $irq_num ; \
call _add_interrupt_randomness ; \
addl $4,%esp
#else
#define ADDENTROPY(irq_num)
#endif
/*
* Macros for interrupt interrupt entry, call to handler, and exit.

View File

@ -25,7 +25,7 @@
* (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: syscons.c,v 1.126 1995/10/14 07:08:09 bde Exp $
* $Id: syscons.c,v 1.127 1995/10/28 16:58:04 markm Exp $
*/
#include "sc.h"
@ -2203,9 +2203,7 @@ scgetc(int noblock)
else
goto next_code;
#ifdef DEVRANDOM
add_keyboard_randomness(scancode);
#endif
if (cur_console->status & KBD_RAW_MODE)
return scancode;