Skip to content

Commit

Permalink
mirage-crypto-rng-unix: more documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
hannesm committed Dec 6, 2024
1 parent 0917c36 commit 36562df
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion rng/unix/mirage_crypto_rng_unix.mli
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 36562df

Please sign in to comment.