1 /* $MirOS: src/lib/libc/crypt/arc4random.h,v 1.5 2014/03/29 10:35:45 tg Exp $ */ 2 3 /*- 4 * Copyright (c) 2010, 2014 5 * Thorsten Glaser <tg@mirbsd.org> 6 * 7 * Provided that these terms and disclaimer and all copyright notices 8 * are retained or reproduced in an accompanying document, permission 9 * is granted to deal in this work without restriction, including un- 10 * limited rights to use, publicly perform, distribute, sell, modify, 11 * merge, give away, or sublicence. 12 * 13 * This work is provided "AS IS" and WITHOUT WARRANTY of any kind, to 14 * the utmost extent permitted by applicable law, neither express nor 15 * implied; without malicious intent or gross negligence. In no event 16 * may a licensor, author or contributor be held liable for indirect, 17 * direct, other damage, loss, or other issues arising in any way out 18 * of dealing in the work, even if advised of the possibility of such 19 * damage or existence of a defect, except proven that it results out 20 * of said person's immediate fault when using the work as intended. 21 *- 22 * The idea of an arc4random(3) stems from David Mazieres for OpenBSD 23 */ 24 25 #ifndef _LIBC_INTERNAL_ARC4RANDOM_H 26 #define _LIBC_INTERNAL_ARC4RANDOM_H 27 28 __BEGIN_DECLS 29 extern struct arc4random_status { 30 uint32_t pool[32]; 31 struct arcfour_status cipher; 32 struct arcfour_otherinfo { 33 int count_; 34 pid_t stir_pid_; 35 uint8_t poolptr_; 36 uint8_t initialised_; 37 } otherinfo; 38 } a4state; 39 40 #define a4s_poolptr otherinfo.poolptr_ 41 #define a4s_initialised otherinfo.initialised_ 42 #define a4s_stir_pid otherinfo.stir_pid_ 43 #define a4s_count otherinfo.count_ 44 45 void arc4random_atexit(void); 46 void arc4random_ctl(unsigned int); 47 void arc4random_stir_locked(pid_t); 48 __END_DECLS 49 50 #endif 51