package mirage-crypto-rng
Install
dune-project
Dependency
Authors
Maintainers
Sources
sha256=09542bcd96c1d368ff9ba8853105f4c1781d8c94c2400df9f3ac0610ee07e67e
sha512=1b31c9df0ce774c87a36f714db4ea1f295bc1e2e317d30497523ec03564cace0f64ac4c535aa83c82792aa3331a92efe774e4c3300a6ffe09110ce0efc2ce24b
doc/mirage-crypto-rng/Mirage_crypto_rng/Entropy/index.html
Module Mirage_crypto_rng.EntropySource
Entropy sources and collection
val sources : unit -> source listsources () returns the list of available sources.
val pp_source : Format.formatter -> source -> unitpp_source ppf source pretty-prints the entropy source on ppf.
val register_source : string -> sourceregister_source name registers name as entropy source.
Bootstrap
whirlwind_bootstrap id exploits CPU-level data races which lead to execution-time variability. It returns 200 bytes random data prefixed by id.
See http://www.ieee-security.org/TC/SP2014/papers/Not-So-RandomNumbersinVirtualizedLinuxandtheWhirlwindRNG.pdf for further details.
val cpu_rng_bootstrap : (int -> string, [ `Not_supported ]) Result.tcpu_rng_bootstrap id returns 8 bytes of random data using the CPU RNG (rdseed). On 32bit platforms, only 4 bytes are filled. The id is used as prefix. If only rdrand is available, the return value is the concatenation of 512 calls to rdrand.
bootstrap id is either cpu_rng_bootstrap, if the CPU supports it, or whirlwind_bootstrap if not.
Timer source
interrupt_hook collects lower bytes from the cycle counter, to be used for entropy collection in the event loop.
val timer_accumulator : g option -> unit -> unittimer_accumulator g is the accumulator for the timer source, applying interrupt_hook on each call.
Periodic pulled sources
feed_pools g source f feeds all pools of g using source by executing f for each pool.
cpu_rng g uses the CPU RNG (rdrand or rdseed) to feed all pools of g. It uses feed_pools internally. If neither rdrand nor rdseed are available, `Not_supported is returned.