@@ -14,8 +14,11 @@ pub trait SieveFactory {
1414 /// Makes a sieve given an RNG and the previous exhausted sieve (if any).
1515 ///
1616 /// Returning `None` signals that the prime generation should stop.
17- fn make_sieve ( & mut self , rng : & mut impl CryptoRngCore , previous_sieve : Option < & Self :: Sieve > )
18- -> Option < Self :: Sieve > ;
17+ fn make_sieve (
18+ & mut self ,
19+ rng : & mut ( impl CryptoRngCore + ?Sized ) ,
20+ previous_sieve : Option < & Self :: Sieve > ,
21+ ) -> Option < Self :: Sieve > ;
1922}
2023
2124/// Provides a generic way to access methods for random prime number generation
@@ -26,41 +29,41 @@ pub trait RandomPrimeWithRng {
2629 /// Panics if `bit_length` is less than 2, or greater than the bit size of the target `Uint`.
2730 ///
2831 /// See [`is_prime_with_rng`] for details about the performed checks.
29- fn generate_prime_with_rng ( rng : & mut impl CryptoRngCore , bit_length : u32 ) -> Self ;
32+ fn generate_prime_with_rng ( rng : & mut ( impl CryptoRngCore + ? Sized ) , bit_length : u32 ) -> Self ;
3033
3134 /// Returns a random safe prime (that is, such that `(n - 1) / 2` is also prime)
3235 /// of size `bit_length` using the provided RNG.
3336 ///
3437 /// Panics if `bit_length` is less than 3, or greater than the bit size of the target `Uint`.
3538 ///
3639 /// See [`is_prime_with_rng`] for details about the performed checks.
37- fn generate_safe_prime_with_rng ( rng : & mut impl CryptoRngCore , bit_length : u32 ) -> Self ;
40+ fn generate_safe_prime_with_rng ( rng : & mut ( impl CryptoRngCore + ? Sized ) , bit_length : u32 ) -> Self ;
3841
3942 /// Probabilistically checks if the given number is prime using the provided RNG.
4043 ///
4144 /// See [`is_prime_with_rng`] for details about the performed checks.
42- fn is_prime_with_rng ( & self , rng : & mut impl CryptoRngCore ) -> bool ;
45+ fn is_prime_with_rng ( & self , rng : & mut ( impl CryptoRngCore + ? Sized ) ) -> bool ;
4346
4447 /// Probabilistically checks if the given number is a safe prime using the provided RNG.
4548 ///
4649 /// See [`is_prime_with_rng`] for details about the performed checks.
47- fn is_safe_prime_with_rng ( & self , rng : & mut impl CryptoRngCore ) -> bool ;
50+ fn is_safe_prime_with_rng ( & self , rng : & mut ( impl CryptoRngCore + ? Sized ) ) -> bool ;
4851}
4952
5053impl < T > RandomPrimeWithRng for T
5154where
5255 T : Integer + RandomBits + RandomMod ,
5356{
54- fn generate_prime_with_rng ( rng : & mut impl CryptoRngCore , bit_length : u32 ) -> Self {
57+ fn generate_prime_with_rng ( rng : & mut ( impl CryptoRngCore + ? Sized ) , bit_length : u32 ) -> Self {
5558 generate_prime_with_rng ( rng, bit_length)
5659 }
57- fn generate_safe_prime_with_rng ( rng : & mut impl CryptoRngCore , bit_length : u32 ) -> Self {
60+ fn generate_safe_prime_with_rng ( rng : & mut ( impl CryptoRngCore + ? Sized ) , bit_length : u32 ) -> Self {
5861 generate_safe_prime_with_rng ( rng, bit_length)
5962 }
60- fn is_prime_with_rng ( & self , rng : & mut impl CryptoRngCore ) -> bool {
63+ fn is_prime_with_rng ( & self , rng : & mut ( impl CryptoRngCore + ? Sized ) ) -> bool {
6164 is_prime_with_rng ( rng, self )
6265 }
63- fn is_safe_prime_with_rng ( & self , rng : & mut impl CryptoRngCore ) -> bool {
66+ fn is_safe_prime_with_rng ( & self , rng : & mut ( impl CryptoRngCore + ? Sized ) ) -> bool {
6467 is_safe_prime_with_rng ( rng, self )
6568 }
6669}
0 commit comments