174072Smarkm/*-
2256381Smarkm * Copyright (c) 2000-2013 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$
2774072Smarkm */
2874072Smarkm
29256381Smarkm#ifndef SYS_DEV_RANDOM_RANDOMDEV_H_INCLUDED
30256381Smarkm#define SYS_DEV_RANDOM_RANDOMDEV_H_INCLUDED
31256381Smarkm
3274072Smarkm/* This header contains only those definitions that are global
3374072Smarkm * and non algorithm-specific for the entropy processor
3474072Smarkm */
3574072Smarkm
36128059Smarkmtypedef void random_init_func_t(void);
37128059Smarkmtypedef void random_deinit_func_t(void);
38153575Spstypedef int random_block_func_t(int);
39128059Smarkmtypedef int random_read_func_t(void *, int);
40153575Spstypedef int random_poll_func_t(int, struct thread *);
41128059Smarkmtypedef void random_reseed_func_t(void);
4274072Smarkm
43254147Sobrienstruct random_adaptor {
44128059Smarkm	struct selinfo		rsel;
45128059Smarkm	const char		*ident;
46128059Smarkm	int			seeded;
47256414Smarkm	unsigned		priority;
48128059Smarkm	random_init_func_t	*init;
49128059Smarkm	random_deinit_func_t	*deinit;
50153575Sps	random_block_func_t	*block;
51128059Smarkm	random_read_func_t	*read;
52153575Sps	random_poll_func_t	*poll;
53128059Smarkm	random_reseed_func_t	*reseed;
5474072Smarkm};
5574072Smarkm
56256381Smarkmstruct random_hardware_source {
57256381Smarkm	const char		*ident;
58256381Smarkm	enum esource		source;
59256381Smarkm	random_read_func_t	*read;
60256381Smarkm};
61256381Smarkm
62256381Smarkm#endif
63