MPHELL  4.0.0
Functions
mphell-drbg.h File Reference

Declaration of the Deterministic Random Bit Generator functions. Details can be found in "NIST Special Publication 800-90A, Recommendation for Random Number Generation Using Deterministic Random Bit Generators". More...

#include "mphell-drbg_internal.h"
Include dependency graph for mphell-drbg.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

void drbg_instantiate (mphell_status ret, int8_t *state_handle, const uint16_t requested_instantiation_security_strength, const drbg_type type, const entropy_type entropy_src, uint64_t reseed_interval, const uint8_t *entropy, const uint16_t entropy_length, const uint8_t *nonce, const uint16_t nonce_length, const uint8_t *personalization_string, const uint64_t pers_length)
 
void drbg_reseed (mphell_status ret, const int8_t state_handle, const uint8_t *entropy, const uint16_t entropy_length, const uint8_t *additional_input, const uint64_t add_length)
 Reseed the DRBG, "acquires new entropy input and combines it with the current internal state and any additional input that is provided to create a new seed and a new internal state". More...
 
void drbg_generate (mphell_status ret, uint8_t *returned_bytes, const int8_t state_handle, const uint32_t requested_number_of_bytes, const uint16_t requested_security_strength, const uint8_t *additional_input, const uint64_t add_length)
 "Generates pseudorandom bits upon request, using the current internal state, and generates a new internal state for the next request". More...
 
void drbg_uninstantiate (mphell_status ret, const int8_t state_handle)
 Uninstantiate a DRBG state. More...
 

Detailed Description

Declaration of the Deterministic Random Bit Generator functions. Details can be found in "NIST Special Publication 800-90A, Recommendation for Random Number Generation Using Deterministic Random Bit Generators".

Definition in file mphell-drbg.h.

Function Documentation

◆ drbg_generate()

void drbg_generate ( mphell_status  ret,
uint8_t *  returned_bytes,
const int8_t  state_handle,
const uint32_t  requested_number_of_bytes,
const uint16_t  requested_security_strength,
const uint8_t *  additional_input,
const uint64_t  add_length 
)

"Generates pseudorandom bits upon request, using the current internal state, and generates a new internal state for the next request".

Parameters
retSet to MPHELL_ERROR_RANDOM if an error occur, MPHELL_SUCCESS otherwise
returned_bytesDestination array (of requested_number_of_bytes random bits)
state_handleDefine which DRBG state to use
requested_number_of_bytesNumber of random bytes required
requested_security_strengthSecurity (in bits) required
additionnal_inputA string given by the user can be added to the material seed to reseed the DRBG, "can provide more assurance when recovering from the compromise of the entropy input, the seed or one or more DRBG internal states"
add_lengthLength of additional_input

Definition at line 311 of file mphell-drbg.c.

◆ drbg_reseed()

void drbg_reseed ( mphell_status  ret,
const int8_t  state_handle,
const uint8_t *  entropy,
const uint16_t  entropy_length,
const uint8_t *  additional_input,
const uint64_t  add_length 
)

Reseed the DRBG, "acquires new entropy input and combines it with the current internal state and any additional input that is provided to create a new seed and a new internal state".

Parameters
retSet to MPHELL_ERROR_RANDOM if an error occur, MPHELL_SUCCESS otherwise
state_handleDefine which DRBG state to use
entropyEntropy (byte string)
entropy_lengthEntropy length (in bytes)
additional_inputA string given by the user can be added to the material seed to reseed the DRBG, "can provide more assurance when recovering from the compromise of the entropy input, the seed or one or more DRBG internal states"
add_lengthLength of additional_input

Definition at line 243 of file mphell-drbg.c.

◆ drbg_uninstantiate()

void drbg_uninstantiate ( mphell_status  ret,
const int8_t  state_handle 
)

Uninstantiate a DRBG state.

Parameters
retSet to MPHELL_ERROR_RANDOM if an error occur, MPHELL_SUCCESS otherwise
state_handleDRBG state to uninstantiate

Definition at line 451 of file mphell-drbg.c.