package mirage-types

  1. Overview
  2. Docs

A native entropy provider. *

type error = [
  1. | `No_entropy_device of string
]

Represents errors when attaching the entropy provider.

include DEVICE with type error := error
type +'a io

A potentially blocking I/O operation

type t

The type representing the internal state of the device

type id

Type defining an identifier for this device that uniquely identifies it among a device tree.

val id : t -> id

Return the identifier that was used to construct this device

val connect : id -> [ `Error of error | `Ok of t ] io

Connect to the device identified by id

val disconnect : t -> unit io

Disconnect from the device. While this might take some time to complete, it can never result in an error.

type buffer

usually a cstruct

type handler = source:int -> buffer -> unit

* A handler is called whenever the system has extra entropy to announce. * No guarantees are made about the entropy itself, other than it being * environmentally derived. In particular, the amount of entropy in the buffer * can be far lower than the size of the buffer. * * source is a small integer, describing the provider but with no other * meaning. * * handler is expected to return quickly. *

val handler : t -> handler -> unit io

handler h registers the single global handler that will receive * entropy. There might be additional, provider-specific blocking semantics. *

OCaml

Innovation. Community. Security.