Skip to content

Commit 9706652

Browse files
committed
chore(deps): bump rand_core to 0.10.0-rc-4
1 parent 2b52044 commit 9706652

File tree

3 files changed

+18
-15
lines changed

3 files changed

+18
-15
lines changed

Cargo.lock

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

chacha20/Cargo.toml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,7 @@ rand_core-compatible RNGs based on those ciphers.
2121
[dependencies]
2222
cfg-if = "1"
2323
cipher = { version = "0.5.0-rc.3", optional = true, features = ["stream-wrapper"] }
24-
# rand_core = { version = "0.10.0-rc-3", optional = true, default-features = false }
25-
rand_core = { git = "https://github.com/rust-random/rand_core", branch = "push-xzmlvzwurnrl", optional = true, default-features = false}
24+
rand_core = { version = "0.10.0-rc-4", optional = true, default-features = false }
2625

2726
# `zeroize` is an explicit dependency because this crate may be used without the `cipher` crate
2827
zeroize = { version = "1.8.1", optional = true, default-features = false }

chacha20/src/rng.rs

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@
66
// option. This file may not be copied, modified, or distributed
77
// except according to those terms.
88

9-
use core::fmt::Debug;
9+
use core::{convert::Infallible, fmt::Debug};
1010

1111
use rand_core::{
12-
CryptoRng, RngCore, SeedableRng,
12+
SeedableRng, TryCryptoRng, TryRngCore,
1313
block::{BlockRng, CryptoGenerator, Generator},
1414
};
1515

@@ -291,22 +291,25 @@ macro_rules! impl_chacha_rng {
291291
}
292292
}
293293
}
294-
impl RngCore for $ChaChaXRng {
294+
impl TryRngCore for $ChaChaXRng {
295+
type Error = Infallible;
296+
295297
#[inline]
296-
fn next_u32(&mut self) -> u32 {
297-
self.core.next_word()
298+
fn try_next_u32(&mut self) -> Result<u32, Self::Error> {
299+
Ok(self.core.next_word())
298300
}
299301
#[inline]
300-
fn next_u64(&mut self) -> u64 {
301-
self.core.next_u64_from_u32()
302+
fn try_next_u64(&mut self) -> Result<u64, Self::Error> {
303+
Ok(self.core.next_u64_from_u32())
302304
}
303305
#[inline]
304-
fn fill_bytes(&mut self, dest: &mut [u8]) {
305-
self.core.fill_bytes(dest)
306+
fn try_fill_bytes(&mut self, dest: &mut [u8]) -> Result<(), Self::Error> {
307+
self.core.fill_bytes(dest);
308+
Ok(())
306309
}
307310
}
308311
impl CryptoGenerator for $ChaChaXCore {}
309-
impl CryptoRng for $ChaChaXRng {}
312+
impl TryCryptoRng for $ChaChaXRng {}
310313

311314
#[cfg(feature = "zeroize")]
312315
impl ZeroizeOnDrop for $ChaChaXCore {}

0 commit comments

Comments
 (0)