MPHELL  4.0.0
mphell-random.h
Go to the documentation of this file.
1 /*
2  MPHELL-4.0
3  Author(s): The MPHELL team
4 
5  (C) Copyright 2015-2018 - Institut Fourier / Univ. Grenoble Alpes (France)
6 
7  This file is part of the MPHELL Library.
8  MPHELL is free software: you can redistribute it and/or modify
9  it under the terms of the GNU Lesser General Public License as published by
10  the Free Software Foundation, version 3 of the License.
11 
12  MPHELL is distributed in the hope that it will be useful,
13  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  GNU Lesser General Public License for more details.
16 
17  You should have received a copy of the GNU Lesser General Public License
18  along with MPHELL. If not, see <http://www.gnu.org/licenses/>.
19 */
20 
26 #ifndef RANDOM_H
27 #define RANDOM_H
28 
29 #include "mphell-drbg.h"
30 
44 };
45 
50 typedef enum random_algo random_type;
51 
56 typedef struct {
57  int8_t state_handle;
60 
66 
79 void
81  const uint16_t requested_instantiation_security_strength,
82  const uint8_t* personalization_string,
83  const uint64_t pers_length, const random_type type,
84  const entropy_type entropy, uint64_t reseed_interval);
85 
96 void
97 random_reseed(mphell_status ret, random_state working_state,
98  const uint16_t entropy_length, const entropy_type entropy_src,
99  const uint8_t* additional_input,
100  const uint64_t add_length);
101 
113 void
114 random_generate(mphell_status ret, uint8_t* returned_bytes,
115  random_state working_state,
116  const uint32_t requested_number_of_bytes,
117  const uint16_t requested_security_strength,
118  const uint8_t* additionnal_input, const uint64_t add_length);
119 
126 void
128 
133 extern void (*stm32f4_rng)(mphell_status ret, uint8_t *data, const uint16_t length);
134 
135 #endif
Declaration of the Deterministic Random Bit Generator functions. Details can be found in "NIST Specia...
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)
enum random_algo random_type
Define the random algorithm (DRBG algorithm)
Definition: mphell-random.h:50
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.
Definition: mphell-random.c:29
random_algo
Define the random algorithm (DRBG algorithm)
Definition: mphell-random.h:35
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.
random_state_t random_state[1]
Address of a random_state_t structure.
Definition: mphell-random.h:65
void random_uninstantiate(mphell_status ret, random_state working_state)
Uninstantiate a random state.
mphell_status_t mphell_status[1]
The status is a couple (flag, information)
Definition: mphell-errors.h:94
int8_t state_handle
Definition: mphell-random.h:57
random_type type
Definition: mphell-random.h:58
enum entropy_source entropy_type
Define the entropy source.
Define a random state.
Definition: mphell-random.h:56
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.