Skip to content

Commit

Permalink
build(deps): bump rand_core from 0.9.0-alpha.1 to 0.9.0-alpha.2
Browse files Browse the repository at this point in the history
`rand_core` reworked its error management and now return Infallible error.
  • Loading branch information
baloo committed Sep 27, 2024
1 parent 15c3c21 commit 613129c
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 14 deletions.
14 changes: 7 additions & 7 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion chacha20/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ categories = ["cryptography", "no-std"]
[dependencies]
cfg-if = "1"
cipher = { version = "=0.5.0-pre.7", optional = true }
rand_core = { version = "0.9.0-alpha.1", optional = true, default-features = false }
rand_core = { version = "0.9.0-alpha.2", optional = true, default-features = false }
serde = { version = "1.0", features = ["derive"], optional = true }
zeroize = { version = "1.8.1", optional = true }

Expand Down
10 changes: 4 additions & 6 deletions chacha20/src/rng.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use core::fmt::Debug;

use rand_core::{
block::{BlockRng, BlockRngCore, CryptoBlockRng},
CryptoRng, Error, RngCore, SeedableRng,
impl_try_rng_from_rng_core, CryptoRng, RngCore, SeedableRng,
};

#[cfg(feature = "serde1")]
Expand Down Expand Up @@ -382,12 +382,10 @@ macro_rules! impl_chacha_rng {
fn fill_bytes(&mut self, dest: &mut [u8]) {
self.core.fill_bytes(dest)
}
#[inline]
fn try_fill_bytes(&mut self, dest: &mut [u8]) -> Result<(), Error> {
Ok(self.fill_bytes(dest))
}
}

impl_try_rng_from_rng_core!($ChaChaXRng);

impl $ChaChaXRng {
// The buffer is a 4-block window, i.e. it is always at a block-aligned position in the
// stream but if the stream has been sought it may not be self-aligned.
Expand Down Expand Up @@ -733,7 +731,7 @@ pub(crate) mod tests {
let mut rng1 = ChaChaRng::from_seed(seed);
assert_eq!(rng1.next_u32(), 137206642);

let mut rng2 = ChaChaRng::from_rng(rng1).unwrap();
let mut rng2 = ChaChaRng::from_rng(rng1);
assert_eq!(rng2.next_u32(), 1325750369);
}

Expand Down

0 comments on commit 613129c

Please sign in to comment.