-
-
Notifications
You must be signed in to change notification settings - Fork 140
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
dream.middleware
and dream.cipher
is MirageOS compatible
#115
Conversation
…- and move the mirage-crypto-rng.lwt dependency to the dream package
…ware be MirageOS compatible
My point of view: Indeed for cryptographic keys you need a strong (cryptographically secure) random number generator. This also needs to be initialized (and best periodically fed entropy into). Using Mirage_crypto_rng is a good choice. The Initialization, as done here, is fine. The |
Thanks @dinosaure for PR and @hannesm for review! |
This patch is small but a bit complex.
mirage-crypto-rng.lwt
is not compatible with MirageOS because it plays withLwt_engine
to add a hook to continuously feed the random number generator - where MirageOS has its own scheduler. So we need to delete it fromdream.cipher
to be MirageOS compatible.However, at this step, we have multiple choices:
Mirage_random.S
mirage-crypto-rng
and initialize it into the main moduledream.ml
(as we did about logs - see Delete any occurrences of Unix.gettimeofday to be compatible with MirageOS #102)I chosen the second solution but from the abstraction perspective, we have a strong link between
dream
andmirage-crypto-rng
(even for MirageOS). It implies that the end-user must trust onmirage-crypto-rng
and he is not able to chose something else then - even for MirageOS.This is an hard issue and well-know in MirageOS, so I just would like to have the opinion of @hannesm on that and, of course, your opinion @aantron.
The second commit is an implication of the first one. Due to the deletion of
mirage-crypto-rng.lwt
fromdream.cipher
and with my others patches (see #100, #102, #107, #108 and #114),Lwt_engine
/Lwt_unix
/Lwt_io
are not available anymore via subsequent dependencies. So, with the first patch,static.ml
does not compile (which requiresLwt_io
). So I decided to, internally, make a sub-packagedream.middleware.static
(which bringslwt.unix
) and includes it into the maindream.ml
module.Such design gives me the opportunity to not use
static
middleware into my MirageOS (which does not have a file-system). Of course, at the end, nothing change on the Dream interface.