Add EntrPool struct. Typos.
[bertos.git] / algos / randpool.h
1 /**
2  * \file
3  * <!--
4  * Copyright 2007 Develer S.r.l. (http://www.develer.com/)
5  * This file is part of DevLib - See README.devlib for information.
6  * -->
7  *
8  * \brief API function for to manage entropy pool.
9  *
10  *
11  * \version $Id$
12  * \author Daniele Basile <asterix@develer.com>
13  */
14
15 /*#*
16  *#* $Log$
17  *#* Revision 1.2  2007/02/08 11:53:03  asterix
18  *#* Add EntrPool struct. Typos.
19  *#*
20  *#* Revision 1.1  2007/02/08 11:13:41  asterix
21  *#* Add function prototypes.
22  *#*
23  *#*/
24
25 #ifndef RANDPOOL_H 
26 #define RANDPOOL_H
27
28 #include <cfg/compiler.h>
29 #include <appconfig.h>
30
31 /**
32  * Sturct data of entropy pool.
33  */
34 typedef struct EntrPool 
35 {
36         size_t entropy;                                  ///< Actual value of entropy.
37         size_t pool_pos;                                 ///< Actual size of entropy pool.
38         size_t counter;                                  ///< Counter.
39         uint8_t pool_entropy[CONFIG_SIZE_ENTROPY_POOL];  ///< Entropy pool.
40
41 } EntrPool;
42
43 void init_pool(EntrPool *pool);
44 void add_data(EntrPool *pool, void *data, size_t n_bit);
45 size_t pool_size(EntrPool *pool);
46 void get_bit(EntrPool *pool, void *data, size_t n_bit);
47 void get_bit_n(EntrPool *pool, void *data, size_t n_bit);
48 bool save_pool(void *data);
49 uint8_t *load_pool(void);
50
51 #endif /* RANDPOOL_H */