From fb9ef1c1ad0b7d4d47396a0302f8f43aa0a4b4e7 Mon Sep 17 00:00:00 2001 From: Eidolon Date: Sat, 20 Apr 2024 19:15:46 -0500 Subject: [PATCH] git: Always use OpenSSL on win32 By default, libssh2 uses Windows Cryptography Next Generation when targeting win32. The wincng backend does not support ED25519, which is a widely-used algorithm among git hosting services, and in some cases may be the only option on remotes in certain configurations. This change adds the feature `openssl-on-win32`, enabling the same one in `libssh2-sys`, and enables it in the CI release flow, ensuring that release builds are able to communicate with hosts using ED25519. Fixes #3322 --- .github/workflows/release.yml | 2 +- CHANGELOG.md | 3 +++ Cargo.lock | 2 ++ Cargo.toml | 1 + cli/Cargo.toml | 2 ++ lib/Cargo.toml | 4 +++- 6 files changed, 12 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 85661841a0..be6e209aaf 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -46,7 +46,7 @@ jobs: toolchain: stable target: ${{ matrix.target }} - name: Build release binary - run: cargo build --target ${{ matrix.target }} --verbose --release --features packaging,vendored-openssl + run: cargo build --target ${{ matrix.target }} --verbose --release --features packaging,openssl-on-win32,vendored-openssl - name: Build archive shell: bash run: | diff --git a/CHANGELOG.md b/CHANGELOG.md index 4ae03aa2f0..5dd18b4a9d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -64,6 +64,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 literals. This means that `snapshot.max-new-file-size="1"` and `snapshot.max-new-file-size=1` are now equivalent. +* When built with the `openssl-on-win32` feature, ED25519 host keys are supported + when connecting to Git+SSH remotes on Windows. + ## [0.16.0] - 2024-04-03 ### Deprecations diff --git a/Cargo.lock b/Cargo.lock index 027395c8fb..7eeb77c9aa 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1694,6 +1694,7 @@ dependencies = [ "jj-cli", "jj-lib", "libc", + "libssh2-sys", "maplit", "minus", "once_cell", @@ -1744,6 +1745,7 @@ dependencies = [ "insta", "itertools 0.12.1", "jj-lib-proc-macros", + "libssh2-sys", "maplit", "num_cpus", "once_cell", diff --git a/Cargo.toml b/Cargo.toml index 6812e75680..8ac9e3fa65 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -60,6 +60,7 @@ indoc = "2.0.4" insta = { version = "1.38.0", features = ["filters"] } itertools = "0.12.1" libc = { version = "0.2.153" } +libssh2-sys = { version = "0.3.0" } maplit = "1.0.2" minus = { version = "5.6.1", features = ["dynamic_output", "search"] } num_cpus = "1.16.0" diff --git a/cli/Cargo.toml b/cli/Cargo.toml index 8d2b41c514..eddd9f7d5e 100644 --- a/cli/Cargo.toml +++ b/cli/Cargo.toml @@ -64,6 +64,7 @@ hex = { workspace = true } indexmap = { workspace = true } itertools = { workspace = true } jj-lib = { workspace = true } +libssh2-sys = { workspace = true } maplit = { workspace = true } minus = { workspace = true } once_cell = { workspace = true } @@ -104,6 +105,7 @@ jj-cli = { path = ".", features = ["test-fakes"], default-features = false } [features] default = ["watchman"] bench = ["dep:criterion"] +openssl-on-win32 = ["libssh2-sys/openssl-on-win32", "jj-lib/openssl-on-win32"] packaging = [] test-fakes = ["jj-lib/testing"] vendored-openssl = ["git2/vendored-openssl", "jj-lib/vendored-openssl"] diff --git a/lib/Cargo.toml b/lib/Cargo.toml index d7a68f6a13..19b6d348e8 100644 --- a/lib/Cargo.toml +++ b/lib/Cargo.toml @@ -49,6 +49,7 @@ hex = { workspace = true } ignore = { workspace = true } itertools = { workspace = true } jj-lib-proc-macros = { workspace = true } +libssh2-sys = { workspace = true } maplit = { workspace = true } once_cell = { workspace = true } pest = { workspace = true } @@ -92,6 +93,7 @@ tokio = { workspace = true, features = ["full"] } [features] default = [] -vendored-openssl = ["git2/vendored-openssl"] +openssl-on-win32 = ["libssh2-sys/openssl-on-win32"] +vendored-openssl = ["git2/vendored-openssl", "libssh2-sys/openssl-on-win32"] watchman = ["dep:tokio", "dep:watchman_client"] testing = []