random.h revision 252726
11590Srgrimes/*
21590Srgrimes * Random number generator
31590Srgrimes * Copyright (c) 2010-2011, Jouni Malinen <j@w1.fi>
41590Srgrimes *
51590Srgrimes * This software may be distributed under the terms of the BSD license.
61590Srgrimes * See README for more details.
71590Srgrimes */
81590Srgrimes
91590Srgrimes#ifndef RANDOM_H
101590Srgrimes#define RANDOM_H
111590Srgrimes
121590Srgrimes#ifdef CONFIG_NO_RANDOM_POOL
131590Srgrimes#define random_init(e) do { } while (0)
141590Srgrimes#define random_deinit() do { } while (0)
151590Srgrimes#define random_add_randomness(b, l) do { } while (0)
161590Srgrimes#define random_get_bytes(b, l) os_get_random((b), (l))
171590Srgrimes#define random_pool_ready() 1
181590Srgrimes#define random_mark_pool_ready() do { } while (0)
191590Srgrimes#else /* CONFIG_NO_RANDOM_POOL */
201590Srgrimesvoid random_init(const char *entropy_file);
211590Srgrimesvoid random_deinit(void);
221590Srgrimesvoid random_add_randomness(const void *buf, size_t len);
231590Srgrimesint random_get_bytes(void *buf, size_t len);
241590Srgrimesint random_pool_ready(void);
251590Srgrimesvoid random_mark_pool_ready(void);
261590Srgrimes#endif /* CONFIG_NO_RANDOM_POOL */
271590Srgrimes
281590Srgrimes#endif /* RANDOM_H */
291590Srgrimes