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

windows support for entropy devices #135

Open
samoht opened this issue Dec 13, 2017 · 3 comments
Open

windows support for entropy devices #135

samoht opened this issue Dec 13, 2017 · 3 comments

Comments

@samoht
Copy link
Contributor

samoht commented Dec 13, 2017

Is there any plan to support entropy devices for windows? The current code for initialising entropy does this:

let devices  = [ "/dev/urandom"; "/dev/random" ]

let fs_exists name =
  Unix.(try ignore (stat name); true with Unix_error (ENOENT, _, _) -> false)

let sys_rng =
  try List.find fs_exists devices with Not_found ->
    failwith "Nocrypto_entropy_unix: no random device"

which obviously fails at runtime on windows. That would be great to fail at compile time instead (or to add the relevant constraints in the opam file).

I guess my best option for now on is are to somehow use mirage-entropy.

@pqwy
Copy link
Contributor

pqwy commented Dec 13, 2017

My (rather vague) idea was that this is the _unix module, so I didn't make any effort to make it Win compatible.

Can you even compile the library on Windows without significant problems? How about the current master, which uses the system-wide endian-related headers? How important is this use-case?

In general, Windows are nowhere on my radar. But if this really matters, I can whip up an entropy module that seeds with Crypto API or its NG.

@dbuenzli
Copy link

@pqwy in OCaml, the Unix library is actually pretty good Unix/Windows compatibility layer...

samoht added a commit to samoht/ocaml-conduit that referenced this issue Jul 16, 2018
Nocrypto_entropy_unix is failing at startup on windows.
See mirleft/ocaml-nocrypto#135
@ulrikstrid
Copy link

ulrikstrid commented May 20, 2019

The endian issue is fixed in #161. My fork with that endian fix builds fine on Windows but I hit this issue. If there are any pointers on how i would add a Windows entorpy implementation I would be super happy. This seems to be the last blocker for getting tls to build and work on Windows.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

4 participants