| @@ -1,58 +1,51 @@ | | | @@ -1,58 +1,51 @@ |
1 | /* $NetBSD: rnd_private.h,v 1.4 2013/08/27 19:30:10 riastradh Exp $ */ | | 1 | /* $NetBSD: rnd_private.h,v 1.5 2015/04/13 14:30:05 riastradh Exp $ */ |
2 | | | 2 | |
3 | /*- | | 3 | /*- |
4 | * Copyright (c) 1997 The NetBSD Foundation, Inc. | | 4 | * Copyright (c) 1997 The NetBSD Foundation, Inc. |
5 | * All rights reserved. | | 5 | * All rights reserved. |
6 | * | | 6 | * |
7 | * This code is derived from software contributed to The NetBSD Foundation | | 7 | * This code is derived from software contributed to The NetBSD Foundation |
8 | * by Michael Graff <explorer@flame.org>. This code uses ideas and | | 8 | * by Michael Graff <explorer@flame.org>. This code uses ideas and |
9 | * algorithms from the Linux driver written by Ted Ts'o. | | 9 | * algorithms from the Linux driver written by Ted Ts'o. |
10 | * | | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | | 11 | * Redistribution and use in source and binary forms, with or without |
12 | * modification, are permitted provided that the following conditions | | 12 | * modification, are permitted provided that the following conditions |
13 | * are met: | | 13 | * are met: |
14 | * 1. Redistributions of source code must retain the above copyright | | 14 | * 1. Redistributions of source code must retain the above copyright |
15 | * notice, this list of conditions and the following disclaimer. | | 15 | * notice, this list of conditions and the following disclaimer. |
16 | * 2. Redistributions in binary form must reproduce the above copyright | | 16 | * 2. Redistributions in binary form must reproduce the above copyright |
17 | * notice, this list of conditions and the following disclaimer in the | | 17 | * notice, this list of conditions and the following disclaimer in the |
18 | * documentation and/or other materials provided with the distribution. | | 18 | * documentation and/or other materials provided with the distribution. |
19 | * | | 19 | * |
20 | * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS | | 20 | * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS |
21 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED | | 21 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED |
22 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | | 22 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
23 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS | | 23 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS |
24 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | | 24 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
25 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | | 25 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
26 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | | 26 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
27 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | | 27 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
28 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | | 28 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
29 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | | 29 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
30 | * POSSIBILITY OF SUCH DAMAGE. | | 30 | * POSSIBILITY OF SUCH DAMAGE. |
31 | */ | | 31 | */ |
32 | | | 32 | |
33 | #ifndef _DEV_RNDPRIVATE_H | | 33 | #ifndef _DEV_RNDPRIVATE_H |
34 | #define _DEV_RNDPRIVATE_H | | 34 | #define _DEV_RNDPRIVATE_H |
35 | /* | | 35 | /* |
36 | * Number of bytes returned per hash. This value is used in both | | 36 | * Number of bytes returned per hash. This value is used in both |
37 | * rnd.c and rndpool.c to decide when enough entropy exists to do a | | 37 | * rnd.c and rndpool.c to decide when enough entropy exists to do a |
38 | * hash to extract it. | | 38 | * hash to extract it. |
39 | */ | | 39 | */ |
40 | #define RND_ENTROPY_THRESHOLD 10 | | 40 | #define RND_ENTROPY_THRESHOLD 10 |
41 | | | 41 | |
42 | /* | | 42 | /* |
43 | * Size of the event queue. This _MUST_ be a power of 2. | | | |
44 | */ | | | |
45 | #ifndef RND_EVENTQSIZE | | | |
46 | #define RND_EVENTQSIZE 128 | | | |
47 | #endif | | | |
48 | | | | |
49 | /* | | | |
50 | * Used by rnd_extract_data() and rndpool_extract_data() to describe how | | 43 | * Used by rnd_extract_data() and rndpool_extract_data() to describe how |
51 | * "good" the data has to be. | | 44 | * "good" the data has to be. |
52 | */ | | 45 | */ |
53 | #define RND_EXTRACT_ANY 0 /* extract anything, even if no entropy */ | | 46 | #define RND_EXTRACT_ANY 0 /* extract anything, even if no entropy */ |
54 | #define RND_EXTRACT_GOOD 1 /* return as many good bytes | | 47 | #define RND_EXTRACT_GOOD 1 /* return as many good bytes |
55 | (short read ok) */ | | 48 | (short read ok) */ |
56 | | | 49 | |
57 | uint32_t rnd_extract_data(void *, uint32_t, uint32_t); | | 50 | uint32_t rnd_extract_data(void *, uint32_t, uint32_t); |
58 | #endif | | 51 | #endif |