Skip to content

Conversation

@devnexen
Copy link
Contributor

  • 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.

@datastax-bot
Copy link

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,
DataStax Bot.

@datastax-bot
Copy link

Thank you @devnexen for signing the Contribution License Agreement.

Cheers,
DataStax Bot.

@mpenick
Copy link
Contributor

mpenick commented Jul 19, 2017

@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",
Copy link
Contributor

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
Copy link
Contributor

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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#endif defined(HAVE_ARC4RANDOM)

@mpenick
Copy link
Contributor

mpenick commented Aug 24, 2017

LGTM. Just a couple comments.

@mpenick
Copy link
Contributor

mpenick commented Aug 24, 2017

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.
@devnexen devnexen force-pushed the randomization_changes branch from 253d48b to 114e6ab Compare August 24, 2017 20:23
@mpenick mpenick merged commit 0a79ce7 into apache:master Aug 25, 2017
mpenick pushed a commit that referenced this pull request Sep 18, 2017
This reverts commit 0a79ce7, reversing
changes made to 1c50794.
mikefero pushed a commit that referenced this pull request Sep 21, 2017
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.

3 participants