Module EverCrypt.DRBG
Agile, multiplexing interface for HMAC-DRBG
The supported hashing algorithms are SHA2-256, SHA2-384, SHA2-512.
Users first need to instantiate an internal state with a compatible hashing algorithm and an optional but recommended personalization string. The generate
or Noalloc.generate
functions can then be called any number of times.
Users have the possibility to reseed, but it is not required.
val is_supported_alg : SharedDefs.HashDefs.alg -> bool
is_supported_alg alg
returns true if the hashing algorithmalg
is supported in the agile HMAC-DRBG interface.
val instantiate : ?personalization_string:bytes -> SharedDefs.HashDefs.alg -> t option
instantiate ?personalization_string alg
allocates the internal state for algorithmalg
using the optionalpersonalization_string
and returns at
.
val generate : ?additional_input:bytes -> t -> int -> bytes option
generate ?additional_input st size
takes optionaladditional_input
, a statest
andsize
, the desired number of random bytes, and returns such a buffer if successful.
val reseed : ?additional_input:bytes -> t -> bool
reseed ?additional_input st
attempts to reseedst
, using the optionaladditional_input
and returns true if successful.
module Noalloc : sig ... end
Versions of these functions which write their output in a buffer passed in as an argument