@@ -46,7 +46,7 @@ const GCD_BATCH_SIZE: u32 = 62;
4646/// - P. Wuille, "The safegcd implementation in libsecp256k1 explained",
4747/// <https://github.com/bitcoin-core/secp256k1/blob/master/doc/safegcd_implementation.md>
4848#[ derive( Clone , Debug ) ]
49- pub struct SafeGcdInverter < const LIMBS : usize > {
49+ pub ( crate ) struct SafeGcdInverter < const LIMBS : usize > {
5050 /// Modulus
5151 pub ( super ) modulus : Odd < Uint < LIMBS > > ,
5252
@@ -62,9 +62,8 @@ type Matrix = [[i64; 2]; 2];
6262
6363impl < const LIMBS : usize > SafeGcdInverter < LIMBS > {
6464 /// Creates the inverter for specified modulus and adjusting parameter.
65- ///
66- /// Modulus must be odd. Returns `None` if it is not.
67- pub const fn new ( modulus : & Odd < Uint < LIMBS > > , adjuster : & Uint < LIMBS > ) -> Self {
65+ #[ cfg( test) ]
66+ pub ( crate ) const fn new ( modulus : & Odd < Uint < LIMBS > > , adjuster : & Uint < LIMBS > ) -> Self {
6867 Self :: new_with_inverse (
6968 modulus,
7069 U64 :: from_u64 ( invert_mod_u64 ( modulus. as_ref ( ) . as_words ( ) ) ) ,
@@ -85,28 +84,12 @@ impl<const LIMBS: usize> SafeGcdInverter<LIMBS> {
8584 }
8685 }
8786
88- /// Returns either the adjusted modular multiplicative inverse for the argument or `None`
89- /// depending on invertibility of the argument, i.e. its coprimality with the modulus.
90- #[ deprecated( since = "0.7.0" , note = "please use `invert` instead" ) ]
91- pub const fn inv ( & self , value : & Uint < LIMBS > ) -> ConstCtOption < Uint < LIMBS > > {
92- self . invert ( value)
93- }
94-
9587 /// Returns either the adjusted modular multiplicative inverse for the argument or `None`
9688 /// depending on invertibility of the argument, i.e. its coprimality with the modulus.
9789 pub const fn invert ( & self , value : & Uint < LIMBS > ) -> ConstCtOption < Uint < LIMBS > > {
9890 invert_odd_mod_precomp :: < LIMBS , false > ( value, & self . modulus , self . inverse , & self . adjuster )
9991 }
10092
101- /// Returns either the adjusted modular multiplicative inverse for the argument or `None`
102- /// depending on invertibility of the argument, i.e. its coprimality with the modulus.
103- ///
104- /// This version is variable-time with respect to `value`.
105- #[ deprecated( since = "0.7.0" , note = "please use `invert_vartime` instead" ) ]
106- pub const fn inv_vartime ( & self , value : & Uint < LIMBS > ) -> ConstCtOption < Uint < LIMBS > > {
107- self . invert_vartime ( value)
108- }
109-
11093 /// Returns either the adjusted modular multiplicative inverse for the argument or `None`
11194 /// depending on invertibility of the argument, i.e. its coprimality with the modulus.
11295 ///
0 commit comments