Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rng improvements #161

Merged
merged 4 commits into from
Jul 12, 2022
Merged

Rng improvements #161

merged 4 commits into from
Jul 12, 2022

Conversation

hannesm
Copy link
Member

@hannesm hannesm commented Jul 12, 2022

Streamline the semantics of the initialize and entropy feeding.

This applies a8c7bbd (May 2020) to the mirage
rng feeding.

The reasoning behind this change is twofold:
- consistency of the semantics across implementations (lwt, mirage, async);
- make it hard to produce bad random.

Now, the expectation is that a single RNG is used in an application, and this
is fed fresh entropy on a periodic basis. Since the API allows to mutate the
default generator (Mirage_crypto_rng.set_default_generator), which is used
by default by all applications, it is crucial that this one receives fresh
entropy.

The "initialize" function does the following: fail if the default rng is already
set; collect some bootstrap entropy; set the default rng; start tasks that
periodically (every m nanoseconds) collect entropy and feed it to the generator;
register a hook to the scheduler to collect a bit more entropy on every
scheduling decision.
@hannesm hannesm merged commit 00c2e70 into mirage:main Jul 12, 2022
@hannesm hannesm deleted the rng-fixes branch July 12, 2022 09:20
hannesm added a commit to hannesm/opam-repository that referenced this pull request Sep 13, 2022
…age, mirage-crypto-rng-eio, mirage-crypto-rng-async, mirage-crypto-pk and mirage-crypto-ec (0.10.7)

CHANGES:

- mirage-crypto-rng-eio: new package for seeding and feeding entropy to the
  rng with eio (mirage/mirage-crypto#155 @bikallem, @talex5, @hannesm)
- mirage-crypto-ec: expose Dsa.byte_length (mirage/mirage-crypto#164 @hannesm)
- CI: various fixes (mirage/mirage-crypto#154 mirage/mirage-crypto#164 @hannesm)
- mirage-crypto-rng-mirage: use 'a generator type alias
- mirage-crypto-rng: improve setup_rng message (add async, revise lwt) (mirage/mirage-crypto#161
  @hannesm)
- mirage-crypto-rng-mirage: always feed the default generator (as done in
  a8c7bbd2552a9d2177450e95f280342f80fba01d for the lwt feeding) (mirage/mirage-crypto#161 @hannesm)
- ec: update generated code to recent fiat-crypto (mirage/mirage-crypto#156 @hannesm)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant