Skip to content

Commit ded4d9d

Browse files
authored
Merge pull request #266 from umccr/feat/c4gh-misc
fix: explicitly choose aws_lc_rs as the crypto provider
2 parents c653daa + 5b25d56 commit ded4d9d

File tree

12 files changed

+41
-6
lines changed

12 files changed

+41
-6
lines changed

Cargo.lock

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

htsget-actix/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ default = []
2424

2525
[dependencies]
2626
actix-web = { version = "4", features = ["rustls-0_23"] }
27+
rustls = "0.23"
2728
actix-cors = "0.7"
2829
http_1 = { package = "http", version = "1" }
2930
http = "0.2"

htsget-actix/src/lib.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,7 @@ mod tests {
147147
use actix_web::dev::ServiceResponse;
148148
use actix_web::{test, web, App};
149149
use async_trait::async_trait;
150+
use rustls::crypto::aws_lc_rs;
150151
use tempfile::TempDir;
151152

152153
use htsget_axum::server::BindServer;
@@ -261,6 +262,8 @@ mod tests {
261262

262263
impl ActixTestServer {
263264
fn new_with_tls<P: AsRef<Path>>(path: P) -> Self {
265+
let _ = aws_lc_rs::default_provider().install_default();
266+
264267
Self {
265268
config: config_with_tls(path),
266269
}

htsget-actix/src/main.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
use rustls::crypto::aws_lc_rs;
2+
use std::io;
13
use tokio::select;
24
use tracing::debug;
35

@@ -7,7 +9,11 @@ use htsget_axum::server::data;
79
use htsget_config::command;
810

911
#[actix_web::main]
10-
async fn main() -> std::io::Result<()> {
12+
async fn main() -> io::Result<()> {
13+
aws_lc_rs::default_provider()
14+
.install_default()
15+
.map_err(|_| io::Error::other("setting crypto provider"))?;
16+
1117
if let Some(path) = Config::parse_args_with_command(command!())? {
1218
let config = Config::from_path(&path)?;
1319

htsget-axum/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ default = []
3535
[dependencies]
3636
# Axum server
3737
hyper = { version = "1", features = ["http1", "http2", "server"] }
38+
rustls = "0.23"
3839
hyper-util = "0.1"
3940
tower-http = { version = "0.5", features = ["trace", "cors", "fs"] }
4041
http = "1"

htsget-axum/src/main.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
use rustls::crypto::aws_lc_rs;
12
use std::io;
23
use tokio::select;
34
use tracing::debug;
@@ -8,6 +9,10 @@ use htsget_config::config::Config;
89

910
#[tokio::main]
1011
async fn main() -> io::Result<()> {
12+
aws_lc_rs::default_provider()
13+
.install_default()
14+
.map_err(|_| io::Error::other("setting crypto provider"))?;
15+
1116
if let Some(path) =
1217
Config::parse_args_with_command(command!()).expect("expected valid command parsing")
1318
{

htsget-axum/src/server/data.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ mod tests {
9090
use http::header::HeaderName;
9191
use http::{HeaderMap, Method};
9292
use reqwest::{Client, ClientBuilder, RequestBuilder};
93+
use rustls::crypto::aws_lc_rs;
9394
use tempfile::{tempdir, TempDir};
9495
use tokio::fs::{create_dir, File};
9596
use tokio::io::AsyncWriteExt;
@@ -209,6 +210,8 @@ mod tests {
209210

210211
#[tokio::test]
211212
async fn test_tls_server() {
213+
let _ = aws_lc_rs::default_provider().install_default();
214+
212215
let (_, base_path) = create_local_test_files().await;
213216
let config = config_with_tls(base_path.path()).data_server().clone();
214217
let server_config = config.into_tls().unwrap();
@@ -261,6 +264,8 @@ mod tests {
261264
}
262265

263266
fn tls_formatter() -> BindServer {
267+
let _ = aws_lc_rs::default_provider().install_default();
268+
264269
let tmp_dir = tempdir().unwrap();
265270
let config = config_with_tls(tmp_dir.path()).data_server().clone();
266271
let server_config = config.into_tls().unwrap();

htsget-axum/src/server/ticket.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@ mod tests {
118118
};
119119
use http::header::HeaderName;
120120
use http::{Method, Request};
121+
use rustls::crypto::aws_lc_rs;
121122
use tempfile::TempDir;
122123
use tower::ServiceExt;
123124

@@ -208,6 +209,8 @@ mod tests {
208209

209210
impl AxumTestServer {
210211
fn new_with_tls<P: AsRef<Path>>(path: P) -> Self {
212+
let _ = aws_lc_rs::default_provider().install_default();
213+
211214
Self {
212215
config: config_with_tls(path),
213216
}

htsget-config/src/config/mod.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -494,12 +494,11 @@ pub(crate) mod tests {
494494
use std::fmt::Display;
495495

496496
use crate::config::parser::from_str;
497-
use figment::Jail;
498-
use http::uri::Authority;
499-
500497
use crate::storage::Storage;
501498
use crate::tls::tests::with_test_certificates;
502499
use crate::types::Scheme::Http;
500+
use figment::Jail;
501+
use http::uri::Authority;
503502

504503
use super::*;
505504

htsget-config/src/tls/mod.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,7 @@ pub(crate) mod tests {
203203
use std::path::Path;
204204

205205
use rcgen::generate_simple_self_signed;
206+
use rustls::crypto::aws_lc_rs;
206207
use rustls_pemfile::{certs, pkcs8_private_keys};
207208
use tempfile::TempDir;
208209

@@ -245,6 +246,8 @@ pub(crate) mod tests {
245246
where
246247
F: FnOnce(&Path, PrivateKeyDer<'static>, CertificateDer<'static>),
247248
{
249+
let _ = aws_lc_rs::default_provider().install_default();
250+
248251
let tmp_dir = TempDir::new().unwrap();
249252

250253
let key_path = tmp_dir.path().join("key.pem");

0 commit comments

Comments
 (0)