Randomness#
DRBG#
Deterministic Random Bit Generator (DRBG) (NIST, SP 800-90A).
Available Implementations#
#include "EverCrypt_DRBG.h"
API Reference#
Variables#
-
uint32_t EverCrypt_DRBG_reseed_interval#
-
uint32_t EverCrypt_DRBG_max_output_length#
-
uint32_t EverCrypt_DRBG_max_length#
-
uint32_t EverCrypt_DRBG_max_personalization_string_length#
-
uint32_t EverCrypt_DRBG_max_additional_input_length#
Typedefs#
-
typedef Spec_Hash_Definitions_hash_alg EverCrypt_DRBG_supported_alg#
-
typedef struct EverCrypt_DRBG_state_s_s EverCrypt_DRBG_state_s#
Functions#
-
EverCrypt_DRBG_state_s *EverCrypt_DRBG_create(Spec_Hash_Definitions_hash_alg a)#
Create a DRBG state.
- Parameters:
a – Hash algorithm to use. The possible instantiations are …
Spec_Hash_Definitions_SHA2_256
,Spec_Hash_Definitions_SHA2_384
,Spec_Hash_Definitions_SHA2_512
, andSpec_Hash_Definitions_SHA1
.- Returns:
DRBG state. Needs to be freed via
EverCrypt_DRBG_uninstantiate
.
-
bool EverCrypt_DRBG_instantiate(EverCrypt_DRBG_state_s *st, uint8_t *personalization_string, uint32_t personalization_string_len)#
Instantiate the DRBG.
- Parameters:
st – Pointer to DRBG state.
personalization_string – Pointer to
personalization_string_len
bytes of memory where personalization string is read from.personalization_string_len – Length of personalization string.
- Returns:
True if and only if instantiation was successful.
-
bool EverCrypt_DRBG_reseed(EverCrypt_DRBG_state_s *st, uint8_t *additional_input, uint32_t additional_input_len)#
Reseed the DRBG.
- Parameters:
st – Pointer to DRBG state.
additional_input_input – Pointer to
additional_input_input_len
bytes of memory where additional input is read from.additional_input_input_len – Length of additional input.
- Returns:
True if and only if reseed was successful.
-
bool EverCrypt_DRBG_generate(uint8_t *output, EverCrypt_DRBG_state_s *st, uint32_t n, uint8_t *additional_input, uint32_t additional_input_len)#
Generate output.
- Parameters:
output – Pointer to
n
bytes of memory where random output is written to.st – Pointer to DRBG state.
n – Length of desired output.
additional_input_input – Pointer to
additional_input_input_len
bytes of memory where additional input is read from.additional_input_input_len – Length of additional input.
- Returns:
True if and only if generate was successful.
-
void EverCrypt_DRBG_uninstantiate(EverCrypt_DRBG_state_s *st)#
Uninstantiate and free the DRBG.
- Parameters:
st – Pointer to DRBG state.
-
uint32_t EverCrypt_DRBG_min_length(Spec_Hash_Definitions_hash_alg a)#