Skip to content

Commit 544dd9e

Browse files
ww-oaiRalith
authored andcommitted
Upgrade to rand 0.10.1
Make Endpoint::new panicking on CSPRNG init failure.
1 parent a7499b8 commit 544dd9e

16 files changed

Lines changed: 111 additions & 120 deletions

File tree

Cargo.lock

Lines changed: 66 additions & 85 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ crc = "3"
2525
directories-next = "2"
2626
fastbloom = "0.14"
2727
futures-io = "0.3.19"
28-
getrandom = { version = "0.3", default-features = false }
28+
getrandom = { version = "0.4", default-features = false }
2929
hdrhistogram = { version = "7.2", default-features = false }
3030
hex-literal = "1"
3131
lru-slab = "0.1.2"
@@ -34,7 +34,7 @@ log = "0.4"
3434
once_cell = "1.19"
3535
pin-project-lite = "0.2"
3636
qlog = "0.15.2"
37-
rand = "0.9"
37+
rand = "0.10.1"
3838
rcgen = "0.14"
3939
ring = "0.17"
4040
rustc-hash = "2"

quinn-proto/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ web-time = { workspace = true }
6969
[dev-dependencies]
7070
assert_matches = { workspace = true }
7171
hex-literal = { workspace = true }
72-
rand_pcg = "0.9"
72+
rand_pcg = "0.10"
7373
rcgen = { workspace = true }
7474
tracing-subscriber = { workspace = true }
7575
lazy_static = "1"

quinn-proto/src/cid_generator.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use std::hash::Hasher;
22

3-
use rand::{Rng, RngCore};
3+
use rand::{Rng, RngExt};
44

55
use crate::Duration;
66
use crate::MAX_CID_SIZE;

quinn-proto/src/config/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ impl Default for EndpointConfig {
179179
fn default() -> Self {
180180
#[cfg(all(feature = "aws-lc-rs", not(feature = "ring")))]
181181
use aws_lc_rs::hmac;
182-
use rand::RngCore;
182+
use rand::Rng;
183183
#[cfg(feature = "ring")]
184184
use ring::hmac;
185185

@@ -396,7 +396,7 @@ impl ServerConfig {
396396
pub fn with_crypto(crypto: Arc<dyn crypto::ServerConfig>) -> Self {
397397
#[cfg(all(feature = "aws-lc-rs", not(feature = "ring")))]
398398
use aws_lc_rs::hkdf;
399-
use rand::RngCore;
399+
use rand::Rng;
400400
#[cfg(feature = "ring")]
401401
use ring::hkdf;
402402

quinn-proto/src/congestion/bbr/mod.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@ use std::any::Any;
22
use std::fmt::Debug;
33
use std::sync::Arc;
44

5-
use rand::{Rng, SeedableRng};
5+
use rand::rngs::{StdRng, SysRng};
6+
use rand::{Rng, RngExt, SeedableRng};
67

78
use crate::congestion::ControllerMetrics;
89
use crate::congestion::bbr::bw_estimation::BandwidthEstimation;
@@ -56,7 +57,7 @@ pub struct Bbr {
5657
bw_at_last_round: u64,
5758
round_wo_bw_gain: u64,
5859
ack_aggregation: AckAggregationState,
59-
random_number_generator: rand::rngs::StdRng,
60+
random_number_generator: StdRng,
6061
}
6162

6263
impl Bbr {
@@ -97,7 +98,7 @@ impl Bbr {
9798
bw_at_last_round: 0,
9899
round_wo_bw_gain: 0,
99100
ack_aggregation: AckAggregationState::default(),
100-
random_number_generator: rand::rngs::StdRng::from_os_rng(),
101+
random_number_generator: StdRng::try_from_rng(&mut SysRng).unwrap(),
101102
}
102103
}
103104

quinn-proto/src/connection/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ use std::{
1010
use bytes::{Bytes, BytesMut};
1111
use frame::StreamMetaVec;
1212

13-
use rand::{Rng, SeedableRng, rngs::StdRng};
13+
use rand::{RngExt, SeedableRng, rngs::StdRng};
1414
use thiserror::Error;
1515
use tracing::{debug, error, trace, trace_span, warn};
1616

quinn-proto/src/connection/packet_builder.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use bytes::Bytes;
2-
use rand::Rng;
2+
use rand::RngExt;
33
use tracing::{debug, trace, trace_span};
44

55
use super::{Connection, SentFrames, spaces::SentPacket};

0 commit comments

Comments
 (0)