Deleted Added
full compact
dummy_rng.c (256381) dummy_rng.c (256414)
1/*-
2 * Copyright (c) 2013 Arthur Mesh <arthurmesh@gmail.com>
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

--- 11 unchanged lines hidden (view full) ---

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 */
27#include <sys/cdefs.h>
1/*-
2 * Copyright (c) 2013 Arthur Mesh <arthurmesh@gmail.com>
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

--- 11 unchanged lines hidden (view full) ---

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 */
27#include <sys/cdefs.h>
28__FBSDID("$FreeBSD: stable/10/sys/dev/random/dummy_rng.c 256381 2013-10-12 15:31:36Z markm $");
28__FBSDID("$FreeBSD: stable/10/sys/dev/random/dummy_rng.c 256414 2013-10-13 00:13:57Z markm $");
29
30#include <sys/param.h>
31#include <sys/fcntl.h>
32#include <sys/kernel.h>
33#include <sys/malloc.h>
34#include <sys/module.h>
35#include <sys/random.h>
36#include <sys/selinfo.h>

--- 60 unchanged lines hidden (view full) ---

97 .ident = "Dummy entropy device that always blocks",
98 .init = dummy_random_init,
99 .deinit = dummy_random_deinit,
100 .block = dummy_random_block,
101 .poll = dummy_random_poll,
102 .read = (random_read_func_t *)random_null_func,
103 .reseed = (random_reseed_func_t *)random_null_func,
104 .seeded = 0, /* This device can never be seeded */
29
30#include <sys/param.h>
31#include <sys/fcntl.h>
32#include <sys/kernel.h>
33#include <sys/malloc.h>
34#include <sys/module.h>
35#include <sys/random.h>
36#include <sys/selinfo.h>

--- 60 unchanged lines hidden (view full) ---

97 .ident = "Dummy entropy device that always blocks",
98 .init = dummy_random_init,
99 .deinit = dummy_random_deinit,
100 .block = dummy_random_block,
101 .poll = dummy_random_poll,
102 .read = (random_read_func_t *)random_null_func,
103 .reseed = (random_reseed_func_t *)random_null_func,
104 .seeded = 0, /* This device can never be seeded */
105 .priority = 1, /* Bottom priority, so goes to last position */
105};
106
107static int
108dummy_random_modevent(module_t mod __unused, int type, void *unused __unused)
109{
110
111 switch (type) {
112 case MOD_LOAD:
113 random_adaptor_register("dummy", &dummy_random);
114 EVENTHANDLER_INVOKE(random_adaptor_attach,
115 &dummy_random);
116
117 return (0);
118 }
119
120 return (EINVAL);
121}
122
123RANDOM_ADAPTOR_MODULE(dummy, dummy_random_modevent, 1);
106};
107
108static int
109dummy_random_modevent(module_t mod __unused, int type, void *unused __unused)
110{
111
112 switch (type) {
113 case MOD_LOAD:
114 random_adaptor_register("dummy", &dummy_random);
115 EVENTHANDLER_INVOKE(random_adaptor_attach,
116 &dummy_random);
117
118 return (0);
119 }
120
121 return (EINVAL);
122}
123
124RANDOM_ADAPTOR_MODULE(dummy, dummy_random_modevent, 1);