Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DRAFT] update tokio-rustls to rustls 0.20.x #64

Merged
merged 19 commits into from
Sep 28, 2021
Merged

Conversation

hawkw
Copy link
Member

@hawkw hawkw commented Jun 29, 2021

This branch updates tokio-rustls to depend on the upcoming rustls
0.20.0 release (currently via a git dependency). Of course, since the
upstream breaking changes have yet to be released, this will remain a
draft PR until they are published.

I'm currently working on testing out Linkerd with the new API changes in
rustls 0.20.x (linkerd/linkerd2#6379). As we depend on both rustls
and tokio-rustls, this testing requires a version of tokio-rustls
using the upcoming rustls. I thought I'd go ahead and open a draft PR
for this change, since it may be useful for others who wish to test out
the upcoming rustls as well. When rustls v0.20.0 is published, we
can mark this PR as "ready for review" and move forwards with it, but
it'll remain a draft until then.

hawkw added a commit that referenced this pull request Jun 29, 2021
* native-tls: fix use of non-fmt panic in tests
* fix some misc. clippy lints

This branch fixes a number of lints. The most important one was the use
of a non-`format_args!` expression in a `panic!` macro, which generates
a compiler warning in recent Rust toolchains, which is breaking the CI
`cargo check` run on PR #64.

While I was here, I also fixed some miscellaneous Clippy lints, mostly
in tests. These include:

* Use of `clone()` on `SocketAddr`s (which implement `Copy`)
* Unnecessary single-path-segment imports (which probably used to be
  `extern crate`s in earlier Rust?)
* `'static` lifetimes in `const` type annotations (`const`s always have
  the `'static` lifetime)

None of these were breaking the build on CI, but I figured I'd address
them while I was fixing other lints.

Signed-off-by: Eliza Weisman <eliza@buoyant.io>
hawkw added 11 commits June 29, 2021 15:46
Signed-off-by: Eliza Weisman <eliza@buoyant.io>
Signed-off-by: Eliza Weisman <eliza@buoyant.io>
Signed-off-by: Eliza Weisman <eliza@buoyant.io>
Signed-off-by: Eliza Weisman <eliza@buoyant.io>
Signed-off-by: Eliza Weisman <eliza@buoyant.io>
Signed-off-by: Eliza Weisman <eliza@buoyant.io>
Signed-off-by: Eliza Weisman <eliza@buoyant.io>
Signed-off-by: Eliza Weisman <eliza@buoyant.io>
Signed-off-by: Eliza Weisman <eliza@buoyant.io>
Signed-off-by: Eliza Weisman <eliza@buoyant.io>
Signed-off-by: Eliza Weisman <eliza@buoyant.io>
@hawkw
Copy link
Member Author

hawkw commented Jun 29, 2021

Trying to figure out what's up with the test failure we're seeing here --- it's possible some behavior changed in rustls, because this is actually quite surprising.

@quininer
Copy link
Member

Good job! I have a branch that does the same thing, but it's a bit behind.

I am not surprised that some tests failed, because I noticed some behavioral changes in rustls 0.20, but it should be easy to fix.

@djc
Copy link
Contributor

djc commented Jun 30, 2021

There were some changes to the reader behavior and how it signals EOF and errors. I think this upstream commit contains the meat of the relevant changes:

rustls/rustls@c94c223

@djc
Copy link
Contributor

djc commented Jun 30, 2021

(I have a PR against rustls-native-certs that removes the dependency on rustls, might also be useful when testing.)

@hawkw
Copy link
Member Author

hawkw commented Jun 30, 2021

Good job! I have a branch that does the same thing, but it's a bit behind.

Oh, whoops --- I looked at the open PRs, but not at all open branches. Hope I didn't step on your toes here, I just wanted to get a version compiling with 0.20 so we can test our code downstream.

There were some changes to the reader behavior and how it signals EOF and errors. I think this upstream commit contains the meat of the relevant changes:

ctz/rustls@c94c223

Great, thanks for the commit, that's very helpful :)

hawkw added 4 commits July 1, 2021 09:09
Signed-off-by: Eliza Weisman <eliza@buoyant.io>
Signed-off-by: Eliza Weisman <eliza@buoyant.io>
Signed-off-by: Eliza Weisman <eliza@buoyant.io>
Signed-off-by: Eliza Weisman <eliza@buoyant.io>
hawkw added 3 commits July 7, 2021 13:44
Signed-off-by: Eliza Weisman <eliza@buoyant.io>
Signed-off-by: Eliza Weisman <eliza@buoyant.io>
Signed-off-by: Eliza Weisman <eliza@buoyant.io>
* Adapt to RootCertStore API changes

* Handle UnexpectedEof errors

* Rename would_block to io_pending

* Try to make badssl test failures more verbose

* Rebuild AsyncRead impl

* Upgrade to current rustls

* Revert to using assert!()

* Update to rustls 0.20

* Forward rustls features
@quininer quininer marked this pull request as ready for review September 28, 2021 16:59
Copy link
Member

@quininer quininer left a comment

Choose a reason for hiding this comment

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

This has been reviewed in #68, so I will merge it now.

@quininer quininer merged commit 8501aaf into master Sep 28, 2021
@Stargateur
Copy link

Stargateur commented Oct 6, 2021

Since this get merge, readme link are broken https://github.com/tokio-rs/tls/blob/HEAD/examples/server/src/main.rs; and so I go to the repo directly and end up with:

error[E0277]: the trait bound `tokio_rustls::TlsAcceptor: From<Arc<rustls::ServerConfig>>` is not satisfied
   --> src\main.rs:184:24
    |
184 |         let acceptor = TlsAcceptor::from(Arc::new(config));
    |                        ^^^^^^^^^^^^^^^^^ the trait `From<Arc<rustls::ServerConfig>>` is not implemented for `tokio_rustls::TlsAcceptor`
    |
    = help: the following implementations were found:
              <tokio_rustls::TlsAcceptor as From<Arc<tokio_rustls::rustls::ServerConfig>>>
note: required by `std::convert::From::from`
   --> C:\Users\Star\.rustup\toolchains\stable-x86_64-pc-windows-msvc\lib/rustlib/src/rust\library\core\src\convert\mod.rs:371:5
    |
371 |     fn from(_: T) -> Self;
    |     ^^^^^^^^^^^^^^^^^^^^^^

would be nice to make a release soon and use permalink in the readme.

@taiki-e taiki-e deleted the eliza/rustls-0.20 branch July 9, 2022 09:04
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.

4 participants