Skip to content

Conversation

ctz
Copy link
Member

@ctz ctz commented Nov 30, 2023

Release notes

New features

  • Configurable cryptography providers. The cryptography used by rustls is represented by the CryptoProvider trait. ring is now optional, but remains the default provider.
  • Optional support for cryptography from aws-lc-rs. Once the certification process completes , we will support FIPS mode using aws-lc-rs.
  • Certificate revocation list (CRL) support. The default certificate verifier used in rustls can now be configured with CRLs to control revocation of client and server certificates.
  • Separate configuration of root hints in client certificate verifier. To deal with cross-signed client certificate topologies, the list of hints sent to a client can now be configured. The default behaviour remains to send the names of the configured root certificates.

Breaking changes

  • RootCertStore::add_parsable_certificates now takes a impl IntoIterator<Item = impl AsRef<[u8]>>.
  • Breaking change: remove support for SCT stapling. Ecosystem support for this is rare compared to
    inclusion of SCTs in certificates.
  • Breaking change: rename WebPkiVerifier to WebPkiServerVerifier
  • Breaking change: remove default trait implementations in ServerCertVerifier/ClientCertVerifier so the trait doesn't depend on webpki. Instead the previous implementations are exposed as rustls::crypto::verify_tls12_signature, rustls::crypto::verify_tls13_signature and $PROVIDER.signature_verification_algorithms.supported_schemes(), using the crypto provider of your choice.
  • Breaking change: rework certificate auth verifiers construction into a builder. This covers both server and client certificate verifiers: call WebPkiServerVerifier::builder() and WebPkiClientVerifier::builder().
  • Breaking change: we have removed the dangerous_configuration, secret_extraction and quic crate features. The API features those previously gated are now available without a crate feature. Types previously gated on the dangerous_configuration feature now appear in danger modules in the same place.
  • Breaking change: new types for keys and certificates. rustls::Certificate has been replaced with rustls_pki_types::CertificateDer from the new rustls-pki-types crate. Likewise, rustls::PrivateKey has been replaced with rustls_pki_types::PrivateKeyDer and rustls::OwnedTrustAnchor has been replaced with rustls_pki_types::TrustAnchor.
  • Breaking change: RootCertStore is now passed around wrapped in an Arc, to improve efficiency when creating a different verifier for different servers/clients but with the same roots.
  • Breaking change: traits exposed by rustls now come with a Debug bound. Please exercise caution in using #[derive(Debug)] on types that contain secret data.
  • Breaking change: RootCertStore::add_server_trust_anchors became RootCertStore::add_trust_anchors (6978464)
  • Breaking change: The deprecated ConfigBuilder<ClientConfig, WantsClientCert>::with_single_cert fn was removed in favour of with_client_auth_cert (42cda46)
  • Breaking change: some types and values have moved to accommodate cryptography provider work:
Old New
rustls::CipherSuiteCommon rustls::crypto::CipherSuiteCommon
rustls::SupportedKxGroup rustls::crypto::SupportedKxGroup
rustls::cipher_suite::* rustls::crypto::ring::cipher_suite::*
rustls::Ticketer rustls::crypto::ring::Ticketer
rustls::ALL_KX_GROUPS rustls::crypto::ring::ALL_KX_GROUPS
rustls::ALL_CIPHER_SUITES rustls::crypto::ring::ALL_CIPHER_SUITES
rustls::DEFAULT_CIPHER_SUITES rustls::crypto::ring::DEFAULT_CIPHER_SUITES
rustls::kx_group::* rustls::crypto::ring::kx_group::*
rustls::sign::any_ecdsa_type rustls::crypto::ring::sign::any_ecdsa_type
rustls::sign::any_eddsa_type rustls::crypto::ring::sign::any_eddsa_type
rustls::sign::any_supported_type rustls::crypto::ring::sign::any_supported_type

Moved/renamed/new items

Moved

  • ALL_CIPHER_SUITES (crypto providers)
  • ALL_KX_GROUPS (crypto providers)
  • DEFAULT_CIPHER_SUITES (crypto providers)
  • SECP256R1 (crypto providers)
  • SECP384R1 (crypto providers)
  • any_ecdsa_type (crypto providers)
  • any_eddsa_type (crypto providers)
  • any_supported_type (crypto providers)
  • CipherSuiteCommon (crypto)
  • ClientCertVerified (server::danger)
  • ClientCertVerifier (server::danger)
  • DangerousClientConfig (client::danger)
  • HandshakeSignatureValid (client::danger)
  • ServerCertVerified (client::danger)
  • ServerCertVerifier (client::danger)
  • SupportedKxGroup (crypto)
  • Ticketer (crypto providers)
  • TLS13_AES_128_GCM_SHA256 (crypto providers)
  • TLS13_AES_256_GCM_SHA384 (crypto providers)
  • TLS13_CHACHA20_POLY1305_SHA256 (crypto providers)
  • TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256 (crypto providers)
  • TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384 (crypto providers)
  • TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256 (crypto providers)
  • TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (crypto providers)
  • TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (crypto providers)
  • TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256 (crypto providers)
  • X25519 (crypto providers)

Renamed

  • WebPkiVerifier (client::WebPkiServerVerifier)
  • Certificate (rustls_pki_types::CertificateDer)
  • OwnedTrustAnchor (rustls_pki_types::TrustAnchor)
  • PrivateKey (rustls_pki_types::PrivateKeyDer)
  • ServerName (rustls_pki_types::ServerName)
  • SignError (crypto::ring::sign::InvalidKeyError)

Added/newly public

  • ActiveKeyExchange (crypto)
  • AeadKey (crypto::cipher)
  • Algorithm (quic)
  • ClientCertVerifierBuilder (server)
  • DangerousClientConfigBuilder (client::danger)
  • expand (crypto::tls13)
  • OkmBlock (crypto::tls13)
  • OutputLengthError (crypto::tls13)
  • ServerCertVerifierBuilder (client)
  • TicketSwitcher (ticketer)
  • WebPkiClientVerifier (server)

Added/newly public (crypto provider extensibility)

  • default_provider() (crypto::ring)
  • default_provider() (crypto::aws_lc_rs)
  • HashAlgorithm (crypto::hash)
  • Hash (crypto::hash)
  • Hkdf (crypto::tls13)
  • HkdfExpander (crypto::tls13)
  • HkdfExpanderUsingHmac (crypto::tls13)
  • HkdfUsingHmac (crypto::tls13)
  • Hmac (crypto::hmac)
  • Iv (crypto::cipher)
  • KeyBlockShape (crypto::cipher)
  • Key (crypto::hmac)
  • KeyExchangeAlgorithm (crypto)
  • make_tls12_aad (crypto::cipher)
  • make_tls13_aad (crypto::cipher)
  • MessageDecrypter (crypto::cipher)
  • MessageEncrypter (crypto::cipher)
  • Nonce (crypto::cipher)
  • Nonce (crypto::cipher)
  • OpaqueMessage (crypto::cipher)
  • Output (crypto::hash)
  • PlainMessage (crypto::cipher)
  • Prf (crypto::tls12)
  • PrfUsingHmac (crypto::tls12)
  • SharedSecret (crypto)
  • Tag (crypto::hmac)
  • Tls12AeadAlgorithm (crypto::cipher)
  • UnsupportedOperationError (crypto::cipher)
  • WebPkiSupportedAlgorithms (crypto)

Added/newly public (error types)

  • GetRandomFailed (crypto)
  • OtherError (top level)
  • UnsupportedOperationError (crypto::cipher)
  • VerifierBuilderError (client)
  • VerifierBuilderError (server)

Removed

  • AllowAnyAnonymousOrAuthenticatedClient
  • AllowAnyAuthenticatedClient
  • BulkAlgorithm
  • CertificateTransparencyPolicy
  • supported_sign_tls13
  • WantsTransparencyPolicyOrClientCert

closes #1435

Copy link

codecov bot commented Nov 30, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (553f400) 95.90% compared to head (e5a2a2a) 95.90%.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1651   +/-   ##
=======================================
  Coverage   95.90%   95.90%           
=======================================
  Files          78       78           
  Lines       16083    16083           
=======================================
  Hits        15424    15424           
  Misses        659      659           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@cpu
Copy link
Member

cpu commented Nov 30, 2023

Looks great! I've done a pass through the commits and spotted a couple tweaks:

These defaults are exposed as (eg) WebPkiServerVerifier::default_verify_tls13_signature which you can call to restore the old behaviour.

This bit fell out of date as of d963be3 - the default_xxx fns are removed, instead callers should use rustls::crypto::verify_tls12_signature, rustls::crypto::verify_tls13_signature and $PROVIDER.signature_verification_algorithms.supported_schemes() with the crypto provider of their choice.

Some other breaking changes to mention:

  • RootCertStore::add_server_trust_anchors became RootCertStore::add_trust_anchors (6978464)
  • The deprecated ConfigBuilder<ClientConfig, WantsClientCert>::with_single_cert fn was removed in favour of with_client_auth_cert (42cda46)

@jsha
Copy link
Contributor

jsha commented Nov 30, 2023

What do you think of adding the full list of items that have been moved / renamed / added / removed, like I summarized at #1435 (comment) ? I suspect most people will upgrade by building with the new version, seeing what breaks, then checking the changelog for the affected symbols. That will be be made easier if they are all named. Note my list only contains structs/enums/traits/functions. If it's useful I can add methods to the mix as well.

Also: can we add a stub CHANGELOG.md that points people to the GitHub Releases list? And/or link to the GitHub Releases list from lib.rs / README.md?

@ctz
Copy link
Member Author

ctz commented Nov 30, 2023

spotted a couple tweaks:

Edited these into the above.

What do you think of adding the full list of items that have been moved / renamed / added / removed

Have expanded/added more of the moved items, but ran out of steam for today. Feels like this is something that is best automated from the cargo doc json / cargo-public-api.

And/or link to the GitHub Releases list from lib.rs / README.md?

We actually have that -- https://github.com/rustls/rustls#release-history

@jsha
Copy link
Contributor

jsha commented Nov 30, 2023

Have expanded/added more of the moved items, but ran out of steam for today. Feels like this is something that is best automated from the cargo doc json / cargo-public-api.

I provided a list in the linked comment that I think is more comprehensive and easier to read than the old/new table: #1435 (comment). I think it should be possible to just copy-paste that in place of the old/new table.

Agreed that this is best automated (with some human editing on top to help it all make sense). I did try using cargo-public-api to generate the list, but it produced excessive diffs; I think it may be having trouble with rustdoc JSON generated by different versions of rustdoc.

And/or link to the GitHub Releases list from lib.rs / README.md?

We actually have that -- https://github.com/rustls/rustls#release-history

Huh, I went looking several times and didn't notice that link. I think that's because "release history can be found on GitHub" sounds like a tautology to me, since all releases are published on GitHub. I was searching for "changes" or "changelog" to find the human-curated description of the changes in each release. I'll submit a separate PR for this.

@djc
Copy link
Member

djc commented Dec 1, 2023

I feel like crypto providers should be at top of the list, before CRL support, since I suspect it will have impact for more of our audience. Otherwise, this looks good!

@ctz
Copy link
Member Author

ctz commented Dec 1, 2023

I provided a list in the linked comment that I think is more comprehensive and easier to read than the old/new table: #1435 (comment). I think it should be possible to just copy-paste that in place of the old/new table.

I see what you're saying now. The release note item with the table was really intended to record types that moved specifically for the crypto provider work. Not a list of absolutely everything moved/removed/added (some of which are better covered in other release note items, eg Certificate and PrivateKey). I have added the full list at the end, and updated to cover changes made since.

@ctz ctz force-pushed the jbp-prepare-0.22 branch from 258c79e to ca38fb3 Compare December 1, 2023 11:47
@djc
Copy link
Member

djc commented Dec 1, 2023

I feel like we should consider addressing #1628 (review) before we release.

@djc djc mentioned this pull request Dec 1, 2023
15 tasks
@ctz
Copy link
Member Author

ctz commented Dec 1, 2023

I feel like we should consider addressing #1628 (review) before we release.

I think this is much too fundamental to be changing at this point.

@cpu
Copy link
Member

cpu commented Dec 1, 2023

I feel like crypto providers should be at top of the list, before CRL support,

Agreed, maybe for similar reasons we should put the aws-lc-rs support after the crypto provider and before the CRL bits?

@jsha
Copy link
Contributor

jsha commented Dec 1, 2023

I feel like we should consider addressing #1628 (review) [specifying TLS 1.2 and 1.3 ciphersuites separately] before we release.

I think this is much too fundamental to be changing at this point.

This is mainly a user interface change. Under the hood nothing would change.

The reason I think it's useful to squeeze in is that #1628 wound up introducing {Server,Client}Config::builder_with_protocols, which, while it's nice for reducing errors, is confusing to compare with ConfigBuilder::with_protocol_versions.

By making that proposed change we can (a) get rid of an unwrap during config building and (b) have exactly one place to specify the protocol versions (by specifying a CryptoProvider with an empty list of TLS 1.2 ciphersuites).

@cpu
Copy link
Member

cpu commented Dec 1, 2023

{Server,Client}Config::builder_with_protocols, which, while it's nice for reducing errors, is confusing to compare with ConfigBuilder::with_protocol_versions.

I'm not sure I understand what's confusing about it. Can you expand on your thought process?

@jsha
Copy link
Contributor

jsha commented Dec 1, 2023

Sure! If I'm a user looking at the docs and I know I want to turn off TLS 1.2, I might find ConfigBuilder::with_protocol_versions. So I write:

    let config = rustls::ClientConfig::builder()
    .with_protocol_versions(&[&rustls::version::TLS13])
    .unwrap()
    .with_root_certificates(root_store)
    .with_no_client_auth();

And I get the error:

error[E0599]: no method named `with_protocol_versions` found for struct `ConfigBuilder<ClientConfig, WantsVerifier>` in the current scope
  --> examples/src/bin/limitedclient.rs:19:6
   |
18 |       let config = rustls::ClientConfig::builder()
   |  __________________-
19 | |     .with_protocol_versions(&[&rustls::version::TLS13])
   | |     -^^^^^^^^^^^^^^^^^^^^^^ method not found in `ConfigBuilder<ClientConfig, WantsVerifier>`
   | |_____|
   | 
   |
   = note: the method was found for
           - `ConfigBuilder<S, WantsVersions>`

That error is a bit confusing if you haven't internalized the state machine of ConfigBuilder- that is, if you aren't paying close attention to the type parameters.

If I look in the docs for ConfigBuilder I would see that the way to get ConfigBuilder<S, WantsVersions> is to call ClientConfig::builder_with_provider. So I might go down the (wrong) avenue of trying to specify a provider.

Or I might notice at the same time that there is also ClientConfig::builder_with_protocols. In that case I would wonder "Why can protocols be set either before getting a builder, or while mutating a builder? Does it do different things if I choose different methods?"

@cpu
Copy link
Member

cpu commented Dec 1, 2023

@jsha Ahh! yes ok, I understand now. Thank you, that's helpful.

@ctz
Copy link
Member Author

ctz commented Dec 1, 2023

Agreed, maybe for similar reasons we should put the aws-lc-rs support after the crypto provider and before the CRL bits?

Have done that reordering.

This is mainly a user interface change. Under the hood nothing would change.

Not disagreeing, but the constraint we have here is to release 0.22 really very soon (today), to clear to board for 0.23 PRs to start being landed. Those need to be landed by EOY for rather dry contractual reasons.

@jsha
Copy link
Contributor

jsha commented Dec 1, 2023

Fair point. And with the additional discussion on #1628 (comment) I'm convinced it's not practical to land the change to configuring protocol versions in time for 0.22. Thanks for considering. 👍🏻

@ctz ctz force-pushed the jbp-prepare-0.22 branch from ca38fb3 to e5a2a2a Compare December 1, 2023 18:52
Copy link
Member

@cpu cpu left a comment

Choose a reason for hiding this comment

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

🥳

@ctz ctz added this pull request to the merge queue Dec 1, 2023
Merged via the queue into main with commit 4d1b762 Dec 1, 2023
@ctz ctz deleted the jbp-prepare-0.22 branch December 1, 2023 19:18
@jsha
Copy link
Contributor

jsha commented Dec 1, 2023

FYI made some edits to the top post to mention that OwnedTrustAnchor and ServerName were moved to rustls_pki_types.

If I find more things that should be in the changelog after the release is published, do you mind if I go ahead and edit them into the release notes, or would you like a code review process for changelog updates?

Also I think the changelog could use a section on related crates, saying for instance:

You will probably need to add a dependency on rustls-pki-types:

rustls-pki-types = { version = "1" }

Also, if you have dependencies on these related crates you will need to upgrade to these versions:

webpki-roots = { version = "0.26" }
rustls-webpki = { version = "0.102" }
rustls-pemfile = { version = "2" }
rustls-native-certs = ??

@djc
Copy link
Member

djc commented Dec 1, 2023

One question I've had is if we should be re-exporting the pki-types, maybe as rustls::types? I think that would make life a bit easier? We could do the same across some of the other crates, I suppose.

@jsha
Copy link
Contributor

jsha commented Dec 2, 2023

Bump on this:

do you mind if I go ahead and edit them into the release notes, or would you like a code review process for changelog updates?

There are some items I've noticed as I upgrade ureq that people are very likely to run into (like removing with_safe_defaults from ConfigBuilder). I'm going to go ahead and edit these into the release notes, but let me know if you'd like me to stop.

@ctz
Copy link
Member Author

ctz commented Dec 2, 2023

Yes, please do improve the release notes as you see fit.

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.

0.22 release planning
4 participants