From 2536c5a3c46c257848a5298dc38e25197c4aafdb Mon Sep 17 00:00:00 2001 From: Aleksei Sidorov Date: Tue, 16 Apr 2019 16:35:33 +0300 Subject: [PATCH] Fix rand trait bounds. --- Cargo.toml | 2 +- src/key.rs | 4 ++-- src/lib.rs | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index f114fef..20bf1b4 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -32,7 +32,7 @@ fuzztarget = [] [dev-dependencies] rand = "0.6" -rand_core = "0.3" +rand_core = "0.4" serde_test = "1.0" [dependencies.rand] diff --git a/src/key.rs b/src/key.rs index 2d90c2e..4a99118 100644 --- a/src/key.rs +++ b/src/key.rs @@ -90,7 +90,7 @@ impl str::FromStr for PublicKey { } #[cfg(any(test, feature = "rand"))] -fn random_32_bytes(rng: &mut R) -> [u8; 32] { +fn random_32_bytes(rng: &mut R) -> [u8; 32] { let mut ret = [0u8; 32]; rng.fill_bytes(&mut ret); ret @@ -100,7 +100,7 @@ impl SecretKey { /// Creates a new random secret key. Requires compilation with the "rand" feature. #[inline] #[cfg(any(test, feature = "rand"))] - pub fn new(rng: &mut R) -> SecretKey { + pub fn new(rng: &mut R) -> SecretKey { let mut data = random_32_bytes(rng); unsafe { while ffi::secp256k1_ec_seckey_verify( diff --git a/src/lib.rs b/src/lib.rs index 5cb3d9b..8ec5e58 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -651,7 +651,7 @@ impl Secp256k1 { /// see comment in libsecp256k1 commit d2275795f by Gregory Maxwell. Requires /// compilation with "rand" feature. #[cfg(any(test, feature = "rand"))] - pub fn randomize(&mut self, rng: &mut R) { + pub fn randomize(&mut self, rng: &mut R) { let mut seed = [0; 32]; rng.fill_bytes(&mut seed); unsafe { @@ -720,7 +720,7 @@ impl Secp256k1 { /// with the "rand" feature. #[inline] #[cfg(any(test, feature = "rand"))] - pub fn generate_keypair(&self, rng: &mut R) + pub fn generate_keypair(&self, rng: &mut R) -> (key::SecretKey, key::PublicKey) { let sk = key::SecretKey::new(rng); let pk = key::PublicKey::from_secret_key(self, &sk);