MPHELL
4.0.0
|
Declaration of random functions. More...
#include "mphell-drbg.h"
Go to the source code of this file.
Data Structures | |
struct | random_state_t |
Define a random state. More... | |
Typedefs | |
typedef enum random_algo | random_type |
Define the random algorithm (DRBG algorithm) | |
typedef random_state_t | random_state[1] |
Address of a random_state_t structure. | |
Enumerations | |
enum | random_algo { RANDOM_INTEL, RANDOM_AES128, RANDOM_AES192, RANDOM_AES256, RANDOM_SHA1, RANDOM_SHA256, STM32F4_RNG, RANDOM_UNSET } |
Define the random algorithm (DRBG algorithm) More... | |
Functions | |
void | random_instantiate (mphell_status ret, random_state initial_state, const uint16_t requested_instantiation_security_strength, const uint8_t *personalization_string, const uint64_t pers_length, const random_type type, const entropy_type entropy, uint64_t reseed_interval) |
Instantiate one random state. More... | |
void | random_reseed (mphell_status ret, random_state working_state, const uint16_t entropy_length, const entropy_type entropy_src, const uint8_t *additional_input, const uint64_t add_length) |
Reseed the DRBG (if you want to reseed it before it does by itself) More... | |
void | random_generate (mphell_status ret, uint8_t *returned_bytes, random_state working_state, const uint32_t requested_number_of_bytes, const uint16_t requested_security_strength, const uint8_t *additionnal_input, const uint64_t add_length) |
Gererate an array of random bits. More... | |
void | random_uninstantiate (mphell_status ret, random_state working_state) |
Uninstantiate a random state. More... | |
Variables | |
void(* | stm32f4_rng )(mphell_status ret, uint8_t *data, const uint16_t length) |
This function pointer must be set in the stm32f4 application before calling init_mphell. | |
Declaration of random functions.
Definition in file mphell-random.h.
enum random_algo |
Define the random algorithm (DRBG algorithm)
Definition at line 35 of file mphell-random.h.
void random_generate | ( | mphell_status | ret, |
uint8_t * | returned_bytes, | ||
random_state | working_state, | ||
const uint32_t | requested_number_of_bytes, | ||
const uint16_t | requested_security_strength, | ||
const uint8_t * | additional_input, | ||
const uint64_t | add_length | ||
) |
Gererate an array of random bits.
ret | Set to MPHELL_ERROR_RANDOM if an error occur, MPHELL_SUCCESS otherwise |
returned_bytes | Destination array (of requested_number_of_bytes random bits) |
working_state | Define which DRBG state to use |
requested_number_of_bytes | Number of random bits required |
requested_security_strength | Security (in bits) required |
additionnal_input | A string given by the user can be added to the material seed to reseed the DRBG |
add_length | Length of additional_input |
Definition at line 367 of file mphell-random.c.
void random_instantiate | ( | mphell_status | ret, |
random_state | initial_state, | ||
const uint16_t | requested_instantiation_security_strength, | ||
const uint8_t * | personalization_string, | ||
const uint64_t | pers_length, | ||
const random_type | type, | ||
const entropy_type | entropy, | ||
uint64_t | reseed_interval | ||
) |
Instantiate one random state.
ret | Set to MPHELL_ERROR_RANDOM if an error occur, MPHELL_SUCCESS otherwise |
initial_state | Destination structure, store the random algorithm and the number of the DRBG state used. |
requested_instantiation_security_strength | Security (in bits) required |
personalization_string | A string given by the user can be added to the material seed to instantiate the DRBG |
pers_length | Length of personalization_string |
type | Random algorithm to use (RANDOM_INTEL, RANDOM_AES128, RANDOM_AES192, RANDOM_AES256, RANDOM_SHA1, RANDOM_SHA256) |
entropy | Entropy to use (to seed the DRBG): INTEL, DEVURANDOM, DEVRANDOM |
reseed_interval | Reseed interval, must be between 1 (prediction resistance == true) and 2^48 |
Definition at line 29 of file mphell-random.c.
void random_reseed | ( | mphell_status | ret, |
random_state | working_state, | ||
const uint16_t | entropy_length, | ||
const entropy_type | entropy_src, | ||
const uint8_t * | additional_input, | ||
const uint64_t | add_length | ||
) |
Reseed the DRBG (if you want to reseed it before it does by itself)
ret | Set to MPHELL_ERROR_RANDOM if an error occur, MPHELL_SUCCESS otherwise |
working_state | Define which DRBG state to use |
entropy_length | Number of bits to extract from the entropy source |
entropy_src | Entropy to use (to seed the DRBG): INTEL, DEVURANDOM, DEVRANDOM |
additional_input | A string given by the user can be added to the material seed to reseed the DRBG |
add_length | Length of additional_input |
Definition at line 226 of file mphell-random.c.
void random_uninstantiate | ( | mphell_status | ret, |
random_state | working_state | ||
) |
Uninstantiate a random state.
ret | Set to MPHELL_ERROR_RANDOM if an error occur, MPHELL_SUCCESS otherwise |
working_state | Random state to uninstantiate |
Definition at line 427 of file mphell-random.c.