diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a1ad98875..4fb703485 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -264,6 +264,9 @@ jobs: run: rustc --version && cargo --version - uses: Swatinem/rust-cache@v2 if: github.event_name != 'release' && github.event_name != 'workflow_dispatch' + - name: Install NASM for rustls/aws-lc-rs on Windows + if: runner.os == 'Windows' + uses: ilammy/setup-nasm@v1 - name: Build (.deb) if: matrix.target == 'debian-x86_64' run: | diff --git a/Cargo.lock b/Cargo.lock index 00f958f8d..1e985073f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -435,6 +435,32 @@ version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f1fdabc7756949593fe60f30ec81974b613357de856987752631dea1e3394c80" +[[package]] +name = "aws-lc-rs" +version = "1.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9f379c4e505c0692333bd90a334baa234990faa06bdabefd3261f765946aa920" +dependencies = [ + "aws-lc-sys", + "mirai-annotations", + "paste", + "zeroize", +] + +[[package]] +name = "aws-lc-sys" +version = "0.14.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "68aa3d613f42dbf301dbbcaf3dc260805fd33ffd95f6d290ad7231a9e5d877a7" +dependencies = [ + "bindgen", + "cmake", + "dunce", + "fs_extra", + "libc", + "paste", +] + [[package]] name = "backtrace" version = "0.3.71" @@ -484,6 +510,29 @@ dependencies = [ "smallvec", ] +[[package]] +name = "bindgen" +version = "0.69.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a00dc851838a2120612785d195287475a3ac45514741da670b735818822129a0" +dependencies = [ + "bitflags 2.5.0", + "cexpr", + "clang-sys", + "itertools 0.10.5", + "lazy_static", + "lazycell", + "log", + "prettyplease", + "proc-macro2", + "quote", + "regex", + "rustc-hash", + "shlex", + "syn 2.0.58", + "which", +] + [[package]] name = "bit-set" version = "0.5.3" @@ -669,6 +718,15 @@ dependencies = [ "libc", ] +[[package]] +name = "cexpr" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6fac387a98bb7c37292057cffc56d62ecb629900026402633ae9160df93a8766" +dependencies = [ + "nom", +] + [[package]] name = "cfg-if" version = "1.0.0" @@ -715,6 +773,17 @@ dependencies = [ "half", ] +[[package]] +name = "clang-sys" +version = "1.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67523a3b4be3ce1989d607a828d036249522dd9c1c8de7f4dd2dae43a37369d1" +dependencies = [ + "glob", + "libc", + "libloading", +] + [[package]] name = "clap" version = "4.5.4" @@ -755,6 +824,15 @@ version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "98cc8fbded0c607b7ba9dd60cd98df59af97e84d24e49c8557331cfc26d301ce" +[[package]] +name = "cmake" +version = "0.1.50" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a31c789563b815f77f4250caee12365734369f942439b7defd71e18a48197130" +dependencies = [ + "cc", +] + [[package]] name = "color_quant" version = "1.1.0" @@ -1123,6 +1201,12 @@ version = "0.15.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1aaf95b3e5c8f23aa320147307562d361db0ae0d51242340f558153b4eb2439b" +[[package]] +name = "dunce" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "56ce8c6da7551ec6c462cbaf3bfbc75131ebbfa1c944aeaa9dab51ca1c5f0c3b" + [[package]] name = "either" version = "1.10.0" @@ -1423,6 +1507,12 @@ dependencies = [ "windows-sys 0.48.0", ] +[[package]] +name = "fs_extra" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "42703706b716c37f96a77aea830392ad231f44c9e9a67872fa5548707e11b11c" + [[package]] name = "funty" version = "2.0.0" @@ -2035,6 +2125,12 @@ dependencies = [ "spin 0.5.2", ] +[[package]] +name = "lazycell" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55" + [[package]] name = "libc" version = "0.2.153" @@ -2059,6 +2155,16 @@ dependencies = [ "libdeflate-sys", ] +[[package]] +name = "libloading" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c2a198fb6b0eada2a8df47933734e6d35d350665a33a3593d7164fa52c75c19" +dependencies = [ + "cfg-if", + "windows-targets 0.48.5", +] + [[package]] name = "libm" version = "0.2.8" @@ -2131,7 +2237,7 @@ dependencies = [ "actix-web", "async-trait", "bit-set", - "brotli 3.5.0", + "brotli 4.0.0", "cargo-husky", "clap", "criterion", @@ -2158,7 +2264,7 @@ dependencies = [ "postgres-protocol", "pprof", "regex", - "rustls 0.22.3", + "rustls 0.23.4", "rustls-native-certs 0.7.0", "rustls-pemfile 2.1.2", "semver", @@ -2289,6 +2395,12 @@ dependencies = [ "windows-sys 0.48.0", ] +[[package]] +name = "mirai-annotations" +version = "1.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c9be0862c1b3f26a88803c4a49de6889c10e608b3ee9344e6ef5b45fb37ad3d1" + [[package]] name = "moka" version = "0.12.5" @@ -2839,6 +2951,16 @@ dependencies = [ "yansi", ] +[[package]] +name = "prettyplease" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8d3928fb5db768cb86f891ff014f0144589297e3c6a1aba6ed7cecfdace270c7" +dependencies = [ + "proc-macro2", + "syn 2.0.58", +] + [[package]] name = "proc-macro2" version = "1.0.79" @@ -3233,9 +3355,9 @@ dependencies = [ [[package]] name = "rstest" -version = "0.18.2" +version = "0.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97eeab2f3c0a199bc4be135c36c924b6590b88c377d416494288c14f2db30199" +checksum = "9d5316d2a1479eeef1ea21e7f9ddc67c191d497abc8fc3ba2467857abbb68330" dependencies = [ "futures", "futures-timer", @@ -3245,9 +3367,9 @@ dependencies = [ [[package]] name = "rstest_macros" -version = "0.18.2" +version = "0.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d428f8247852f894ee1be110b375111b586d4fa431f6c46e64ba5a0dcccbe605" +checksum = "04a9df72cc1f67020b0d63ad9bfe4a323e459ea7eb68e03bd9824db49f9a4c25" dependencies = [ "cfg-if", "glob", @@ -3322,12 +3444,13 @@ dependencies = [ [[package]] name = "rustls" -version = "0.22.3" +version = "0.23.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "99008d7ad0bbbea527ec27bddbc0e432c5b87d8175178cee68d2eec9c4a1813c" +checksum = "8c4d6d8ad9f2492485e13453acbb291dd08f64441b6609c491f1c2cd2c6b4fe1" dependencies = [ + "aws-lc-rs", "log", - "ring", + "once_cell", "rustls-pki-types", "rustls-webpki 0.102.2", "subtle", @@ -3400,6 +3523,7 @@ version = "0.102.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "faaa0a62740bedb9b2ef5afa303da42764c012f743917351dc9a237ea1663610" dependencies = [ + "aws-lc-rs", "ring", "rustls-pki-types", "untrusted", @@ -3632,6 +3756,12 @@ dependencies = [ "digest", ] +[[package]] +name = "shlex" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" + [[package]] name = "signal-hook-registry" version = "1.4.1" @@ -4358,16 +4488,15 @@ dependencies = [ [[package]] name = "tokio-postgres-rustls" -version = "0.11.1" +version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ea13f22eda7127c827983bdaf0d7fff9df21c8817bab02815ac277a21143677" +checksum = "04fb792ccd6bbcd4bba408eb8a292f70fc4a3589e5d793626f45190e6454b6ab" dependencies = [ - "futures", "ring", - "rustls 0.22.3", + "rustls 0.23.4", "tokio", "tokio-postgres", - "tokio-rustls 0.25.0", + "tokio-rustls 0.26.0", "x509-certificate", ] @@ -4383,11 +4512,11 @@ dependencies = [ [[package]] name = "tokio-rustls" -version = "0.25.0" +version = "0.26.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "775e0c0f0adb3a2f22a00c4745d728b479985fc15ee7ca6a2608388c5569860f" +checksum = "0c7bc40d0e5a97695bb96e27995cd3a08538541b0a846f65bba7a359f36700d4" dependencies = [ - "rustls 0.22.3", + "rustls 0.23.4", "rustls-pki-types", "tokio", ] diff --git a/Cargo.toml b/Cargo.toml index bee3e2b90..08edd32a2 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -33,7 +33,7 @@ anyhow = "1.0" approx = "0.5.1" async-trait = "0.1" bit-set = "0.5.3" -brotli = "3" +brotli = { version = "4", default-features = false, features = ["std"] } cargo-husky = { version = "1", features = ["user-hooks"], default-features = false } clap = { version = "4", features = ["derive"] } criterion = { version = "0.5", features = ["async_futures", "async_tokio", "html_reports"] } @@ -62,8 +62,10 @@ postgres-protocol = "0.6" pprof = { version = "0.13", features = ["flamegraph", "criterion"] } pretty_assertions = "1" regex = "1" -rstest = "0.18" -rustls = "0.22" +rstest = "0.19" +rustls = "0.23.4" +# ring feature does not require NASM windows executable, but works slower +#rustls = { version = "0.23", default-features = false, features = ["logging", "std", "tls12", "ring"] } rustls-native-certs = "0.7" rustls-pemfile = "2" semver = "1" @@ -80,7 +82,7 @@ thiserror = "1" tile-grid = "0.5" tilejson = "0.4" tokio = { version = "1", features = ["macros"] } -tokio-postgres-rustls = "0.11" +tokio-postgres-rustls = "0.12" url = "2.5" [profile.dev.package] diff --git a/martin/src/pg/tls.rs b/martin/src/pg/tls.rs index 9f28fc664..f397393ba 100644 --- a/martin/src/pg/tls.rs +++ b/martin/src/pg/tls.rs @@ -9,7 +9,8 @@ use deadpool_postgres::tokio_postgres::Config; use log::{info, warn}; use regex::Regex; use rustls::client::danger::{HandshakeSignatureValid, ServerCertVerified, ServerCertVerifier}; -use rustls::crypto::ring::default_provider; +// use rustls::crypto::ring::default_provider; +use rustls::crypto::aws_lc_rs::default_provider; use rustls::crypto::{verify_tls12_signature, verify_tls13_signature}; use rustls::pki_types::{CertificateDer, ServerName, UnixTime}; use rustls::{DigitallySignedStruct, Error, SignatureScheme}; diff --git a/mbtiles/tests/copy.rs b/mbtiles/tests/copy.rs index 97efcc64e..e0525cd31 100644 --- a/mbtiles/tests/copy.rs +++ b/mbtiles/tests/copy.rs @@ -1,6 +1,7 @@ use std::collections::HashMap; use std::path::PathBuf; use std::str::from_utf8; +use std::sync::Mutex; use ctor::ctor; use insta::{allow_duplicates, assert_snapshot}; @@ -176,7 +177,12 @@ macro_rules! assert_dump { struct Databases( HashMap< (&'static str, MbtTypeCli), - (Vec, Mbtiles, Option, SqliteConnection), + ( + Vec, + Mbtiles, + Option, + Mutex, + ), >, ); @@ -190,7 +196,8 @@ impl Databases { hash: Option, conn: SqliteConnection, ) { - self.0.insert((name, typ), (dump, mbtiles, hash, conn)); + self.0 + .insert((name, typ), (dump, mbtiles, hash, Mutex::new(conn))); } fn dump(&self, name: &'static str, typ: MbtTypeCli) -> &Vec { &self.0.get(&(name, typ)).unwrap().0