diff --git a/Cargo.lock b/Cargo.lock index 367dd339c..985046895 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -383,7 +383,7 @@ checksum = "48c757948c5ede0e46177b7add2e67155f70e33c07fea8284df6576da70b3719" [[package]] name = "elliptic-curve" version = "0.14.0-rc.1" -source = "git+https://github.com/RustCrypto/traits.git#204a4e030fa98863429ccd3797e12f9e7c45dc33" +source = "git+https://github.com/RustCrypto/traits.git#3620aba4f1e81e506b46a5f88c47f7ee3a7b87e0" dependencies = [ "base16ct", "base64ct", @@ -484,7 +484,7 @@ dependencies = [ [[package]] name = "group" version = "0.13.0" -source = "git+https://github.com/pinkforest/group.git?branch=bump-rand-0.9#06ac6fb11ced26fbf980ee65e74fced4da66ec3e" +source = "git+https://github.com/baloo/group.git?branch=baloo%2Ftry_from_rng#b0d6ea48fe55327b11ea03f9a965d9e16bb83adc" dependencies = [ "ff", "rand_core 0.9.3", @@ -1132,7 +1132,7 @@ dependencies = [ [[package]] name = "signature" version = "2.3.0-pre.6" -source = "git+https://github.com/RustCrypto/traits.git#204a4e030fa98863429ccd3797e12f9e7c45dc33" +source = "git+https://github.com/RustCrypto/traits.git#3620aba4f1e81e506b46a5f88c47f7ee3a7b87e0" dependencies = [ "digest", "rand_core 0.9.3", diff --git a/Cargo.toml b/Cargo.toml index 19f942acc..11941b786 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -23,12 +23,16 @@ opt-level = 2 ff = { git = "https://github.com/zkcrypto/ff.git", branch = "release-0.14.0" } # https://github.com/zkcrypto/group/pull/56 -group = { git = "https://github.com/pinkforest/group.git", branch = "bump-rand-0.9" } +# https://github.com/zkcrypto/group/pull/57 +# https://github.com/zkcrypto/group/pull/58 +# https://github.com/zkcrypto/group/pull/59 +group = { git = "https://github.com/baloo/group.git", branch = "baloo/try_from_rng" } # https://github.com/RustCrypto/signatures/pull/913 ecdsa = { git = "https://github.com/RustCrypto/signatures.git" } rfc6979 = { git = "https://github.com/RustCrypto/signatures.git" } +# https://github.com/RustCrypto/traits/pull/1777 elliptic-curve = { git = "https://github.com/RustCrypto/traits.git" } signature = { git = "https://github.com/RustCrypto/traits.git" } diff --git a/k256/src/arithmetic/projective.rs b/k256/src/arithmetic/projective.rs index 84eae3626..1a2b0a981 100644 --- a/k256/src/arithmetic/projective.rs +++ b/k256/src/arithmetic/projective.rs @@ -16,7 +16,7 @@ use elliptic_curve::{ ff::Field, prime::{PrimeCurve, PrimeCurveAffine, PrimeGroup}, }, - rand_core::RngCore, + rand_core::TryRngCore, sec1::{FromEncodedPoint, ToEncodedPoint}, subtle::{Choice, ConditionallySelectable, ConstantTimeEq, CtOption}, zeroize::DefaultIsZeroes, @@ -402,8 +402,8 @@ impl Eq for ProjectivePoint {} impl Group for ProjectivePoint { type Scalar = Scalar; - fn random(mut rng: impl RngCore) -> Self { - Self::GENERATOR * Scalar::random(&mut rng) + fn try_from_rng(rng: &mut R) -> core::result::Result { + Ok(Self::GENERATOR * Scalar::try_from_rng(rng)?) } fn identity() -> Self { diff --git a/primeorder/src/projective.rs b/primeorder/src/projective.rs index 8699ffa62..174d9dc2d 100644 --- a/primeorder/src/projective.rs +++ b/primeorder/src/projective.rs @@ -19,7 +19,7 @@ use elliptic_curve::{ }, ops::{BatchInvert, LinearCombination, MulByGenerator}, point::Double, - rand_core::RngCore, + rand_core::TryRngCore, sec1::{ CompressedPoint, EncodedPoint, FromEncodedPoint, ModulusSize, ToEncodedPoint, UncompressedPointSize, @@ -275,8 +275,8 @@ where { type Scalar = Scalar; - fn random(mut rng: impl RngCore) -> Self { - Self::GENERATOR * as Field>::random(&mut rng) + fn try_from_rng(rng: &mut R) -> core::result::Result { + Ok(Self::GENERATOR * as Field>::try_from_rng(rng)?) } fn identity() -> Self {