Skip to content

Commit 8a98872

Browse files
committed
tls: Update dependencies and fixes for removed types
This unbreaks building spin on RiscV, and is otherwise good dependency hygiene. Signed-off-by: Danielle Lancashire <[email protected]>
1 parent fc0baf4 commit 8a98872

File tree

3 files changed

+25
-99
lines changed

3 files changed

+25
-99
lines changed

Cargo.lock

+16-86
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/trigger-http/Cargo.toml

+3-5
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ http-body-util = { workspace = true }
2020
indexmap = "1"
2121
outbound-http = { path = "../outbound-http" }
2222
percent-encoding = "2"
23-
rustls-pemfile = "0.3.0"
23+
rustls-pemfile = "2.1.1"
2424
serde = { version = "1.0", features = ["derive"] }
2525
serde_json = "1"
2626
spin-app = { path = "../app" }
@@ -31,13 +31,11 @@ spin-telemetry = { path = "../telemetry" }
3131
spin-trigger = { path = "../trigger" }
3232
spin-world = { path = "../world" }
3333
terminal = { path = "../terminal" }
34-
tls-listener = { version = "0.4.0", features = [
34+
tls-listener = { version = "0.10.0", features = [
3535
"rustls",
36-
"hyper-h1",
37-
"hyper-h2",
3836
] }
3937
tokio = { version = "1.23", features = ["full"] }
40-
tokio-rustls = { version = "0.23.2" }
38+
tokio-rustls = { version = "0.25.0" }
4139
url = "2.4.1"
4240
tracing = { workspace = true }
4341
wasmtime = { workspace = true }

crates/trigger-http/src/tls.rs

+6-8
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ use std::{
55
sync::Arc,
66
};
77
use tokio_rustls::{rustls, TlsAcceptor};
8+
use crate::tls::rustls::pki_types::{CertificateDer, PrivatePkcs8KeyDer};
89

910
/// TLS configuration for the server.
1011
#[derive(Clone)]
@@ -22,25 +23,22 @@ impl TlsConfig {
2223
let mut keys = load_keys(&self.key_path)?;
2324

2425
let cfg = rustls::ServerConfig::builder()
25-
.with_safe_defaults()
2626
.with_no_client_auth()
27-
.with_single_cert(certs, keys.remove(0))
27+
.with_single_cert(certs, tokio_rustls::rustls::pki_types::PrivateKeyDer::Pkcs8(keys.remove(0)))
2828
.map_err(|e| anyhow::anyhow!("{}", e))?;
2929

3030
Ok(Arc::new(cfg).into())
3131
}
3232
}
3333

3434
// Loads public certificate from file.
35-
fn load_certs(path: impl AsRef<Path>) -> io::Result<Vec<rustls::Certificate>> {
35+
fn load_certs(path: impl AsRef<Path>) -> io::Result<Vec<CertificateDer<'static>>> {
3636
certs(&mut io::BufReader::new(fs::File::open(path)?))
37-
.map_err(|_| io::Error::new(io::ErrorKind::InvalidInput, "invalid cert"))
38-
.map(|mut certs| certs.drain(..).map(rustls::Certificate).collect())
37+
.collect()
3938
}
4039

4140
// Loads private key from file.
42-
fn load_keys(path: impl AsRef<Path>) -> io::Result<Vec<rustls::PrivateKey>> {
41+
fn load_keys(path: impl AsRef<Path>) -> io::Result<Vec<PrivatePkcs8KeyDer<'static>>> {
4342
pkcs8_private_keys(&mut io::BufReader::new(fs::File::open(path)?))
44-
.map_err(|_| io::Error::new(io::ErrorKind::InvalidInput, "invalid key"))
45-
.map(|mut keys| keys.drain(..).map(rustls::PrivateKey).collect())
43+
.collect()
4644
}

0 commit comments

Comments
 (0)