File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 55use core:: ops:: { Deref , Mul } ;
66
77use group:: { Group , GroupEncoding , prime:: PrimeCurveAffine } ;
8- use rand_core:: { CryptoRng , TryCryptoRng } ;
8+ use rand_core:: { CryptoRng , RngCore , TryCryptoRng , TryRngCore } ;
99use subtle:: { Choice , ConditionallySelectable , ConstantTimeEq , CtOption } ;
1010
1111#[ cfg( feature = "alloc" ) ]
@@ -88,16 +88,18 @@ where
8888 P : ConditionallySelectable + ConstantTimeEq + CurveGroup + Default ,
8989{
9090 /// Generate a random `NonIdentity<ProjectivePoint>`.
91- pub fn random < R : CryptoRng + ?Sized > ( mut rng : & mut R ) -> Self {
91+ pub fn random < R : CryptoRng + RngCore + ?Sized > ( rng : & mut R ) -> Self {
9292 loop {
93- if let Some ( point) = Self :: new ( P :: random ( & mut rng) ) . into ( ) {
93+ if let Some ( point) = Self :: new ( P :: random ( rng) ) . into ( ) {
9494 break point;
9595 }
9696 }
9797 }
9898
9999 /// Generate a random `NonIdentity<ProjectivePoint>`.
100- pub fn try_from_rng < R : TryCryptoRng + ?Sized > ( rng : & mut R ) -> Result < Self , R :: Error > {
100+ pub fn try_from_rng < R : TryCryptoRng + TryRngCore + ?Sized > (
101+ rng : & mut R ,
102+ ) -> Result < Self , R :: Error > {
101103 loop {
102104 if let Some ( point) = Self :: new ( P :: try_from_rng ( rng) ?) . into ( ) {
103105 break Ok ( point) ;
Original file line number Diff line number Diff line change @@ -4,7 +4,7 @@ use super::Scalar;
44use crate :: { CurveArithmetic , ops:: Invert } ;
55use core:: fmt;
66use group:: ff:: Field ;
7- use rand_core:: CryptoRng ;
7+ use rand_core:: { CryptoRng , RngCore } ;
88use subtle:: CtOption ;
99use zeroize:: Zeroize ;
1010
@@ -38,10 +38,10 @@ where
3838 C : CurveArithmetic ,
3939{
4040 /// Create a new [`BlindedScalar`] from a scalar and a [`CryptoRng`].
41- pub fn new < R : CryptoRng + ?Sized > ( scalar : Scalar < C > , mut rng : & mut R ) -> Self {
41+ pub fn new < R : CryptoRng + RngCore + ?Sized > ( scalar : Scalar < C > , rng : & mut R ) -> Self {
4242 Self {
4343 scalar,
44- mask : Scalar :: < C > :: random ( & mut rng) ,
44+ mask : Scalar :: < C > :: random ( rng) ,
4545 }
4646 }
4747}
You can’t perform that action at this time.
0 commit comments