HACL* is equipped with a randomness function implemented with platform dependant code for Unix and Windows.


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.


This file is handwritten and is part of the TCB, hence it should be minimally reviewed before being used.