mirror of
https://github.com/nghttp2/nghttp2.git
synced 2025-12-07 02:28:53 +08:00
Merge pull request #2326 from nghttp2/quic-rand-take2
quic: Use secure random generator for ngtcp2_rand
This commit is contained in:
@@ -291,8 +291,11 @@ void Client::quic_write_qlog(const void *data, size_t datalen) {
|
||||
|
||||
namespace {
|
||||
void rand(uint8_t *dest, size_t destlen, const ngtcp2_rand_ctx *rand_ctx) {
|
||||
util::random_bytes(dest, dest + destlen,
|
||||
*static_cast<std::mt19937 *>(rand_ctx->native_handle));
|
||||
auto rv = RAND_bytes(dest, destlen);
|
||||
if (rv != 1) {
|
||||
assert(0);
|
||||
abort();
|
||||
}
|
||||
}
|
||||
} // namespace
|
||||
|
||||
|
||||
@@ -199,8 +199,11 @@ void Http3Upstream::qlog_write(const void *data, size_t datalen, bool fin) {
|
||||
|
||||
namespace {
|
||||
void rand(uint8_t *dest, size_t destlen, const ngtcp2_rand_ctx *rand_ctx) {
|
||||
util::random_bytes(dest, dest + destlen,
|
||||
*static_cast<std::mt19937 *>(rand_ctx->native_handle));
|
||||
auto rv = RAND_bytes(dest, destlen);
|
||||
if (rv != 1) {
|
||||
assert(0);
|
||||
abort();
|
||||
}
|
||||
}
|
||||
} // namespace
|
||||
|
||||
|
||||
Reference in New Issue
Block a user