From 36562df4173afc6781308385baae09aaede7740e Mon Sep 17 00:00:00 2001 From: Hannes Mehnert Date: Fri, 6 Dec 2024 11:38:49 +0100 Subject: [PATCH] mirage-crypto-rng-unix: more documentation --- rng/unix/mirage_crypto_rng_unix.mli | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/rng/unix/mirage_crypto_rng_unix.mli b/rng/unix/mirage_crypto_rng_unix.mli index 8a358030..69d1744c 100644 --- a/rng/unix/mirage_crypto_rng_unix.mli +++ b/rng/unix/mirage_crypto_rng_unix.mli @@ -12,13 +12,24 @@ val initialize : ?g:'a -> 'a Mirage_crypto_rng.generator -> unit (** [getrandom size] returns a buffer of [size] filled with random bytes. *) val getrandom : int -> string +(** A generator that opens /dev/urandom and reads from that file descriptor + data whenever random data is needed. The file descriptor is closed in + [at_exit]. *) module Urandom : Mirage_crypto_rng.Generator +(** A generator using [getrandom(3)] on Linux, [getentropy(3)] on BSD and macOS, + and [BCryptGenRandom()] on Windows. *) module Getentropy : Mirage_crypto_rng.Generator +(** [use_default ()] initializes the RNG [Mirage_crypto_rng.default_generator] + with [Urandom] or resorts to [Getentropy] if the urandom failed to open the + /dev/urandom device. *) val use_default : unit -> unit -(** [use_default ()] initializes with [Urandom] or resorts to [Getentropy] otherwise. *) +(** [use_dev_random ()] initializes the RNG [Mirage_crypto_rng.default_generator] + with the [Urandom] generator. *) val use_dev_urandom : unit -> unit +(** [use_getentropy ()] initializes the RNG [Mirage_crypto_rng.default_generator] + with the [Getentropy] generator. *) val use_getentropy : unit -> unit