# Mirage\_crypto\_rng\_unix.initialize

**URL:** https://discuss.ocaml.org/t/mirage-crypto-rng-unix-initialize/11505
**Category:** Community
**Tags:** crypto
**Created:** [February 24, 2023, 11:03am UTC](https://discuss.ocaml.org/t/mirage-crypto-rng-unix-initialize/11505 "2023-02-24T11:03:54Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![mro](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ocaml.org/mro/32/2496_2.png) [@mro](https://discuss.ocaml.org/u/mro)
#### Post date: [February 24, 2023, 11:03am UTC](https://discuss.ocaml.org/t/mirage-crypto-rng-unix-initialize/11505/1 "2023-02-24T11:03:54Z")

</div>

@hannes in the past I had calls

`Mirage_crypto_rng_unix.initialize ();`

which don’t compile no more due to an interface change. Now I think I need to set\_default\_generator but have no idea how and where to get one.

Do you have an example how to bootstrap at hand?

Background: I need it e.g. at [seppo/shell.ml at 766cb511500c5e21d499872fc1da313089bd2be0 - seppo - Codeberg.org](https://codeberg.org/seppo/seppo/src/commit/766cb511500c5e21d499872fc1da313089bd2be0/bin/shell.ml#L227)

---

<div class="post-metadata">

### Author: ![mro](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ocaml.org/mro/32/2496_2.png) [@mro](https://discuss.ocaml.org/u/mro)
#### Post date: [February 24, 2023, 11:08am UTC](https://discuss.ocaml.org/t/mirage-crypto-rng-unix-initialize/11505/2 "2023-02-24T11:08:50Z")

</div>

ah, I found you use

` Mirage_crypto_rng_lwt.initialize (module Mirage_crypto_rng.Fortuna)`

at [update to mirage-crypto 0.11, split tls-lwt away · mirleft/ocaml-tls@cec1903 · GitHub](https://github.com/mirleft/ocaml-tls/commit/cec1903bf247a50fc66c4810fd174c6b45e58735#diff-035939814029b3f7cc463ed9f4724f28e79fa9215c1bdfe860f8a4bd183a3ba4R279)

so this may well be sorted.

---

<div class="post-metadata">

### Author: ![hannes](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ocaml.org/hannes/32/2302_2.png) [@hannes](https://discuss.ocaml.org/u/hannes)
#### Post date: [February 24, 2023, 12:15pm UTC](https://discuss.ocaml.org/t/mirage-crypto-rng-unix-initialize/11505/3 "2023-02-24T12:15:25Z")

</div>

Dear @mro,

thanks for bringing this up. Indeed mirage-crypto-rng 0.11.0 has a breaking change (from CHANGES:  
BREAKING unify RNG initialization. This means:

- `Mirage_crypto_rng_lwt.initialize ()` should now be `Mirage_crypto_rng_lwt.initialize (module Mirage_crypto_rng.Fortuna)`
- `Mirage_crypto_rng_unix.initialize ()` should now be `Mirage_crypto_rng_unix.initialize (module Mirage_crypto_rng.Fortuna)`

The reasoning is uniformity across mirage-crypto-rng-\* initialize functions (unix, lwt, async, eio, mirage) – the inconsistency was spotted by @talex5 in [https://github.com/mirage/mirage-crypto/pull/155](https://github.com/mirage/mirage-crypto/pull/155), then preserved in [RNG initialization inconsistencies · Issue #160 · mirage/mirage-crypto · GitHub](https://github.com/mirage/mirage-crypto/issues/160) as issue, and fixed in [[API change] rng: unify API for initialize, as reported in #160 by hannesm · Pull Request #162 · mirage/mirage-crypto · GitHub](https://github.com/mirage/mirage-crypto/pull/162).

---

<div class="post-metadata">

### Author: ![mro](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ocaml.org/mro/32/2496_2.png) [@mro](https://discuss.ocaml.org/u/mro)
#### Post date: [February 24, 2023, 4:26pm UTC](https://discuss.ocaml.org/t/mirage-crypto-rng-unix-initialize/11505/4 "2023-02-24T16:26:33Z")

</div>

that plus slightly changed opam install dependencies. I had to [reflect crypto package / api change. · 121fbc1f32 - seppo - Codeberg.org](https://codeberg.org/seppo/seppo/commit/121fbc1f328a5bee738b898d372d9e8b214f9d55)

(figured that out not before making myself and idiot with a somewhat erratic report and bothering @dbuenzli at [Ptime\_clock unavailable on 32bit raspbian? · Issue #33 · dbuenzli/ptime · GitHub](https://github.com/dbuenzli/ptime/issues/33), lol)

---

<div class="post-metadata">

### Author: ![dbuenzli](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ocaml.org/dbuenzli/32/18_2.png) [@dbuenzli](https://discuss.ocaml.org/u/dbuenzli)
#### Post date: [February 24, 2023, 4:38pm UTC](https://discuss.ocaml.org/t/mirage-crypto-rng-unix-initialize/11505/5 "2023-02-24T16:38:55Z")

</div>

> [@mro](#):
>
> (figured that out not before making myself and idiot with a somewhat erratic report and bothering @dbuenzli at [Ptime\_clock unavailable on 32bit raspbian? · Issue #33 · dbuenzli/ptime · GitHub](https://github.com/dbuenzli/ptime/issues/33), lol)

That’s not making yourself an idiot, that the result of the poor library dependency model we have now (`(implicit_transitive_deps true)`) hopefully [RFC 31](https://github.com/ocaml/RFCs/pull/31) is a first step towards more sanity.

---

<div class="post-metadata">

### Author: ![dbuenzli](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ocaml.org/dbuenzli/32/18_2.png) [@dbuenzli](https://discuss.ocaml.org/u/dbuenzli)
#### Post date: [February 24, 2023, 5:02pm UTC](https://discuss.ocaml.org/t/mirage-crypto-rng-unix-initialize/11505/6 "2023-02-24T17:02:57Z")

</div>

2 posts were split to a new topic: [Generating a bills of material for a build](https://discuss.ocaml.org/t/generating-a-bills-of-material-for-a-build/11509)
