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

Switch over calls which hit the OS entropy source to F.blocking #184

Open
yilinwei opened this issue Aug 1, 2023 · 3 comments
Open

Switch over calls which hit the OS entropy source to F.blocking #184

yilinwei opened this issue Aug 1, 2023 · 3 comments
Assignees

Comments

@yilinwei
Copy link
Collaborator

yilinwei commented Aug 1, 2023

No description provided.

@yilinwei yilinwei self-assigned this Aug 1, 2023
@yilinwei
Copy link
Collaborator Author

For native, https://www.openssl.org/docs/man3.0/man3/EVP_RAND_fetch.html is the call which reads /udev/random.

@armanbilge
Copy link
Member

Linking to discussion about SecureRandom in typelevel/cats-effect#2882 (comment).

It would be good to avoid blocking if possible since it adds considerable overhead.

For Native, getrandom is promising. With the GRND_NONBLOCK flag it will actually return immediately with an error if it would block. So we could do something like F.delay(...) and retry with F.blocking(...) only if necessary.

https://man7.org/linux/man-pages/man2/getrandom.2.html

@yilinwei
Copy link
Collaborator Author

yilinwei commented Aug 10, 2023

Note, for native it reads something tiny like 32-bits to seed. Especially if we pool it and share our RAND across all the instances. You'd have a single top level F.blocking. I need to look into Node and the JVM.

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

No branches or pull requests

2 participants