MPHELL  4.0.0
Functions | Variables
mphell-init.c File Reference

Definition of MPHELL initialisation function. More...

#include <stdlib.h>
#include <time.h>
#include "mphell-init.h"
Include dependency graph for mphell-init.c:

Go to the source code of this file.

Functions

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). More...
 
uint32_t rand32 ()
 Return a 32 bits random number using MPHELL random process. More...
 
int mphell_rng (void *param, unsigned char *res, size_t n)
 Set res to n random bytes. More...
 
void free_mphell ()
 Free MPHELL memory, especially the big amount of temporary memory.
 

Variables

random_state_trandom_working_state
 
uint16_t random_security_strength
 

Detailed Description

Definition of MPHELL initialisation function.

Definition in file mphell-init.c.

Function Documentation

◆ init_mphell()

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).

Parameters
security_strengthMinimum security strength required in bits for random number
typeRandom process to use
entropyEntropy source to use

Definition at line 35 of file mphell-init.c.

◆ mphell_rng()

int mphell_rng ( void *  param,
unsigned char *  res,
size_t  n 
)

Set res to n random bytes.

Parameters
paramFor compatibility, set NULL
resResult byte string
nSize (in byte) of res
Returns
0 on success, abort the program otherwise.

Definition at line 84 of file mphell-init.c.

◆ rand32()

uint64_t rand32 ( )

Return a 32 bits random number using MPHELL random process.

Returns
A 32 bits random number

Definition at line 70 of file mphell-init.c.