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
TraversalServer: use C++'s <chrono> and <random> #6157
Conversation
9c6c2d5
to
1894c7c
Compare
bytesLeft = sizeof(bytes); | ||
} | ||
memcpy(output, bytes + (bytesLeft -= size), size); | ||
static std::independent_bits_engine<std::default_random_engine, sizeof(unsigned char) * 8, |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
bytesLeft = sizeof(bytes); | ||
} | ||
memcpy(output, bytes + (bytesLeft -= size), size); | ||
static std::independent_bits_engine<std::default_random_engine, sizeof(unsigned char) * 8, |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
ee4ec73
to
e715501
Compare
{ | ||
ssize_t rv = read(urandomFd, bytes, sizeof(bytes)); | ||
if (rv != sizeof(bytes)) | ||
for (; begin != end; ++begin) |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
|
||
{ | ||
static RandomDeviceSeedSequence s_seed_seq; | ||
static std::independent_bits_engine<std::default_random_engine, sizeof(unsigned char) * 8, |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
e715501
to
550c05b
Compare
550c05b
to
9669705
Compare
We use mbed TLS for random number generation now, so that commit is no longer needed. |
Rebased PR: #8091 |
Simpler than
gettimeofday
and reading/dev/urandom
, and cross-platform to boot!