RandomnessΒΆ
HACL* is equipped with a randomness function implemented with platform dependant code for Unix and Windows.
KRML_DEPRECATED("random_crypto")
extern bool Lib_RandomBuffer_System_randombytes(uint8_t *buf, uint32_t len);
It takes a pointer to a memory location and a number of random bytes to be written from that location. Beware of not asking for more bytes than owned.
Internally, read_random_bytes
is implemented using
CryptGenRandom
for Microsoft Windows and using /dev/urandom
for Unix platforms.
Warning
This file is handwritten and is part of the TCB, hence it should be minimally reviewed before being used.