Skip to content

Commit

Permalink
Updating rand_core to 0.6 (without curve25519-dalek library change) (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinlewi committed Feb 5, 2021
1 parent e35410a commit 6307ea9
Show file tree
Hide file tree
Showing 3 changed files with 82 additions and 21 deletions.
93 changes: 75 additions & 18 deletions Cargo.lock

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

4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ generic-bytes = { version = "0.1.0" }
generic-bytes-derive = { version = "0.1.0" }
hkdf = "0.10.0"
hmac = "0.10.1"
rand_core = "0.5.1"
rand_core = { version = "0.6.0", features = ["getrandom"] }
scrypt = { version = "0.5.0", optional = true }
subtle = { version = "2.3.0", default-features = false }
thiserror = "1.0.22"
Expand All @@ -41,7 +41,7 @@ lazy_static = "1.4.0"
serde_json = "1.0.60"
sha2 = "0.9.2"
proptest = "0.10.1"
rand = "0.7"
rand = "0.8"
rustyline = "7.0.0"

[[bench]]
Expand Down
6 changes: 5 additions & 1 deletion src/group.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,11 @@ impl Group for RistrettoPoint {
}
fn random_scalar<R: RngCore + CryptoRng>(rng: &mut R) -> Self::Scalar {
#[cfg(not(test))]
return Scalar::random(rng);
{
let mut scalar_bytes = [0u8; 64];
rng.fill_bytes(&mut scalar_bytes);
Scalar::from_bytes_mod_order_wide(&scalar_bytes)
}

// Tests need an exact conversion from bytes to scalar, sampling only 32 bytes from rng
#[cfg(test)]
Expand Down

0 comments on commit 6307ea9

Please sign in to comment.