Skip to content

RC-9 Broke with newer version of crypto-primes #602

@ospfranco

Description

@ospfranco

Hi! Thanks for the crate. Today I ran cargo update to update the dependencies of a project of my and now rsa 0.10.0-rc.9 no longer compiles. I get the following error:

error[E0277]: the trait bound `R: crypto_bigint::rand_core::RngCore` is not satisfied
   --> /Users/osp/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/crypto-primes-0.7.0-pre.3/src/hazmat/miller_rabin.rs:132:36
    |
132 |         let random = T::random_mod(rng, &range_nonzero)
    |                      ------------- ^^^ the trait `DerefMut` is not implemented for `R`
    |                      |
    |                      required by a bound introduced by this call
    |
    = note: required for `R` to implement `crypto_bigint::rand_core::RngCore`
note: required by a bound in `random_mod`
   --> /Users/osp/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/crypto-bigint-0.7.0-rc.10/src/traits.rs:469:22
    |
469 |     fn random_mod<R: RngCore + ?Sized>(rng: &mut R, modulus: &NonZero<Self>) -> Self {
    |                      ^^^^^^^ required by this bound in `RandomMod::random_mod`
help: consider further restricting type parameter `R` with trait `DerefMut`
    |
116 |     pub fn test_random_base<R: CryptoRng + ?Sized + core::ops::DerefMut>(&self, rng: &mut R) -> Primality {
    |                                                   +++++++++++++++++++++

error[E0277]: the trait bound `R: crypto_bigint::rand_core::RngCore` is not satisfied
   --> /Users/osp/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/crypto-primes-0.7.0-pre.3/src/hazmat/miller_rabin.rs:132:36
    |
116 |     pub fn test_random_base<R: CryptoRng + ?Sized>(&self, rng: &mut R) -> Primality {
    |                             - this type parameter needs to be `Sized`
...
132 |         let random = T::random_mod(rng, &range_nonzero)
    |                      ------------- ^^^ the trait `Sized` is not implemented for `R`
    |                      |
    |                      required by a bound introduced by this call
    |
    = note: required for `R` to implement `crypto_bigint::rand_core::RngCore`
note: required by a bound in `random_mod`
   --> /Users/osp/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/crypto-bigint-0.7.0-rc.10/src/traits.rs:469:22
    |
469 |     fn random_mod<R: RngCore + ?Sized>(rng: &mut R, modulus: &NonZero<Self>) -> Self {
    |                      ^^^^^^^ required by this bound in `RandomMod::random_mod`
help: consider removing the `?Sized` bound to make the type parameter `Sized`
    |
116 -     pub fn test_random_base<R: CryptoRng + ?Sized>(&self, rng: &mut R) -> Primality {
116 +     pub fn test_random_base<R: CryptoRng>(&self, rng: &mut R) -> Primality {
    |

   Compiling p256 v0.13.2
   Compiling oid-registry v0.8.1
   Compiling sha1 v0.10.6
   Compiling x509-verify v0.4.8
   Compiling tink-hybrid v0.3.0
   Compiling x509-parser v0.18.0
   Compiling byte-unit v5.1.6
   Compiling ra-verify v0.1.0 (/Users/osp/Developer/sdk/ra-verify)
error[E0277]: the trait bound `R: crypto_bigint::rand_core::TryRngCore` is not satisfied
   --> /Users/osp/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/crypto-primes-0.7.0-pre.3/src/hazmat/sieve.rs:43:41
    |
 43 |     let mut random = T::try_random_bits(rng, bit_length).map_err(|err| match err {
    |                      ------------------ ^^^ the trait `DerefMut` is not implemented for `R`
    |                      |
    |                      required by a bound introduced by this call
    |
    = note: required for `R` to implement `crypto_bigint::rand_core::RngCore`
    = note: required for `R` to implement `crypto_bigint::rand_core::TryRngCore`
note: required by a bound in `try_random_bits`
   --> /Users/osp/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/crypto-bigint-0.7.0-rc.10/src/traits.rs:424:27
    |
424 |     fn try_random_bits<R: TryRngCore + ?Sized>(
    |                           ^^^^^^^^^^ required by this bound in `RandomBits::try_random_bits`
help: consider further restricting type parameter `R` with trait `DerefMut`
    |
 39 |     R: CryptoRng + ?Sized + core::ops::DerefMut,
    |                           +++++++++++++++++++++

error[E0277]: the trait bound `R: crypto_bigint::rand_core::TryRngCore` is not satisfied
   --> /Users/osp/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/crypto-primes-0.7.0-pre.3/src/hazmat/sieve.rs:43:41
    |
 36 | pub fn random_odd_integer<T, R>(rng: &mut R, bit_length: NonZeroU32, set_bits: SetBits) -> Result<Odd<T>, Error>
    |                              - this type parameter needs to be `Sized`
...
 43 |     let mut random = T::try_random_bits(rng, bit_length).map_err(|err| match err {
    |                      ------------------ ^^^ the trait `Sized` is not implemented for `R`
    |                      |
    |                      required by a bound introduced by this call
    |
    = note: required for `R` to implement `crypto_bigint::rand_core::RngCore`
    = note: required for `R` to implement `crypto_bigint::rand_core::TryRngCore`
note: required by a bound in `try_random_bits`
   --> /Users/osp/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/crypto-bigint-0.7.0-rc.10/src/traits.rs:424:27
    |
424 |     fn try_random_bits<R: TryRngCore + ?Sized>(
    |                           ^^^^^^^^^^ required by this bound in `RandomBits::try_random_bits`
help: consider removing the `?Sized` bound to make the type parameter `Sized`
    |
 39 -     R: CryptoRng + ?Sized,
 39 +     R: CryptoRng,
    |

error[E0277]: the trait bound `R: crypto_bigint::rand_core::RngCore` is not satisfied
  --> /Users/osp/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/crypto-primes-0.7.0-pre.3/src/hazmat/sieve.rs:43:22
   |
43 |     let mut random = T::try_random_bits(rng, bit_length).map_err(|err| match err {
   |                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `DerefMut` is not implemented for `R`
   |
   = note: required for `R` to implement `crypto_bigint::rand_core::RngCore`
   = note: required for `R` to implement `crypto_bigint::rand_core::TryRngCore`
help: consider further restricting type parameter `R` with trait `DerefMut`
   |
39 |     R: CryptoRng + ?Sized + core::ops::DerefMut,
   |                           +++++++++++++++++++++

error[E0277]: the trait bound `R: crypto_bigint::rand_core::RngCore` is not satisfied
  --> /Users/osp/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/crypto-primes-0.7.0-pre.3/src/hazmat/sieve.rs:43:22
   |
36 | pub fn random_odd_integer<T, R>(rng: &mut R, bit_length: NonZeroU32, set_bits: SetBits) -> Result<Odd<T>, Error>
   |                              - this type parameter needs to be `Sized`
...
43 |     let mut random = T::try_random_bits(rng, bit_length).map_err(|err| match err {
   |                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Sized` is not implemented for `R`
   |
   = note: required for `R` to implement `crypto_bigint::rand_core::RngCore`
   = note: required for `R` to implement `crypto_bigint::rand_core::TryRngCore`
help: consider removing the `?Sized` bound to make the type parameter `Sized`
   |
39 -     R: CryptoRng + ?Sized,
39 +     R: CryptoRng,
   |

Seems a sub dependency has changed the signature of one of the functions which makes it incompatible. Locking or updating the signatures to match should work.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions