MPHELL  4.0.0
mphell-init.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 MPHELL_INIT_ARITH_H
27 #define MPHELL_INIT_ARITH_H
28 
29 #include <inttypes.h>
30 
31 #include "mphell-tmp.h"
32 #include "mphell-random.h"
33 
34 extern random_state_t *random_working_state;
35 extern uint16_t random_security_strength;
36 
44 void
45 init_mphell(const uint16_t security_strength, const random_type type,
46  const entropy_type entropy);
47 
48 #if BLOCK_SIZE == 64
49 
54 uint64_t
55 rand64();
56 #endif
57 
63 uint32_t
64 rand32();
65 
74 int
75 mphell_rng(void * param, unsigned char * res, size_t n);
76 
81 void
82 free_mphell();
83 
84 #endif
int mphell_rng(void *param, unsigned char *res, size_t n)
Set res to n random bytes.
Definition: mphell-init.c:84
uint32_t rand32()
Return a 32 bits random number using MPHELL random process.
Definition: mphell-init.c:70
enum random_algo random_type
Define the random algorithm (DRBG algorithm)
Definition: mphell-random.h:50
void init_mphell(const uint16_t security_strength, const random_type type, const entropy_type entropy)
Initialise MPHELL with security_strength bits of security (for random number only).
Definition: mphell-init.c:35
void free_mphell()
Free MPHELL memory, especially the big amount of temporary memory.
Definition: mphell-init.c:97
Declaration of random functions.
Declaration of internal MPHELL temporary memory functions.
enum entropy_source entropy_type
Define the entropy source.
Define a random state.
Definition: mphell-random.h:56