Randomness#

DRBG#

Deterministic Random Bit Generator (DRBG) (NIST, SP 800-90A).

API Reference#

#include "EverCrypt_DRBG.h"

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, and Spec_Hash_Definitions_SHA1.

Returns:

DRBG state. Needs to be freed via EverCrypt_DRBG_uninstantiate.

Create a DRBG state.

  • a Hash algorithm to use. The possible instantiations are …

  • Spec_Hash_Definitions_SHA2_256,

  • Spec_Hash_Definitions_SHA2_384,

  • Spec_Hash_Definitions_SHA2_512, and

  • Spec_Hash_Definitions_SHA1.

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.

Instantiate the DRBG.

  • st Pointer to DRBG state.

  • personalization_string_len length of personalization string.

  • personalization_string Pointer to personalization_string_len bytes of memory where personalization string is read from.

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.

Reseed the DRBG.

  • st Pointer to DRBG state.

  • additional_input_input_len Length of additional input.

  • additional_input_input Pointer to additional_input_input_len bytes of memory where additional input is read from.

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.

Generate output.

  • 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_len Length of additional input.

  • additional_input_input Pointer to additional_input_input_len bytes of memory where additional input is read from.

void EverCrypt_DRBG_uninstantiate(EverCrypt_DRBG_state_s *st)#

Uninstantiate and free the DRBG.

Parameters:

st – Pointer to DRBG state.

Uninstantiate and free the DRBG.

  • st Pointer to DRBG state.

uint32_t EverCrypt_DRBG_min_length(Spec_Hash_Definitions_hash_alg a)#

bool EverCrypt_DRBG_uu___is_SHA1_s(Spec_Hash_Definitions_hash_alg uu___, EverCrypt_DRBG_state_s projectee)#
bool EverCrypt_DRBG_uu___is_SHA2_256_s(Spec_Hash_Definitions_hash_alg uu___, EverCrypt_DRBG_state_s projectee)#
bool EverCrypt_DRBG_uu___is_SHA2_384_s(Spec_Hash_Definitions_hash_alg uu___, EverCrypt_DRBG_state_s projectee)#
bool EverCrypt_DRBG_uu___is_SHA2_512_s(Spec_Hash_Definitions_hash_alg uu___, EverCrypt_DRBG_state_s projectee)#

Warning

doxygenfunction: Cannot find function “EverCrypt_DRBG_instantiate_sha1” in doxygen xml output for project “HACL Packages” from directory: ../../build/doxygen/xml/

Warning

doxygenfunction: Cannot find function “EverCrypt_DRBG_instantiate_sha2_256” in doxygen xml output for project “HACL Packages” from directory: ../../build/doxygen/xml/

Warning

doxygenfunction: Cannot find function “EverCrypt_DRBG_instantiate_sha2_384” in doxygen xml output for project “HACL Packages” from directory: ../../build/doxygen/xml/

Warning

doxygenfunction: Cannot find function “EverCrypt_DRBG_instantiate_sha2_512” in doxygen xml output for project “HACL Packages” from directory: ../../build/doxygen/xml/

Warning

doxygenfunction: Cannot find function “EverCrypt_DRBG_reseed_sha1” in doxygen xml output for project “HACL Packages” from directory: ../../build/doxygen/xml/

Warning

doxygenfunction: Cannot find function “EverCrypt_DRBG_reseed_sha2_256” in doxygen xml output for project “HACL Packages” from directory: ../../build/doxygen/xml/

Warning

doxygenfunction: Cannot find function “EverCrypt_DRBG_reseed_sha2_384” in doxygen xml output for project “HACL Packages” from directory: ../../build/doxygen/xml/

Warning

doxygenfunction: Cannot find function “EverCrypt_DRBG_reseed_sha2_512” in doxygen xml output for project “HACL Packages” from directory: ../../build/doxygen/xml/

Warning

doxygenfunction: Cannot find function “EverCrypt_DRBG_generate_sha1” in doxygen xml output for project “HACL Packages” from directory: ../../build/doxygen/xml/

Warning

doxygenfunction: Cannot find function “EverCrypt_DRBG_generate_sha2_256” in doxygen xml output for project “HACL Packages” from directory: ../../build/doxygen/xml/

Warning

doxygenfunction: Cannot find function “EverCrypt_DRBG_generate_sha2_384” in doxygen xml output for project “HACL Packages” from directory: ../../build/doxygen/xml/

Warning

doxygenfunction: Cannot find function “EverCrypt_DRBG_generate_sha2_512” in doxygen xml output for project “HACL Packages” from directory: ../../build/doxygen/xml/

Warning

doxygenfunction: Cannot find function “EverCrypt_DRBG_uninstantiate_sha1” in doxygen xml output for project “HACL Packages” from directory: ../../build/doxygen/xml/

Warning

doxygenfunction: Cannot find function “EverCrypt_DRBG_uninstantiate_sha2_256” in doxygen xml output for project “HACL Packages” from directory: ../../build/doxygen/xml/

Warning

doxygenfunction: Cannot find function “EverCrypt_DRBG_uninstantiate_sha2_384” in doxygen xml output for project “HACL Packages” from directory: ../../build/doxygen/xml/

Warning

doxygenfunction: Cannot find function “EverCrypt_DRBG_uninstantiate_sha2_512” in doxygen xml output for project “HACL Packages” from directory: ../../build/doxygen/xml/