Skip to content
Closed
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
6 changes: 3 additions & 3 deletions Cargo.lock

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

6 changes: 5 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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" }

Expand Down
6 changes: 3 additions & 3 deletions k256/src/arithmetic/projective.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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<R: TryRngCore + ?Sized>(rng: &mut R) -> core::result::Result<Self, R::Error> {
Ok(Self::GENERATOR * Scalar::try_from_rng(rng)?)
}

fn identity() -> Self {
Expand Down
6 changes: 3 additions & 3 deletions primeorder/src/projective.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -275,8 +275,8 @@ where
{
type Scalar = Scalar<C>;

fn random(mut rng: impl RngCore) -> Self {
Self::GENERATOR * <Scalar<C> as Field>::random(&mut rng)
fn try_from_rng<R: TryRngCore + ?Sized>(rng: &mut R) -> core::result::Result<Self, R::Error> {
Ok(Self::GENERATOR * <Scalar<C> as Field>::try_from_rng(rng)?)
}

fn identity() -> Self {
Expand Down