From 31fa25ae20217660b4d522550e415af8edeced9a Mon Sep 17 00:00:00 2001 From: Manish Goregaokar Date: Wed, 5 Aug 2026 13:36:11 -0700 Subject: [PATCH 1/6] Update to libssh2 master branch --- .gitmodules | 2 +- libssh2-sys/build.rs | 7 ++++++- libssh2-sys/libssh2 | 2 +- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/.gitmodules b/.gitmodules index a6bfd121..76593a51 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,4 +1,4 @@ [submodule "libssh2-sys/libssh2"] path = libssh2-sys/libssh2 - url = https://github.com/Manishearth/libssh2 + url = https://github.com/libssh2/libssh2 branch = master diff --git a/libssh2-sys/build.rs b/libssh2-sys/build.rs index 9ee862fe..802cf8a4 100644 --- a/libssh2-sys/build.rs +++ b/libssh2-sys/build.rs @@ -71,14 +71,17 @@ fn main() { .file("libssh2/src/cipher-chachapoly.c") .file("libssh2/src/comp.c") .file("libssh2/src/crypt.c") - .file("libssh2/src/crypto.c") .file("libssh2/src/global.c") .file("libssh2/src/hostkey.c") .file("libssh2/src/keepalive.c") .file("libssh2/src/kex.c") .file("libssh2/src/knownhost.c") + .file("libssh2/src/libgcrypt.c") .file("libssh2/src/mac.c") + .file("libssh2/src/mbedtls.c") .file("libssh2/src/misc.c") + .file("libssh2/src/openssl.c") + .file("libssh2/src/os400qc3.c") .file("libssh2/src/packet.c") .file("libssh2/src/pem.c") .file("libssh2/src/poly1305.c") @@ -89,6 +92,8 @@ fn main() { .file("libssh2/src/transport.c") .file("libssh2/src/userauth.c") .file("libssh2/src/userauth_kbd_packet.c") + .file("libssh2/src/version.c") + .file("libssh2/src/wincng.c") .include(&include) .include("libssh2/src"); diff --git a/libssh2-sys/libssh2 b/libssh2-sys/libssh2 index 090f23d1..4aded1bf 160000 --- a/libssh2-sys/libssh2 +++ b/libssh2-sys/libssh2 @@ -1 +1 @@ -Subproject commit 090f23d1852a0b62e081bd12c4d05adc1c4af47a +Subproject commit 4aded1bf2de0a7ceb02cd50b0b1f7a826984783a From 772597fd47eebbe745bc92defdaf48d9fe66a8af Mon Sep 17 00:00:00 2001 From: Gabriel Smith Date: Sat, 5 Sep 2026 11:52:27 -0400 Subject: [PATCH 2/6] resolve min_value deprecation in Rust 1.99.0+ --- src/error.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/error.rs b/src/error.rs index 901add7f..26b7e238 100644 --- a/src/error.rs +++ b/src/error.rs @@ -113,7 +113,7 @@ impl Error { /// Generate an error for unknown failure pub fn unknown() -> Error { Error::new( - ErrorCode::Session(libc::c_int::min_value()), + ErrorCode::Session(libc::c_int::MIN), "no other error listed", ) } From a75ba0da8e8f507fd40f22c25f620e4a81d73587 Mon Sep 17 00:00:00 2001 From: Gabriel Smith Date: Sun, 6 Sep 2026 21:06:43 -0400 Subject: [PATCH 3/6] tests/session: switch to curve25519-sha256 KEX method The diffie-hellman-group* KEX methods were removed from the default list in OpenSSH 10.0 and disabled by default since libssh2 1.11.1. Elliptic curve methods have been supported in the default list for 14 years now according to the OpenSSH change log, so it should be safe to choose this for tests. --- tests/all/session.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tests/all/session.rs b/tests/all/session.rs index 2e2d651b..c661be03 100644 --- a/tests/all/session.rs +++ b/tests/all/session.rs @@ -25,8 +25,7 @@ fn smoke() { assert_eq!(sess.timeout(), 0); sess.set_compress(true); assert!(sess.host_key().is_none()); - sess.method_pref(MethodType::Kex, "diffie-hellman-group14-sha1") - .unwrap(); + sess.method_pref(MethodType::Kex, "curve25519-sha256").unwrap(); assert!(sess.methods(MethodType::Kex).is_none()); sess.set_blocking(true); sess.set_timeout(0); From a5bc147b55d9ac2e9719b71e6e49f3de0bf8bbb0 Mon Sep 17 00:00:00 2001 From: Gabriel Smith Date: Sun, 6 Sep 2026 21:30:58 -0400 Subject: [PATCH 4/6] tests/session: change host key has to SHA256 MD5 hashes have been disabled by default by libssh2 1.11.1. --- tests/all/session.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/all/session.rs b/tests/all/session.rs index c661be03..e64c9d9c 100644 --- a/tests/all/session.rs +++ b/tests/all/session.rs @@ -54,7 +54,7 @@ fn smoke_handshake() { agent.userauth(&user, &identity).unwrap(); } assert!(sess.authenticated()); - sess.host_key_hash(HashType::Md5).unwrap(); + sess.host_key_hash(HashType::Sha256).unwrap(); } #[test] From 4f84cfa63af35438fe0ac20ca674f1d765dec25a Mon Sep 17 00:00:00 2001 From: Gabriel Smith Date: Sun, 6 Sep 2026 22:05:32 -0400 Subject: [PATCH 5/6] libssh2-sys: remove reference to win32 folder removed in libssh2 1.11.0 --- libssh2-sys/build.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/libssh2-sys/build.rs b/libssh2-sys/build.rs index 802cf8a4..9dc918eb 100644 --- a/libssh2-sys/build.rs +++ b/libssh2-sys/build.rs @@ -100,7 +100,6 @@ fn main() { cfg.define("HAVE_LONGLONG", None); if target.contains("windows") { - cfg.include("libssh2/win32"); cfg.define("LIBSSH2_WIN32", None); cfg.file("libssh2/src/agent_win.c"); From 7e5674fb75f83f72b2ce43fc7f32579142c3522e Mon Sep 17 00:00:00 2001 From: Gabriel Smith Date: Sun, 6 Sep 2026 22:06:07 -0400 Subject: [PATCH 6/6] libssh2-sys: remove Windows support files removed in libssh2 master branch --- libssh2-sys/build.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/libssh2-sys/build.rs b/libssh2-sys/build.rs index 9dc918eb..a96f22ae 100644 --- a/libssh2-sys/build.rs +++ b/libssh2-sys/build.rs @@ -101,7 +101,6 @@ fn main() { if target.contains("windows") { cfg.define("LIBSSH2_WIN32", None); - cfg.file("libssh2/src/agent_win.c"); if env::var_os("CARGO_FEATURE_OPENSSL_ON_WIN32").is_some() { cfg.define("LIBSSH2_OPENSSL", None);