randomdev.h revision 254147
174072Smarkm/*-
2128059Smarkm * Copyright (c) 2000-2004 Mark R V Murray
374072Smarkm * All rights reserved.
474072Smarkm *
574072Smarkm * Redistribution and use in source and binary forms, with or without
674072Smarkm * modification, are permitted provided that the following conditions
774072Smarkm * are met:
874072Smarkm * 1. Redistributions of source code must retain the above copyright
974072Smarkm *    notice, this list of conditions and the following disclaimer
1074072Smarkm *    in this position and unchanged.
1174072Smarkm * 2. Redistributions in binary form must reproduce the above copyright
1274072Smarkm *    notice, this list of conditions and the following disclaimer in the
1374072Smarkm *    documentation and/or other materials provided with the distribution.
1474072Smarkm *
1574072Smarkm * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
1674072Smarkm * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
1774072Smarkm * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
1874072Smarkm * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
1974072Smarkm * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
2074072Smarkm * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
2174072Smarkm * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
2274072Smarkm * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
2374072Smarkm * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
2474072Smarkm * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2574072Smarkm *
2674072Smarkm * $FreeBSD: head/sys/dev/random/randomdev.h 254147 2013-08-09 15:31:50Z obrien $
2774072Smarkm */
2874072Smarkm
2974072Smarkm/* This header contains only those definitions that are global
3074072Smarkm * and non algorithm-specific for the entropy processor
3174072Smarkm */
3274072Smarkm
33128059Smarkmtypedef void random_init_func_t(void);
34128059Smarkmtypedef void random_deinit_func_t(void);
35153575Spstypedef int random_block_func_t(int);
36128059Smarkmtypedef int random_read_func_t(void *, int);
37128059Smarkmtypedef void random_write_func_t(void *, int);
38153575Spstypedef int random_poll_func_t(int, struct thread *);
39128059Smarkmtypedef void random_reseed_func_t(void);
4074072Smarkm
41254147Sobrienstruct random_adaptor {
42128059Smarkm	struct selinfo		rsel;
43128059Smarkm	const char		*ident;
44128059Smarkm	int			seeded;
45128059Smarkm	random_init_func_t	*init;
46128059Smarkm	random_deinit_func_t	*deinit;
47153575Sps	random_block_func_t	*block;
48128059Smarkm	random_read_func_t	*read;
49128059Smarkm	random_write_func_t	*write;
50153575Sps	random_poll_func_t	*poll;
51128059Smarkm	random_reseed_func_t	*reseed;
5274072Smarkm};
5374072Smarkm
54254147Sobrienextern void random_ident_hardware(struct random_adaptor **);
55128059Smarkmextern void random_null_func(void);
56