Skip to content

Commit 4a4473b

Browse files
neckarosclaude
andcommitted
fix rustls 0.23 CryptoProvider panic on Windows
Rustls 0.23+ no longer auto-selects a crypto backend when both aws-lc-rs and ring are compiled in. Explicitly install ring as the default provider at startup for cross-platform compatibility. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 01deef2 commit 4a4473b

File tree

4 files changed

+9
-0
lines changed

4 files changed

+9
-0
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,4 @@ yt-dlp
2626
.redseat/**.*
2727
ffmpeg.exe
2828
ffprobe.exe
29+
.cache/

Cargo.lock

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ path = "src/main.rs"
1919
[dependencies]
2020
axum = {version = "0.7", features = ["query", "macros", "multipart"]}
2121
axum-server = { version = "0.7", features = ["tls-rustls"] }
22+
rustls = { version = "0.23", default-features = false, features = ["ring"] }
2223
tokio = { version = "1", features = ["full"] }
2324
tower-http = { version = "0.5.0", features = ["cors","trace", "normalize-path", "fs"] }
2425
serde = { version = "1", features = ["derive"] }

src/main.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,12 @@ mod tools;
6363

6464
#[tokio::main(flavor = "multi_thread")]
6565
async fn main() -> Result<()> {
66+
// Rustls 0.23+ requires an explicit crypto provider when both aws-lc-rs and ring are available.
67+
// Ring is used here for cross-platform compatibility (aws-lc-rs has build issues on Windows).
68+
rustls::crypto::ring::default_provider()
69+
.install_default()
70+
.expect("Failed to install rustls crypto provider");
71+
6672
let os = std::env::consts::OS;
6773
let arch = std::env::consts::ARCH;
6874
log_info(

0 commit comments

Comments
 (0)