Skip to content

Conversation

@stevefan1999-personal
Copy link
Contributor

Seems like #87 is getting a little too big, so I think we need to break it down first.

@stevefan1999-personal
Copy link
Contributor Author

There's something wrong with the dependencies?

error[E0277]: the trait bound `Scalar<Ed448>: Retrieve` is not satisfied
   --> /home/steve/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/ed448-goldilocks-0.14.0-pre.6/src/lib.rs:116:19
    |
116 |     type Scalar = EdwardsScalar;
    |                   ^^^^^^^^^^^^^ unsatisfied trait bound
    |
help: the trait `Retrieve` is not implemented for `Scalar<Ed448>`
   --> /home/steve/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/ed448-goldilocks-0.14.0-pre.6/src/field/scalar.rs:35:1
    |
 35 | pub struct Scalar<C: CurveWithScalar> {
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    = help: the following other types implement trait `Retrieve`:
              BoxedMontyForm
              ConstMontyForm<MOD, LIMBS>
              MontyForm<LIMBS>
note: required by a bound in `elliptic_curve::CurveArithmetic::Scalar`
   --> /home/steve/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/elliptic-curve-0.14.0-rc.20/src/arithmetic.rs:93:11
    |
 74 |     type Scalar: AsRef<Self::Scalar>
    |          ------ required by a bound in this associated type
...
 93 |         + Retrieve<Output = Self::Uint>
    |           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `CurveArithmetic::Scalar`

error[E0277]: the trait bound `Scalar<Decaf448>: Retrieve` is not satisfied
   --> /home/steve/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/ed448-goldilocks-0.14.0-pre.6/src/lib.rs:168:19
    |
168 |     type Scalar = DecafScalar;
    |                   ^^^^^^^^^^^ unsatisfied trait bound
    |
help: the trait `Retrieve` is not implemented for `Scalar<Decaf448>`
   --> /home/steve/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/ed448-goldilocks-0.14.0-pre.6/src/field/scalar.rs:35:1
    |
 35 | pub struct Scalar<C: CurveWithScalar> {
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    = help: the following other types implement trait `Retrieve`:
              BoxedMontyForm
              ConstMontyForm<MOD, LIMBS>
              MontyForm<LIMBS>
note: required by a bound in `elliptic_curve::CurveArithmetic::Scalar`
   --> /home/steve/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/elliptic-curve-0.14.0-rc.20/src/arithmetic.rs:93:11
    |
 74 |     type Scalar: AsRef<Self::Scalar>
    |          ------ required by a bound in this associated type
...
 93 |         + Retrieve<Output = Self::Uint>
    |           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `CurveArithmetic::Scalar`

For more information about this error, try `rustc --explain E0277`.
error: could not compile `ed448-goldilocks` (lib) due to 2 previous errors
warning: build failed, waiting for other jobs to finish...
error[E0277]: the trait bound `Scalar: Retrieve` is not satisfied
  --> /home/steve/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/p521-0.14.0-rc.3/src/arithmetic.rs:29:19
   |
29 |     type Scalar = Scalar;
   |                   ^^^^^^ unsatisfied trait bound
   |
help: the trait `Retrieve` is not implemented for `Scalar`
  --> /home/steve/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/p521-0.14.0-rc.3/src/arithmetic/scalar.rs:93:1
   |
93 | pub struct Scalar(fiat_p521_scalar_montgomery_domain_field_element);
   | ^^^^^^^^^^^^^^^^^
   = help: the following other types implement trait `Retrieve`:
             BoxedMontyForm
             ConstMontyForm<MOD, LIMBS>
             MontyForm<LIMBS>
note: required by a bound in `elliptic_curve::CurveArithmetic::Scalar`
  --> /home/steve/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/elliptic-curve-0.14.0-rc.20/src/arithmetic.rs:93:11
   |
74 |     type Scalar: AsRef<Self::Scalar>
   |          ------ required by a bound in this associated type
...
93 |         + Retrieve<Output = Self::Uint>
   |           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `CurveArithmetic::Scalar`

error: could not compile `p521` (lib) due to 1 previous error
error[E0277]: the trait bound `Scalar: Retrieve` is not satisfied
  --> /home/steve/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/p256-0.14.0-rc.3/src/arithmetic.rs:26:19
   |
26 |     type Scalar = Scalar;
   |                   ^^^^^^ unsatisfied trait bound
   |
help: the trait `Retrieve` is not implemented for `Scalar`
  --> /home/steve/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/p256-0.14.0-rc.3/src/arithmetic/scalar.rs:47:1
   |
47 | pub struct Scalar(pub(crate) U256);
   | ^^^^^^^^^^^^^^^^^
   = help: the following other types implement trait `Retrieve`:
             BoxedMontyForm
             ConstMontyForm<MOD, LIMBS>
             MontyForm<LIMBS>
note: required by a bound in `elliptic_curve::CurveArithmetic::Scalar`
  --> /home/steve/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/elliptic-curve-0.14.0-rc.20/src/arithmetic.rs:93:11
   |
74 |     type Scalar: AsRef<Self::Scalar>
   |          ------ required by a bound in this associated type
...
93 |         + Retrieve<Output = Self::Uint>
   |           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `CurveArithmetic::Scalar`

error: could not compile `p256` (lib) due to 1 previous error
error[E0277]: the trait bound `Scalar: Retrieve` is not satisfied
  --> /home/steve/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/p384-0.14.0-rc.3/src/arithmetic.rs:26:19
   |
26 |     type Scalar = Scalar;
   |                   ^^^^^^ unsatisfied trait bound
   |
help: the trait `Retrieve` is not implemented for `Scalar`
  --> /home/steve/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/p384-0.14.0-rc.3/src/arithmetic/scalar.rs:46:1
   |
46 | / primefield::monty_field_element! {
47 | |     name: Scalar,
48 | |     params: ScalarParams,
49 | |     uint: U384,
50 | |     doc: "Element in the NIST P-384 scalar field modulo `n`."
51 | | }
   | |_^
   = help: the following other types implement trait `Retrieve`:
             BoxedMontyForm
             ConstMontyForm<MOD, LIMBS>
             MontyForm<LIMBS>
note: required by a bound in `elliptic_curve::CurveArithmetic::Scalar`
  --> /home/steve/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/elliptic-curve-0.14.0-rc.20/src/arithmetic.rs:93:11
   |
74 |     type Scalar: AsRef<Self::Scalar>
   |          ------ required by a bound in this associated type
...
93 |         + Retrieve<Output = Self::Uint>
   |           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `CurveArithmetic::Scalar`
   = note: this error originates in the macro `primefield::monty_field_element` (in Nightly builds, run with -Z macro-backtrace for more info)

error: could not compile `p384` (lib) due to 1 previous error

@nabetti1720
Copy link

nabetti1720 commented Jan 7, 2026

@stevefan1999-personal Unfortunately, even if you cargo update all the crates at this point, the dependencies are still broken and they cannot be built correctly.

As you know, RustCrypto is broken down into separate features, so you need to carefully find a cut that will allow you to update your dependencies correctly.

The reason I can continue to pull off this trick in #102 is because I periodically run the following command on my laptop and commit & push when it passes:

cargo update; make fix; make check; make test

Here's a suggestion:

First, let's accept #102 into main. Then, by rebasing this PR, you'll at least be able to focus on what you want to do without having to worry about the consistency of existing crates. If there are any crates you want to add, just run cargo update -p foo.

We will continue to work on improving Dependabot's ability to consistently update the rustcrypto crate.

@tarcieri How do you like it?

@nabetti1720
Copy link

nabetti1720 commented Jan 7, 2026

This is just my opinion, but I think this PR would be easier for everyone to understand if it were further broken down into smaller sections with different purposes. For example (I'm not sure if this is correct), I think there is a way to do it like this.

  • First, add just one curve or feature you want to support without making any major changes to your current configuration.
  • Once that's done, add another, and so on.
  • Then refactor the structure.
  • Then add feature gates.

@tarcieri
Copy link
Member

tarcieri commented Jan 9, 2026

@stevefan1999-personal perhaps we could get something like #102 merged first, and then you could merge/rebase from there? I agree with @nabetti1720's comment

Comment on lines +75 to +83
default = ["std", "tls12", "zeroize", "full", "fast", "quic", "ticketer"]
full = [
"aead-full",
"sign-full",
"verify-full",
"kx-full",
"hash-full",
"format",
]

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Users of this crate will want to use it in an appropriate scope to avoid increasing its footprint.

In that sense, we thought the cipher suite support shown in README.md was optimal for now. (The modest description states that "it should be well enough to cover 70% of the usage," but we believe it will cover most use cases.)

https://github.com/RustCrypto/rustls-rustcrypto?tab=readme-ov-file#supported-cipher-suites

If you want to use only these cipher suites, what features should you choose?

I think it would be better if the feature names that users were allowed to select were more direct, like the cipher suite names.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, what I wanted is that what you pick is what you only have, so that if I don't want AES-256GCM or if I don't want RSA, I could isolate the possible set of cipher suite for that exactly. The purpose of it is quite hard to explain, but I will try...

That means you need to disable the default features and pick enough features so that at least one cipher suite exist. For example, if you have SHA256, ChaChaPoly1305, P-521 and Ed25519 enabled, that means any features that could use those features will get implemented. I used to think about letting user specify a cipher suite directly, but I guess that would be even more convoluted.

Copy link

@nabetti1720 nabetti1720 Jan 12, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your idea is to select the components you want to use and automatically select the cipher suites that satisfy them.
While keeping that idea, having a convenient feature like this would be very helpful for users who want a simpler setup.

// Cargo.toml

# Other cipher suites can be defined in this way.
tls13_chacha20_poly1305_sha256 = ["aead-chacha20poly1305", ...] # Cherry-picked components you need

And ideally, it would be better to keep with the current thinking and enable TLS1.3 cipher suites by default, with the rest being added via tls12. If you set default-features = false, we can specify convenient feature individually, or those with a deep cryptographic understanding may be able to take advantage of more granular feature gates.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants