Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use CryptoRngCore trait #469

Merged
merged 1 commit into from
Dec 11, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ required-features = ["rand_core"]

[dependencies]
cfg-if = "1"
rand_core = { version = "0.6", default-features = false, optional = true }
rand_core = { version = "0.6.4", default-features = false, optional = true }
digest = { version = "0.10", default-features = false, optional = true }
subtle = { version = "^2.2.1", default-features = false }
serde = { version = "1.0", default-features = false, optional = true, features = ["derive"] }
Expand Down
7 changes: 4 additions & 3 deletions src/ristretto.rs
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ use core::ops::{AddAssign, SubAssign};
use core::ops::{Mul, MulAssign};

#[cfg(any(test, feature = "rand_core"))]
use rand_core::{CryptoRng, RngCore};
use rand_core::CryptoRngCore;

#[cfg(feature = "digest")]
use digest::generic_array::typenum::U64;
Expand Down Expand Up @@ -675,7 +675,8 @@ impl RistrettoPoint {
///
/// # Inputs
///
/// * `rng`: any RNG which implements the `RngCore + CryptoRng` interface.
/// * `rng`: any RNG which implements `CryptoRngCore`
/// (i.e. `CryptoRng` + `RngCore`) interface.
///
/// # Returns
///
Expand All @@ -687,7 +688,7 @@ impl RistrettoPoint {
/// discrete log of the output point with respect to any other
/// point should be unknown. The map is applied twice and the
/// results are added, to ensure a uniform distribution.
pub fn random<R: RngCore + CryptoRng + ?Sized>(rng: &mut R) -> Self {
pub fn random<R: CryptoRngCore + ?Sized>(rng: &mut R) -> Self {
let mut uniform_bytes = [0u8; 64];
rng.fill_bytes(&mut uniform_bytes);

Expand Down
7 changes: 4 additions & 3 deletions src/scalar.rs
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ use core::ops::{Sub, SubAssign};
use cfg_if::cfg_if;

#[cfg(any(test, feature = "rand_core"))]
use rand_core::{CryptoRng, RngCore};
use rand_core::CryptoRngCore;

#[cfg(feature = "digest")]
use digest::generic_array::typenum::U64;
Expand Down Expand Up @@ -574,7 +574,8 @@ impl Scalar {
///
/// # Inputs
///
/// * `rng`: any RNG which implements the `RngCore + CryptoRng` interface.
/// * `rng`: any RNG which implements `CryptoRngCore`
/// (i.e. `CryptoRng` + `RngCore`) interface.
///
/// # Returns
///
Expand All @@ -591,7 +592,7 @@ impl Scalar {
/// let mut csprng = OsRng;
/// let a: Scalar = Scalar::random(&mut csprng);
/// # }
pub fn random<R: RngCore + CryptoRng + ?Sized>(rng: &mut R) -> Self {
pub fn random<R: CryptoRngCore + ?Sized>(rng: &mut R) -> Self {
let mut scalar_bytes = [0u8; 64];
rng.fill_bytes(&mut scalar_bytes);
Scalar::from_bytes_mod_order_wide(&scalar_bytes)
Expand Down