From 56a6bc07b8b23ff2d209ab43e6ccbb100debf62d Mon Sep 17 00:00:00 2001 From: Arthur Gautier Date: Wed, 21 Jan 2026 11:52:56 -0800 Subject: [PATCH] chore(deps): bump `rand_core` to `0.10.0-rc-5` (#870) --- Cargo.toml | 2 -- curve25519-dalek/Cargo.toml | 4 ++-- ed25519-dalek/Cargo.toml | 4 ++-- ed25519-dalek/src/batch.rs | 15 ++++++++++----- ed25519-dalek/src/batch/transcript.rs | 15 ++++++++++----- x25519-dalek/Cargo.toml | 4 ++-- 6 files changed, 26 insertions(+), 18 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index eeb5901..ee6dd9d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -14,5 +14,3 @@ opt-level = 2 curve25519-dalek-derive = { path = "./curve25519-dalek-derive" } curve25519-dalek = { path = "./curve25519-dalek" } x25519-dalek = { path = "./x25519-dalek" } - -rand = { git = "https://github.com/rust-random/rand", rev = "ff07ec205347dd749a586aaee7218cb21590ea4c" } diff --git a/curve25519-dalek/Cargo.toml b/curve25519-dalek/Cargo.toml index 9b95c42..63ba4ff 100644 --- a/curve25519-dalek/Cargo.toml +++ b/curve25519-dalek/Cargo.toml @@ -35,7 +35,7 @@ bincode = "1" criterion = { version = "0.5", features = ["html_reports"] } hex = "0.4.2" proptest = "1" -rand = "0.10.0-rc.5" +rand = "0.10.0-rc.7" [build-dependencies] rustc_version = "0.4.0" @@ -49,7 +49,7 @@ required-features = ["alloc", "rand_core"] cfg-if = "1" ff = { version = "=0.14.0-pre.0", package = "rustcrypto-ff", default-features = false, optional = true } group = { version = "=0.14.0-pre.0", package = "rustcrypto-group", default-features = false, optional = true } -rand_core = { version = "0.10.0-rc-3", default-features = false, optional = true } +rand_core = { version = "0.10.0-rc-5", default-features = false, optional = true } digest = { version = "0.11.0-rc.4", default-features = false, optional = true, features = [ "block-api", ] } diff --git a/ed25519-dalek/Cargo.toml b/ed25519-dalek/Cargo.toml index 612435c..9703475 100644 --- a/ed25519-dalek/Cargo.toml +++ b/ed25519-dalek/Cargo.toml @@ -38,7 +38,7 @@ subtle = { version = "2.3.0", default-features = false } # optional features keccak = { version = "0.2.0-rc.0", default-features = false, optional = true } -rand_core = { version = "0.10.0-rc-3", default-features = false, optional = true } +rand_core = { version = "0.10.0-rc-5", default-features = false, optional = true } serde = { version = "1.0", default-features = false, optional = true } zeroize = { version = "1.5", default-features = false, optional = true } @@ -57,7 +57,7 @@ bincode = "1.0" serde_json = "1.0" criterion = { version = "0.5", features = ["html_reports"] } hex-literal = "1" -rand = { version = "0.10.0-rc.5", features = ["chacha"] } +rand = { version = "0.10.0-rc.7", features = ["chacha"] } serde = { version = "1.0", features = ["derive"] } strobe-rs = "0.5" toml = { version = "0.9" } diff --git a/ed25519-dalek/src/batch.rs b/ed25519-dalek/src/batch.rs index 3b852de..0fe027c 100644 --- a/ed25519-dalek/src/batch.rs +++ b/ed25519-dalek/src/batch.rs @@ -14,6 +14,7 @@ mod transcript; use alloc::vec::Vec; +use core::convert::Infallible; use core::iter::once; use curve25519_dalek::constants; @@ -48,12 +49,14 @@ const MERLIN_PROTOCOL_LABEL: &[u8] = b"Merlin v1.0"; /// yields a PRG whose input is the hashed transcript. struct ZeroRng; -impl rand_core::RngCore for ZeroRng { - fn next_u32(&mut self) -> u32 { +impl rand_core::TryRngCore for ZeroRng { + type Error = Infallible; + + fn try_next_u32(&mut self) -> Result { rand_core::utils::next_word_via_fill(self) } - fn next_u64(&mut self) -> u64 { + fn try_next_u64(&mut self) -> Result { rand_core::utils::next_word_via_fill(self) } @@ -65,11 +68,13 @@ impl rand_core::RngCore for ZeroRng { /// STROBE state based on external randomness, we're doing an /// `ENC_{state}(00000000000000000000000000000000)` operation, which is /// identical to the STROBE `MAC` operation. - fn fill_bytes(&mut self, _dest: &mut [u8]) {} + fn try_fill_bytes(&mut self, _dest: &mut [u8]) -> Result<(), Self::Error> { + Ok(()) + } } // `TranscriptRngBuilder::finalize()` requires a `CryptoRng` -impl rand_core::CryptoRng for ZeroRng {} +impl rand_core::TryCryptoRng for ZeroRng {} // We write our own gen() function so we don't need to pull in the rand crate fn gen_u128(rng: &mut R) -> u128 { diff --git a/ed25519-dalek/src/batch/transcript.rs b/ed25519-dalek/src/batch/transcript.rs index 958de8a..a814626 100644 --- a/ed25519-dalek/src/batch/transcript.rs +++ b/ed25519-dalek/src/batch/transcript.rs @@ -1,5 +1,6 @@ use super::MERLIN_PROTOCOL_LABEL; use super::strobe::Strobe128; +use core::convert::Infallible; fn encode_usize_as_u32(x: usize) -> [u8; 4] { u32::try_from(x).expect("usize too large").to_le_bytes() @@ -185,23 +186,27 @@ pub struct TranscriptRng { strobe: Strobe128, } -impl rand_core::RngCore for TranscriptRng { - fn next_u32(&mut self) -> u32 { +impl rand_core::TryRngCore for TranscriptRng { + type Error = Infallible; + + fn try_next_u32(&mut self) -> Result { rand_core::utils::next_word_via_fill(self) } - fn next_u64(&mut self) -> u64 { + fn try_next_u64(&mut self) -> Result { rand_core::utils::next_word_via_fill(self) } - fn fill_bytes(&mut self, dest: &mut [u8]) { + fn try_fill_bytes(&mut self, dest: &mut [u8]) -> Result<(), Self::Error> { let dest_len = encode_usize_as_u32(dest.len()); self.strobe.meta_ad(&dest_len, false); self.strobe.prf(dest, false); + + Ok(()) } } -impl rand_core::CryptoRng for TranscriptRng {} +impl rand_core::TryCryptoRng for TranscriptRng {} #[cfg(test)] mod tests { diff --git a/x25519-dalek/Cargo.toml b/x25519-dalek/Cargo.toml index 13e0ba4..ec93442 100644 --- a/x25519-dalek/Cargo.toml +++ b/x25519-dalek/Cargo.toml @@ -43,7 +43,7 @@ all-features = true [dependencies] curve25519-dalek = { version = "=5.0.0-pre.4", default-features = false } -rand_core = { version = "0.10.0-rc-3", default-features = false } +rand_core = { version = "0.10.0-rc-5", default-features = false } # optional dependencies getrandom = { version = "0.4.0-rc.0", optional = true } @@ -53,7 +53,7 @@ zeroize = { version = "1", default-features = false, optional = true } [dev-dependencies] bincode = "1" criterion = "0.5" -rand = "0.10.0-rc.5" +rand = "0.10.0-rc.7" [[bench]] name = "x25519"