@@ -15,7 +15,7 @@ use super::{
1515 reduction:: montgomery_reduction,
1616 safegcd:: invert_mod_u64,
1717} ;
18- use crate :: { Concat , ConstChoice , Limb , Monty , NonZero , Odd , Split , U64 , Uint , Word } ;
18+ use crate :: { ConstChoice , Limb , Monty , Odd , U64 , Uint , Word } ;
1919use mul:: DynMontyMultiplier ;
2020use subtle:: { Choice , ConditionallySelectable , ConstantTimeEq } ;
2121
@@ -35,11 +35,7 @@ pub struct MontyParams<const LIMBS: usize> {
3535 pub ( super ) mod_leading_zeros : u32 ,
3636}
3737
38- impl < const LIMBS : usize , const WIDE_LIMBS : usize > MontyParams < LIMBS >
39- where
40- Uint < LIMBS > : Concat < Output = Uint < WIDE_LIMBS > > ,
41- Uint < WIDE_LIMBS > : Split < Output = Uint < LIMBS > > ,
42- {
38+ impl < const LIMBS : usize > MontyParams < LIMBS > {
4339 /// Instantiates a new set of `MontyParams` representing the given odd `modulus`.
4440 pub const fn new ( modulus : Odd < Uint < LIMBS > > ) -> Self {
4541 // `R mod modulus` where `R = 2^BITS`.
4945 . wrapping_add ( & Uint :: ONE ) ;
5046
5147 // `R^2 mod modulus`, used to convert integers to Montgomery form.
52- let r2 = one
53- . square ( )
54- . rem ( & NonZero ( modulus. 0 . concat ( & Uint :: ZERO ) ) )
55- . split ( )
56- . 0 ;
48+ let r2 = Uint :: rem_wide ( one. square_wide ( ) , modulus. as_nz_ref ( ) ) ;
5749
5850 // The inverse of the modulus modulo 2**64
5951 let mod_inv = U64 :: from_u64 ( invert_mod_u64 ( modulus. as_ref ( ) . as_words ( ) ) ) ;
0 commit comments