3 This file is part of the ARM-Crypto-Lib.
4 Copyright (C) 2008 Daniel Otte (daniel.otte@rub.de)
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.
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.
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/>.
25 * Description: This file contains the declarations for the pseudo-random-number generator.
32 * \license GPLv3 or later
33 * \brief This file contains the declarations for the pseudo-random-number generator.
44 #define ENTROPIUM_RANDOMBLOCK_SIZE 32 /* bytes */
46 /** \fn void entropium_addEntropy(unsigned length_b, const void* data)
47 * \brief add entropy to the prng
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
53 void entropium_addEntropy(unsigned length_b, const void* data);
55 /** \fn void entropium_getRandomBlock(void* b)
56 * \brief generate a fixed size block of random data
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
62 void entropium_getRandomBlock(void* b);
64 /** \fn uint8_t entropium_getRandomByte(void)
65 * \brief get a single byte of random data
67 * This function utilizes a internal buffer which gets automatically filled
69 * \return a byte of random data
71 uint8_t entropium_getRandomByte(void);
73 /** \fn void entropium_fillBlockRandom(void* block, unsigned length_B)
74 * \brief get a block of random data
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
82 void entropium_fillBlockRandom(void* block, unsigned length_B);