Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ jobs:

- uses: dtolnay/rust-toolchain@master
with:
toolchain: "1.71"
toolchain: "1.85"

- run: cargo check --locked --lib --features "aws_lc_rs, aws-lc-rs, early-data, fips, logging, ring, tls12"

Expand All @@ -148,7 +148,7 @@ jobs:

- uses: dtolnay/rust-toolchain@master
with:
toolchain: "1.75"
toolchain: "1.85"

- run: cargo check --locked --lib --all-features

Expand Down
127 changes: 85 additions & 42 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 11 additions & 8 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "tokio-rustls"
version = "0.26.4"
version = "0.27.0"
license = "MIT OR Apache-2.0"
repository = "https://github.com/rustls/tokio-rustls"
homepage = "https://github.com/rustls/tokio-rustls"
Expand All @@ -9,30 +9,33 @@ readme = "README.md"
description = "Asynchronous TLS/SSL streams for Tokio using Rustls."
categories = ["asynchronous", "cryptography", "network-programming"]
edition = "2021"
rust-version = "1.71"
rust-version = "1.85"
exclude = ["/.github", "/examples", "/scripts", "/tests/"]

[dependencies]
rustls = { version = "0.23.27", default-features = false, features = ["std"] }
rustls = { git = "https://github.com/rustls/rustls.git", branch = "main", package = "rustls", version = "0.24.0-dev.1", default-features = false, features = ["webpki"] }
rustls-aws-lc-rs = { git = "https://github.com/rustls/rustls.git", branch = "main", package = "rustls-aws-lc-rs", version = "0.1.0-dev.1", default-features = false, features = ["aws-lc-sys", "std"], optional = true }
rustls-ring = { git = "https://github.com/rustls/rustls.git", branch = "main", package = "rustls-ring", version = "0.1.0-dev.1", default-features = false, features = ["std"], optional = true }
tokio = "1.0"

[features]
default = ["logging", "tls12", "aws_lc_rs"]
aws_lc_rs = ["rustls/aws_lc_rs"]
aws_lc_rs = ["dep:rustls-aws-lc-rs"]
aws-lc-rs = ["aws_lc_rs"] # Alias because Cargo features commonly use `-`
brotli = ["rustls/brotli"]
early-data = []
fips = ["rustls/fips"]
logging = ["rustls/logging"]
ring = ["rustls/ring"]
tls12 = ["rustls/tls12"]
fips = ["aws_lc_rs", "rustls-aws-lc-rs/fips"]
logging = ["rustls/tracing"]
ring = ["dep:rustls-ring"]
tls12 = []
zlib = ["rustls/zlib"]

[dev-dependencies]
argh = "0.1.1"
futures-util = "0.3.1"
lazy_static = "1.1"
rcgen = { version = "0.14", features = ["pem"] }
rustls-util = { git = "https://github.com/rustls/rustls.git", branch = "main", package = "rustls-util", version = "0.1.0-dev.1", default-features = false }
tokio = { version = "1.0", features = ["full"] }
webpki-roots = "1"

Expand Down
23 changes: 20 additions & 3 deletions examples/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ use tokio::time::timeout;
use tokio_rustls::TlsConnector;
use tokio_rustls::rustls::pki_types::pem::PemObject;
use tokio_rustls::rustls::pki_types::{CertificateDer, ServerName};
use tokio_rustls::rustls::{ClientConfig, RootCertStore};
use tokio_rustls::rustls::{self, ClientConfig, RootCertStore};

#[tokio::main]
async fn main() -> Result<(), Box<dyn StdError + Send + Sync + 'static>> {
Expand All @@ -49,9 +49,9 @@ async fn main() -> Result<(), Box<dyn StdError + Send + Sync + 'static>> {
}

let connector = TlsConnector::from(Arc::new(
ClientConfig::builder()
ClientConfig::builder(provider())
.with_root_certificates(root_cert_store)
.with_no_client_auth(),
.with_no_client_auth()?,
));

// TCP connect, bounded by the connect timeout.
Expand Down Expand Up @@ -163,3 +163,20 @@ async fn with_timeout<T>(
)),
}
}

fn provider() -> Arc<rustls::crypto::CryptoProvider> {
#[cfg(feature = "aws_lc_rs")]
{
Arc::new(rustls_aws_lc_rs::DEFAULT_PROVIDER.clone())
}

#[cfg(all(not(feature = "aws_lc_rs"), feature = "ring"))]
{
Arc::new(rustls_ring::DEFAULT_PROVIDER.clone())
}

#[cfg(not(any(feature = "aws_lc_rs", feature = "ring")))]
{
panic!("enable either the `aws_lc_rs` or `ring` feature")
}
}
Loading
Loading