1 /*-
2  * Copyright © 2010, 2014
3  *	Thorsten Glaser <tg@mirbsd.org>
4  *
5  * Provided that these terms and disclaimer and all copyright notices
6  * are retained or reproduced in an accompanying document, permission
7  * is granted to deal in this work without restriction, including un‐
8  * limited rights to use, publicly perform, distribute, sell, modify,
9  * merge, give away, or sublicence.
10  *
11  * This work is provided “AS IS” and WITHOUT WARRANTY of any kind, to
12  * the utmost extent permitted by applicable law, neither express nor
13  * implied; without malicious intent or gross negligence. In no event
14  * may a licensor, author or contributor be held liable for indirect,
15  * direct, other damage, loss, or other issues arising in any way out
16  * of dealing in the work, even if advised of the possibility of such
17  * damage or existence of a defect, except proven that it results out
18  * of said person’s immediate fault when using the work as intended.
19  *-
20  * Implements legacy MirBSD API (deprecated but still useful for e.g.
21  * configure checks that don’t match cpp macros).
22  */
23 
24 #include <stdlib.h>
25 
26 __RCSID("$MirOS: src/lib/libc/crypt/arc4random_pushb_old.c,v 1.2 2014/02/20 00:07:45 tg Exp $");
27 
28 #undef arc4random_push
29 #undef arc4random_pushb
30 #undef arc4random_pushk
31 
32 void
arc4random_push(int n)33 arc4random_push(int n)
34 {
35 	arc4random_pushb_fast(&n, sizeof(n));
36 }
37 __warn_references(arc4random_push, "arc4random_push is deprecated, use arc4random_pushb_fast instead");
38 
39 uint32_t
arc4random_pushb(const void * buf,size_t len)40 arc4random_pushb(const void *buf, size_t len)
41 {
42 	arc4random_pushb_fast(buf, len);
43 	return (arc4random());
44 }
45 __warn_references(arc4random_pushb, "arc4random_pushb is deprecated, use arc4random_pushb_fast instead");
46 
47 __weak_alias(arc4random_pushk, arc4random_pushb);
48 __warn_references(arc4random_pushk, "arc4random_pushk is deprecated, use arc4random_pushb_fast instead");
49