1 /* $OpenBSD: rand_lib.c,v 1.20 2014/10/22 13:02:04 jsing Exp $ */
3 * Copyright (c) 2014 Ted Unangst <tedu@openbsd.org>
5 * Permission to use, copy, modify, and distribute this software for any
6 * purpose with or without fee is hereby granted, provided that the above
7 * copyright notice and this permission notice appear in all copies.
9 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
20 #include <openssl/opensslconf.h>
22 #include <openssl/rand.h>
25 * The useful functions in this file are at the bottom.
28 RAND_set_rand_method(const RAND_METHOD
*meth
)
34 RAND_get_rand_method(void)
45 #ifndef OPENSSL_NO_ENGINE
47 RAND_set_rand_engine(ENGINE
*engine
)
60 RAND_seed(const void *buf
, int num
)
66 RAND_add(const void *buf
, int num
, double entropy
)
84 * Hurray. You've made it to the good parts.
87 RAND_bytes(unsigned char *buf
, int num
)
90 arc4random_buf(buf
, num
);
95 RAND_pseudo_bytes(unsigned char *buf
, int num
)
98 arc4random_buf(buf
, num
);