Skip to content

Commit

Permalink
fix: no process-level CryptoProvider available
Browse files Browse the repository at this point in the history
  • Loading branch information
Itsusinn committed Dec 18, 2024
1 parent 9fb926b commit 535ff07
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 12 deletions.
31 changes: 22 additions & 9 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,25 +43,29 @@ jobs:
target: x86_64-unknown-linux-gnu
release-name: x86_64-linux
cross: true
extra-args: "--features jemallocator"
- os: ubuntu-latest
target: i686-unknown-linux-gnu
release-name: i686-linux
cross: true
extra-args: "--features jemallocator"
# Linux x86 musl
- os: ubuntu-latest
target: x86_64-unknown-linux-musl
release-name: x86_64-linux-musl
cross: true
extra-args: "--features jemallocator"
- os: ubuntu-latest
target: i686-unknown-linux-musl
release-name: i686-linux-musl
cross: true
extra-args: "--no-default-features --features ring"
extra-args: "--no-default-features --features ring,jemallocator"
# Linux arm
- os: ubuntu-latest
target: aarch64-unknown-linux-gnu
release-name: aarch64-linux
cross: true
extra-args: "--features jemallocator"
- os: ubuntu-latest
target: armv7-unknown-linux-gnueabi
release-name: armv7-linux
Expand All @@ -77,47 +81,47 @@ jobs:
target: aarch64-unknown-linux-musl
release-name: aarch64-linux-musl
cross: true
extra-args: "--features jemallocator"
- os: ubuntu-latest
target: armv7-unknown-linux-musleabi
release-name: armv7-linux-musl
cross: true
extra-args: "--no-default-features --features ring"
extra-args: "--no-default-features --features ring,jemallocator"
- os: ubuntu-latest
target: armv7-unknown-linux-musleabihf
release-name: armv7-linux-muslhf
cross: true
extra-args: "--no-default-features --features ring"
extra-args: "--no-default-features --features ring,jemallocator"
# Windows
- os: windows-latest
target: x86_64-pc-windows-msvc
release-name: x86_64-windows
cross: false
postfix: ".exe"
extra-args: "--no-default-features --features aws-lc-rs"
- os: windows-latest
target: i686-pc-windows-msvc
release-name: i686-windows
cross: false
postfix: ".exe"
extra-args: "--no-default-features --features ring"
extra-args: "--features ring"
# Windows Arm
- os: windows-latest
target: aarch64-pc-windows-msvc
release-name: aarch64-windows
cross: false
postfix: ".exe"
extra-args: "--no-default-features --features aws-lc-rs"

# MacOSX
- os: macos-13
target: x86_64-apple-darwin
release-name: x86_64-darwin
cross: false

extra-args: "--features jemallocator"

- os: macos-14
target: aarch64-apple-darwin
release-name: aarch64-darwin
cross: false
extra-args: "--features jemallocator"

# FreeBSD
# - os: ubuntu-latest
Expand Down Expand Up @@ -195,7 +199,16 @@ jobs:
with:
use-cross: ${{ matrix.cross }}
command: build
args: --release --target ${{ matrix.target }} ${{ matrix.extra-args }}
args: --package ${{ env.PACKAGE }} --release --target ${{ matrix.target }} ${{ matrix.extra-args }}
env:
RUSTFLAGS: ${{ matrix.rustflags }}

- name: Cargo build
uses: clechasseur/rs-cargo@v2
with:
use-cross: ${{ matrix.cross }}
command: build
args: --package ${{ env.PACKAGE2 }} --release --target ${{ matrix.target }} ${{ matrix.extra-args }}
env:
RUSTFLAGS: ${{ matrix.rustflags }}

Expand Down
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 10 additions & 2 deletions tuic-client/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,12 @@ readme.workspace = true
license.workspace = true
repository.workspace = true

[features]
default = ["aws-lc-rs"]
ring = ["rustls/ring", "quinn/rustls-ring"]
aws-lc-rs = ["rustls/aws-lc-rs", "quinn/rustls-aws-lc-rs"]
jemallocator = ["tikv-jemallocator"]

[dependencies]
bytes = { version = "1", default-features = false, features = ["std"] }

Expand All @@ -29,7 +35,7 @@ socks5-server = { version = "0.8", default-features = false }
uuid = { version = "1", default-features = false, features = ["serde", "std"] }

# QUIC
quinn = { version = "0.11", default-features = false, features = ["runtime-tokio", "rustls", "log"] }
quinn = { version = "0.11", default-features = false, features = ["runtime-tokio","log"] }

# TUIC
tuic = { path = "../tuic", default-features = false }
Expand All @@ -48,4 +54,6 @@ rustls-pemfile = { version = "2", default-features = false, features = ["std"] }

# Error-handling
thiserror = { version = "2", default-features = false }
anyhow = "1"
anyhow = "1"

tikv-jemallocator = { version = "0.6", optional = true }
6 changes: 5 additions & 1 deletion tuic-client/src/connection/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,11 @@ impl Connection {

impl SkipServerVerification {
fn new() -> Arc<Self> {
Arc::new(Self(Arc::new(rustls::crypto::ring::default_provider())))
Arc::new(Self(
rustls::crypto::CryptoProvider::get_default()
.expect("Crypto not found")
.clone(),
))
}
}

Expand Down

0 comments on commit 535ff07

Please sign in to comment.