14eeb4f04SMark Murray /*- 2c495c935SMark Murray * Copyright (c) 2000-2013 Mark R. V. Murray 34eeb4f04SMark Murray * All rights reserved. 41bb2d314SMark Murray * 51bb2d314SMark Murray * Redistribution and use in source and binary forms, with or without 61bb2d314SMark Murray * modification, are permitted provided that the following conditions 71bb2d314SMark Murray * are met: 81bb2d314SMark Murray * 1. Redistributions of source code must retain the above copyright 94eeb4f04SMark Murray * notice, this list of conditions and the following disclaimer 104eeb4f04SMark Murray * in this position and unchanged. 111bb2d314SMark Murray * 2. Redistributions in binary form must reproduce the above copyright 121bb2d314SMark Murray * notice, this list of conditions and the following disclaimer in the 131bb2d314SMark Murray * documentation and/or other materials provided with the distribution. 141bb2d314SMark Murray * 154eeb4f04SMark Murray * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 164eeb4f04SMark Murray * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 174eeb4f04SMark Murray * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 184eeb4f04SMark Murray * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 194eeb4f04SMark Murray * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 204eeb4f04SMark Murray * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 214eeb4f04SMark Murray * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 224eeb4f04SMark Murray * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 234eeb4f04SMark Murray * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 244eeb4f04SMark Murray * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 251bb2d314SMark Murray * 264eeb4f04SMark Murray * $FreeBSD$ 271bb2d314SMark Murray */ 281bb2d314SMark Murray 29a3b693c9SBruce Evans #ifndef _SYS_RANDOM_H_ 30a3b693c9SBruce Evans #define _SYS_RANDOM_H_ 311bb2d314SMark Murray 32da3fb6b4SMark Murray #ifdef _KERNEL 33da3fb6b4SMark Murray 34e1199601SMark Murray int read_random(void *, int); 351bb2d314SMark Murray 36a9befd40SRobert Watson /* 37a9befd40SRobert Watson * Note: if you add or remove members of esource, remember to also update the 38a9befd40SRobert Watson * KASSERT regarding what valid members are in random_harvest_internal(). 39a9befd40SRobert Watson */ 40e1199601SMark Murray enum esource { 41e1199601SMark Murray RANDOM_START = 0, 421a3c1f06SMark Murray RANDOM_CACHED = 0, 43*8cc20a46SMark Murray RANDOM_ATTACH, 44e1199601SMark Murray RANDOM_KEYBOARD, 45e1199601SMark Murray RANDOM_MOUSE, 46c495c935SMark Murray RANDOM_NET_TUN, 47c495c935SMark Murray RANDOM_NET_ETHER, 48c495c935SMark Murray RANDOM_NET_NG, 49e1199601SMark Murray RANDOM_INTERRUPT, 50c495c935SMark Murray RANDOM_SWI, 51f02e47dcSMark Murray RANDOM_PURE_OCTEON, 52f02e47dcSMark Murray RANDOM_PURE_SAFE, 53f02e47dcSMark Murray RANDOM_PURE_GLXSB, 54f02e47dcSMark Murray RANDOM_PURE_UBSEC, 55f02e47dcSMark Murray RANDOM_PURE_HIFN, 56f02e47dcSMark Murray RANDOM_PURE_RDRAND, 57f02e47dcSMark Murray RANDOM_PURE_NEHEMIAH, 58e1199601SMark Murray ENTROPYSOURCE 59e1199601SMark Murray }; 60f02e47dcSMark Murray void random_harvest(void *, u_int, u_int, enum esource); 61da3fb6b4SMark Murray 6214636c3bSMark Murray /* Allow the sysadmin to select the broad category of 6314636c3bSMark Murray * entropy types to harvest 6414636c3bSMark Murray */ 6514636c3bSMark Murray struct harvest_select { 6614636c3bSMark Murray int ethernet; 6714636c3bSMark Murray int point_to_point; 6814636c3bSMark Murray int interrupt; 694a7cdfd7SMark Murray int swi; 70c495c935SMark Murray int namei; 7114636c3bSMark Murray }; 7214636c3bSMark Murray 7314636c3bSMark Murray extern struct harvest_select harvest; 7414636c3bSMark Murray 754a7cdfd7SMark Murray #endif /* _KERNEL */ 76da3fb6b4SMark Murray 774eeb4f04SMark Murray #endif /* _SYS_RANDOM_H_ */ 78