-
Notifications
You must be signed in to change notification settings - Fork 292
Changing the randomisation generation : #361
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
Conversation
|
Hi @devnexen, thanks for your contribution! In order for us to evaluate and accept your PR, we ask that you sign a contribution license agreement. It's all electronic and will take just minutes. Sincerely, |
|
Thank you @devnexen for signing the Contribution License Agreement. Cheers, |
|
@devnexen Thanks for taking the time to do this. I'll review this sometime this week. |
src/random.cpp
Outdated
| char* err = STRERROR_R_(errno, buf, sizeof(buf)); | ||
| LOG_CRITICAL("Unable to open random device (%s): %s", device, err); | ||
| return seed; | ||
| LOG_WARN("Unable to read %zu random bytes (%s): %zu read", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"%zu" isn't portable.
src/random.cpp
Outdated
| } else { | ||
| readurandom = false; | ||
| } | ||
| #endif |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would improve readability if this was #endif // defined(HAVE_GETRANDOM). These nested #ifs are hard to follow.
src/random.cpp
Outdated
| } | ||
|
|
||
| close(fd); | ||
| #endif |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#endif defined(HAVE_ARC4RANDOM)
|
LGTM. Just a couple comments. |
|
Thanks for the quick commit. Can you please rebase on master so we can get CI to pass? |
- using getrandom syscall on linux, trying to read as we can in non blocking mode, falling back to dev urandom eventually. - on *BSD and MacOS, using arc4random_buf which does not fail.
253d48b to
114e6ab
Compare
This reverts commit 1683411.
non blocking mode, falling back to dev urandom eventually.