]> git.cryptolib.org Git - avr-crypto-lib.git/blob - entropium/entropium.h
turning on software flow control for uart
[avr-crypto-lib.git] / entropium / entropium.h
1 /* entropium.h */
2 /*
3     This file is part of the AVR-Crypto-Lib.
4     Copyright (C) 2006-2015 Daniel Otte (bg@nerilex.org)
5
6     This program is free software: you can redistribute it and/or modify
7     it under the terms of the GNU General Public License as published by
8     the Free Software Foundation, either version 3 of the License, or
9     (at your option) any later version.
10
11     This program is distributed in the hope that it will be useful,
12     but WITHOUT ANY WARRANTY; without even the implied warranty of
13     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14     GNU General Public License for more details.
15
16     You should have received a copy of the GNU General Public License
17     along with this program.  If not, see <http://www.gnu.org/licenses/>.
18 */
19
20 /**
21  * File:                entropium.h
22  * Author:              Daniel Otte
23  * Date:                23.07.2006
24  * License:             GPL
25  * Description: This file contains the declarations for the pseudo-random-number generator.
26  **/
27
28 /**
29  * \file    entropium.h
30  * \author  Daniel Otte
31  * \date    23.07.2006
32  * \license     GPLv3 or later
33  * \brief       This file contains the declarations for the pseudo-random-number generator.
34  **/
35
36
37 #ifndef ENTROPIUM_H_
38 #define ENTROPIUM_H_
39
40 #include <stdint.h>
41 /*
42  * length in bits 
43  */
44 #define ENTROPIUM_RANDOMBLOCK_SIZE 32 /* bytes */
45  
46 /** \fn void entropium_addEntropy(unsigned length_b, const void *data)
47  * \brief add entropy to the prng
48  * 
49  * This function adds data to the internal entropy pool
50  * \param length_b length of the data block in bits
51  * \param data pointer to the data
52  */
53 void entropium_addEntropy(unsigned length_b, const void *data); 
54
55 /** \fn void entropium_getRandomBlock(void *b)
56  * \brief generate a fixed size block of random data 
57  * 
58  * This function writes 32 bytes of random extracted from the entropy pool
59  * in the supplied buffer.
60  * \param b buffer where the random data gets written
61  */
62 void entropium_getRandomBlock(void *b);
63
64 /** \fn uint8_t entropium_getRandomByte(void)
65  * \brief get a single byte of random data
66  * 
67  * This function utilizes a internal buffer which gets automatically filled
68  * again. 
69  * \return a byte of random data
70  */ 
71 uint8_t entropium_getRandomByte(void);
72
73 /** \fn void entropium_fillBlockRandom(void *block, unsigned length_B)
74  * \brief get a block of random data
75  * 
76  * This function writes random data extracted from the entropy pool in the 
77  * supplied buffer. It shares a internal buffer with the 
78  * entropium_getRandomByte() function.
79  * \param block pointer to the buffer where the random data goes
80  * \param length_B number of bytes to be written to the buffer
81  */
82 void entropium_fillBlockRandom(void *block, unsigned length_B);
83
84 #endif /*PRNG_H_*/