Skip to content
Open
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
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ tls-rustls-ring = ["tls-rustls-ring-webpki"] # For backwards compatibility
tls-rustls-ring-webpki = ["sqlx-core/_tls-rustls-ring-webpki", "sqlx-macros?/_tls-rustls-ring-webpki"]
tls-rustls-ring-native-roots = ["tls-rustls-ring-platform-verifier"] # For backwards compatibility
tls-rustls-ring-platform-verifier = ["sqlx-core/_tls-rustls-aws-lc-rs-platform-verifier", "sqlx-macros?/_tls-rustls-aws-lc-rs-platform-verifier"]
tls-rustls-no-provider-platform-verifier = ["sqlx-core/_tls-rustls-no-provider-platform-verifier", "sqlx-macros?/_tls-rustls-no-provider-platform-verifier"]

# No-op feature used by the workflows to compile without TLS enabled. Not meant for general use.
tls-none = []
Expand Down
1 change: 1 addition & 0 deletions sqlx-core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ _tls-rustls-aws-lc-rs = ["_tls-rustls", "rustls/aws-lc-rs", "webpki-roots"]
_tls-rustls-aws-lc-rs-platform-verifier = ["_tls-rustls", "rustls/aws-lc-rs", "rustls-platform-verifier"]
_tls-rustls-ring-webpki = ["_tls-rustls", "rustls/ring", "webpki-roots"]
_tls-rustls-ring-platform-verifier = ["_tls-rustls", "rustls/ring", "rustls-platform-verifier"]
_tls-rustls-no-provider-platform-verifier = ["_tls-rustls", "rustls-platform-verifier"]
_tls-rustls = ["rustls"]
_tls-none = []

Expand Down
13 changes: 13 additions & 0 deletions sqlx-core/src/net/tls/tls_rustls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ where
),
not(feature = "_tls-rustls-ring-webpki"),
not(feature = "_tls-rustls-ring-platform-verifier"),
not(feature = "_tls-rustls-no-provider-platform-verifier"),
))]
let provider = Arc::new(rustls::crypto::aws_lc_rs::default_provider());
#[cfg(any(
Expand All @@ -103,6 +104,18 @@ where
))]
let provider = Arc::new(rustls::crypto::ring::default_provider());

#[cfg(all(
feature = "_tls-rustls-no-provider-platform-verifier",
not(feature = "_tls-rustls-aws-lc-rs"),
not(feature = "_tls-rustls-aws-lc-rs-platform-verifier"),
not(feature = "_tls-rustls-ring-webpki"),
not(feature = "_tls-rustls-ring-platform-verifier"),
))]
let provider = CryptoProvider::get_default()
.ok_or_else(|| Error::Configuration(
"no process-level CryptoProvider available -- call CryptoProvider::install_default() before this point".into()
))?.clone();

// Unwrapping is safe here because we use a default provider.
let config = ClientConfig::builder_with_provider(provider.clone())
.with_safe_default_protocol_versions()
Expand Down
1 change: 1 addition & 0 deletions sqlx-macros-core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ _tls-rustls-aws-lc-rs = ["sqlx-core/_tls-rustls-aws-lc-rs"]
_tls-rustls-aws-lc-rs-platform-verifier = ["sqlx-core/_tls-rustls-aws-lc-rs-platform-verifier"]
_tls-rustls-ring-webpki = ["sqlx-core/_tls-rustls-ring-webpki"]
_tls-rustls-ring-platform-verifier = ["sqlx-core/_tls-rustls-aws-lc-rs-platform-verifier"]
_tls-rustls-no-provider-platform-verifier = ["sqlx-core/_tls-rustls-no-provider-platform-verifier"]

_sqlite = []

Expand Down
1 change: 1 addition & 0 deletions sqlx-macros/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ _tls-rustls-aws-lc-rs = ["sqlx-macros-core/_tls-rustls-aws-lc-rs"]
_tls-rustls-aws-lc-rs-platform-verifier = ["sqlx-macros-core/_tls-rustls-aws-lc-rs-platform-verifier"]
_tls-rustls-ring-webpki = ["sqlx-macros-core/_tls-rustls-ring-webpki"]
_tls-rustls-ring-platform-verifier = ["sqlx-macros-core/_tls-rustls-aws-lc-rs-platform-verifier"]
_tls-rustls-no-provider-platform-verifier = ["sqlx-macros-core/_tls-rustls-no-provider-platform-verifier"]

# SQLx features
derive = ["sqlx-macros-core/derive"]
Expand Down