1/*-
2 * Copyright (c) 2000 Mark R V Murray
3 * All rights reserved.
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 unchanged lines hidden (view full) ---
18 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
19 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
20 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
21 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 *
26 * $FreeBSD: head/sys/dev/random/randomdev.c 111119 2003-02-19 05:47:46Z imp $
27 */
28
29#include <sys/param.h>
30#include <sys/systm.h>
31#include <sys/bus.h>
32#include <sys/conf.h>
33#include <sys/fcntl.h>
34#include <sys/filio.h>
--- 22 unchanged lines hidden (view full) ---
57static d_write_t random_write;
58static d_ioctl_t random_ioctl;
59static d_poll_t random_poll;
60
61#define CDEV_MAJOR 2
62#define RANDOM_MINOR 3
63
64static struct cdevsw random_cdevsw = {
65 /* open */ random_open,
66 /* close */ random_close,
67 /* read */ random_read,
68 /* write */ random_write,
69 /* ioctl */ random_ioctl,
70 /* poll */ random_poll,
71 /* mmap */ nommap,
72 /* strategy */ nostrategy,
73 /* name */ "random",
74 /* maj */ CDEV_MAJOR,
75 /* dump */ nodump,
76 /* psize */ nopsize,
77 /* flags */ 0,
78 /* kqfilter */ NULL
79};
80
81static void random_kthread(void *);
82static void random_harvest_internal(u_int64_t, void *, u_int, u_int, u_int, enum esource);
83static void random_write_internal(void *, int);
84
85/* Ring buffer holding harvested entropy */
86static struct harvestring {
--- 359 unchanged lines hidden ---
2 * Copyright (c) 2000 Mark R V Murray
3 * All rights reserved.
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 unchanged lines hidden (view full) ---
18 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
19 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
20 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
21 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 *
26 * $FreeBSD: head/sys/dev/random/randomdev.c 111119 2003-02-19 05:47:46Z imp $
27 */
28
29#include <sys/param.h>
30#include <sys/systm.h>
31#include <sys/bus.h>
32#include <sys/conf.h>
33#include <sys/fcntl.h>
34#include <sys/filio.h>
--- 22 unchanged lines hidden (view full) ---
57static d_write_t random_write;
58static d_ioctl_t random_ioctl;
59static d_poll_t random_poll;
60
61#define CDEV_MAJOR 2
62#define RANDOM_MINOR 3
63
64static struct cdevsw random_cdevsw = {
65 /* open */ random_open,
66 /* close */ random_close,
67 /* read */ random_read,
68 /* write */ random_write,
69 /* ioctl */ random_ioctl,
70 /* poll */ random_poll,
71 /* mmap */ nommap,
72 /* strategy */ nostrategy,
73 /* name */ "random",
74 /* maj */ CDEV_MAJOR,
75 /* dump */ nodump,
76 /* psize */ nopsize,
77 /* flags */ 0,
78 /* kqfilter */ NULL
79};
80
81static void random_kthread(void *);
82static void random_harvest_internal(u_int64_t, void *, u_int, u_int, u_int, enum esource);
83static void random_write_internal(void *, int);
84
85/* Ring buffer holding harvested entropy */
86static struct harvestring {
--- 359 unchanged lines hidden ---