4 * Copyright 2007 Develer S.r.l. (http://www.develer.com/);
5 * This file is part of DevLib - See README.devlib for information.
8 * \brief API function for to manage entropy pool.
12 * \author Daniele Basile <asterix@develer.com>
17 *#* Revision 1.7 2007/02/12 09:40:43 asterix
18 *#* Remove randpool_load function. Add *data in randpool_init prototype.
20 *#* Revision 1.6 2007/02/09 15:49:54 asterix
21 *#* Fix bug in randpool_stir and randpool_add. Typos.
23 *#* Revision 1.5 2007/02/09 09:24:38 asterix
24 *#* Typos. Add data_len in randpool_add and n_byte in randpool_push pototypes.
26 *#* Revision 1.4 2007/02/08 17:18:01 asterix
27 *#* Write add_data and stir function. Typos
29 *#* Revision 1.3 2007/02/08 14:25:56 asterix
32 *#* Revision 1.2 2007/02/08 11:53:03 asterix
33 *#* Add EntropyPool struct. Typos.
35 *#* Revision 1.1 2007/02/08 11:13:41 asterix
36 *#* Add function prototypes.
43 #include <cfg/compiler.h>
44 #include <appconfig.h>
46 #define NUM_STIR_LOOP CONFIG_SIZE_ENTROPY_POOL / CONFIG_MD2_BLOCK_LEN
49 * Sturct data of entropy pool.
51 typedef struct EntropyPool
53 size_t entropy; ///< Actual value of entropy (byte).
54 size_t pos_add; ///< Number of byte idd in entropy pool.
55 size_t pos_get; ///< Number of byte get in entropy pool.
56 size_t counter; ///< Counter.
57 size_t last_counter; ///< Last timer value.
58 uint8_t pool_entropy[CONFIG_SIZE_ENTROPY_POOL]; ///< Entropy pool.
63 void randpool_add(EntropyPool *pool, void *data, size_t data_len, size_t entropy);
64 void randpool_init(EntropyPool *pool, void *_data, size_t len);
65 size_t randpool_size(EntropyPool *pool);
66 void randpool_get(EntropyPool *pool, void *data, size_t n_byte);
67 void randpool_getN(EntropyPool *pool, void *data, size_t n_byte);
68 bool randpool_save(void *data);
70 #endif /* RANDPOOL_H */