1
0
mirror of https://github.com/libssh2/libssh2.git synced 2026-01-27 00:18:12 +03:00
Commit Graph

3165 Commits

Author SHA1 Message Date
HJadhav-NI
0cb8351494 hostkey: prefer ED25519 over ECDSA in hostkey algorithm negotiation (#1783)
Reorders the hostkey_methods array to prioritize ED25519 host keys over
ECDSA curves, aligning libssh2 with OpenSSH's default behavior.

As noted in issue #1782, industry usage has shifted to prefer ED25519

Previous order:
ECDSA (nistp256/384/521 + certificates)
**ED25519 (ssh-ed25519 + certificates)**
RSA (SHA2-512, SHA2-256, SHA1)
DSA

New order:
**ED25519 (ssh-ed25519 + certificates)**
ECDSA (nistp256/384/521 + certificates)
RSA (SHA2-512, SHA2-256, SHA1)
DSA

Testing:
Existing test suites should pass without modification

References:
OpenSSH HostKeyAlgorithms default order: 
- https://man.openbsd.org/sshd_config#HostKeyAlgorithms
- https://man.openbsd.org/ssh_config#HostKeyAlgorithms

Fixes #1782

Signed-off-by: Hemant Jadhav <hemant.jadhav@emerson.com>
2026-01-14 21:10:46 +01:00
Viktor Szakats
882bd26488 GHA: delete disable-man-db hack, runners doing it by default now
Refs:
1f107542ae
https://github.com/actions/runner-images/pull/13268
https://github.com/actions/runner-images/issues/13213

Also delete more 3rd-party apt source to reduce flakiness.

`ondrej-ubuntu-php-noble.sources` is ubuntu arm runner-specific.

Closes #1779
2026-01-12 12:42:58 +01:00
Viktor Szakats
14de8476c3 checksrc: replace bash starter with checksrc-all.pl
To remove dependence on a shell script to start `checksrc.pl`.

Fixes #1775
Closes #1778
2026-01-12 12:42:57 +01:00
dependabot[bot]
eeaf29bae8 GHA: bump Actions (#1776)
- update `actions/checkout` from 6.0.0 to 6.0.1
- update `msys2/setup-msys2` from 2.29.0 to 2.30.0
- update `actions/cache` from 4.3.0 to 5.0.1
- update `cross-platform-actions/action` from 0.30.0 to 0.32.0
- update `actions/upload-artifact` from 5.0.0 to 6.0.0
- update `github/codeql-action` from 4.30.8 to 4.31.9
- update `docker/metadata-action` from 5.8.0 to 5.10.0
2026-01-02 09:14:37 +01:00
Viktor Szakats
fdbc32b0d1 tidy-up: parenthesis in macros (OS400)
Follow-up to d97d8e3198 #1773

Closes #1774
2025-12-26 22:40:15 +01:00
Viktor Szakats
d97d8e3198 tidy-up: parenthesis in macros
- delete superfluous ones.
- add missing ones.
  Did not cause an actual issue with the current use of these macros.

Closes #1773
2025-12-26 21:22:11 +01:00
Viktor Szakats
71804d9f8d checksrc: update, fix fallouts
Closes #1772
2025-12-26 00:38:59 +01:00
Viktor Szakats
46c7a4807c windows: always enable large-file support
It's supported by all known mingw-w64 and MSVC versions, likely also by
other modern Windows compilers.

After this patch, the `LIBSSH2_USE_WIN32_LARGE_FILES` and
`LIBSSH2_USE_WIN32_SMALL_FILES` macros are ignored by the libssh2 public
header, and it no longer defines them.

Closes #1771
2025-12-26 00:03:51 +01:00
Viktor Szakats
3865eabe6e src: move outlier leading && and || to the end of lines
Closes #1767
2025-12-26 00:01:45 +01:00
Viktor Szakats
1d464325fe include: drop stray bits of Windows CE support
libssh2 cannot be compiled for WinCE. Delete two preprocessor conditions
in the public header checking for WinCE.

Closes #1770
2025-12-25 23:45:27 +01:00
Viktor Szakats
cbe7654d72 windows: drop support for Visual Studio 2008 and older
Closes #1769
2025-12-25 23:42:25 +01:00
Viktor Szakats
c321b324d6 appveyor: disable last Windows test job, now completely broken
After this, libssh2 is left without runtime tests on Windows in CI.

```
Waiting for SSH connection from GitHub Actions....[..].... failed.
```
Ref: https://ci.appveyor.com/project/libssh2org/libssh2/builds/53276260/job/7hom25cx4q8kf3pv (OpenSSL)
Ref: https://ci.appveyor.com/project/libssh2org/libssh2/builds/53289394/job/rxbker53liv2nqb2 (OpenSSL)
Ref: https://ci.appveyor.com/project/libssh2org/libssh2/builds/53289591/job/gf2xfpn9cq40ey0l (WinCNG)

Closes #1768
2025-12-25 23:33:58 +01:00
Viktor Szakats
6e56a8bdca tidy-up: drop duplicate newlines, fix non-ASCII chars, other formatting, check in CI
Closes #1766
2025-12-25 22:24:13 +01:00
Viktor Szakats
35e1c653bd cmake: rename libssh2-config.cmake.in to libssh2-config.in.cmake
To:
- match filename suffix with file content.
- simplify recognizing CMake sources.
- ensure syntax highlighters use the correct file type.

Also:
- cmakelint.sh: simplify, alpha sort the filelist.

Closes #1765
2025-12-25 20:37:50 +01:00
Michael Buckley
631e2f82a3 Fix a NULL dereference of kex->exchange_keys during key exchange. (#1763)
Credit:
Aldo Ristori
2025-12-19 15:41:45 -08:00
Joshua Rogers
c10cb2449c agent: do not truncate socket path; reject (#1709)
Credit:
Joshua Rogers
2025-12-03 10:42:31 -08:00
Viktor Szakats
cb0a6cf253 RELEASE-NOTES: sync [ci skip] 2025-12-02 04:08:15 +01:00
dependabot[bot]
dd2b04f253 GHA: bump pip reuse and 2 GitHub Actions
- update `actions/checkout` from 5.0.0 to 6.0.0
- update `cross-platform-actions/action` from 0.29.0 to 0.30.0
- update pip package `reuse` from 6.1.2 to 6.2.0

Closes #1755
Closes #1756
2025-12-01 20:21:17 +01:00
Viktor Szakats
96e21c2e25 cmake: verify minimum CMake version in libssh2-config.cmake
This is the same minimum version required to build libssh2 itself (3.7).

Closes #1754
2025-12-01 20:20:56 +01:00
Viktor Szakats
69bed46a9b cmakelint: also lint CMake .in files (fixup), fix a long line
Follow-up to 9e4d307e67 #1751
2025-12-01 14:58:50 +01:00
Viktor Szakats
78cd32aada cmake: namespace all local variables in libssh2-config.cmake
Closes #1752
2025-12-01 14:50:00 +01:00
Viktor Szakats
9e4d307e67 cmakelint: also lint CMake .in files
Closes #1751
2025-12-01 14:50:00 +01:00
Viktor Szakats
2b7f82989c GHA: minor command sync with the curl repo 2025-12-01 12:23:26 +01:00
Viktor Szakats
7fd89a58fa cmake: save and restore CMAKE_MODULE_PATH in libssh2-config.cmake
Bug: https://github.com/curl/curl/pull/16973#discussion_r2572957270
Follow-up to 82b09f9b3a #1322

Closes #1750
2025-11-29 15:09:48 +01:00
Viktor Szakats
78ffc2d405 GHA: move config log dumps to their separate steps
To make configure step output more readable in case of a build error.
To expose configure logs for successful builds without adding clutter.

Also:
- set shell globally for Windows jobs.
- move all Cygwin files to `D:`.

Closes #1749
2025-11-28 13:10:27 +01:00
Viktor Szakats
c124c6a987 GHA: fix using mbedtls@3 in macOS jobs
mbedtls@3 is no longer installed to default locations. Point the builds
to it explicitly.

Follow-up to b098a3c434 #1744
Closes #1748
2025-11-28 12:25:34 +01:00
Lars Nordin
81f0203c1c userauth: fix error message for EAGAIN in public-key response (#1747) 2025-11-28 11:58:05 +01:00
Viktor Szakats
b098a3c434 GHA: switch macOS jobs to versioned mbedtls@3 brew package
To avoid bumping to 4.x with the unversioned mbedtls package.

Closes #1744
2025-11-22 02:15:36 +01:00
Joshua Rogers
8ddf3b317f agent: pageant backend, bound reply copy, handle missing reply (#1711)
The Pageant transact path trusted the 32-bit length in the shared memory
mapping and could memcpy past the mapped view. It also treated
a non-positive SendMessage(WM_COPYDATA) result as success.

Changes:

Reject replies when SendMessage returns ≤ 0 and report
LIBSSH2_ERROR_AGENT_PROTOCOL.

Bound the copy by validating response_len <= PAGEANT_MAX_MSGLEN - 4
(accounting for the length prefix) to avoid OOB reads.

Impact: prevents potential out-of-bounds read and use of uninitialized
mapping contents when Pageant misbehaves or is malicious.
2025-11-17 11:25:26 +01:00
Viktor Szakats
1045cfd033 GHA/codeql: limit cron job to the origin repository (#1741)
To avoid running it in every fork, every week.
2025-11-16 23:14:22 +01:00
Viktor Szakats
f61703cc98 GHA: add actionlint job, fix reported issues
Closes #1740
2025-11-10 19:06:11 +01:00
Viktor Szakats
f97fb271e3 scripts: fix shellcheck SC2046 warnings
Also:
- use more `--` end-of-options markers.
- checksrc.sh: use literal quotes.

Closes #1739
2025-11-10 19:06:10 +01:00
Viktor Szakats
26a78929ce GHA/dependabot: group updates, other tidy-ups 2025-11-02 17:45:02 +01:00
Viktor Szakats
455f062236 GHA: run fuzzer on master commits, bump upload-artifacts
Also adjust formatting to match curl workflows.

Closes #1736
2025-10-25 00:51:35 +02:00
Viktor Szakats
d4ebb524c5 GHA: replace deprecated set-output command with $GITHUB_OUTPUT
Fixing:
```
Image build and push
The `set-output` command is deprecated and will be disabled soon. Please upgrade
to using Environment Files. For more information
see: https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/
```
Ref: https://github.com/libssh2/libssh2/actions/runs/18667440406

Ref: https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/
Ref: https://docs.github.com/en/actions/reference/workflows-and-actions/workflow-commands#environment-files

Closes #1735
2025-10-24 14:36:51 +02:00
Viktor Szakats
da6dec9319 GHA: set concurrency, zizmor Dependabot, set cooldown
Closes #1734
2025-10-24 14:27:34 +02:00
Viktor Szakats
3969991b68 cmake: small tidy-ups
- say "Absolute path" for include and library paths in Find modules.
- flatten an if tree.
- fix a typo in comment.

Closes #1732
2025-10-21 01:09:36 +02:00
Will Cosgrove
4ed26f5740 Fix sftp_symlink when getting SSH_FXP_STATUS response (#1731)
Move advancing past packet ID before reading the FXP_STATUS response.
2025-10-20 14:04:52 -07:00
Viktor Szakats
8dd9da3261 GHA: drop HOMEBREW_NO_AUTO_UPDATE=1 [ci skip]
Doesn't seem to be fixing the initial delay.

Follow-up to ec5ba06276 #1678
2025-10-20 15:07:03 +02:00
Viktor Szakats
bb7b68dee8 build: quote a cmake variable, drop redundant step in Cygwin CI jobs
Drop the `git config --global core.autocrlf input` step in Cygwin jobs.
It's no longer necessary. Also saving ~10 seconds per job.

Quote the cmake variable for consistency.

Closes #1730
2025-10-19 23:04:04 +02:00
Viktor Szakats
16ce0ec89b mbedtls: fix using garbage value (reported by clang-tidy)
In `_libssh2_mbedtls_pub_priv_key()` on a NON-error code path, a stack
variable was checked without initializing it first.

I found it interesting that clang-tidy did not find this when building
against the system mbedtls (2.x) with 2.x compatibility code still in.
Then it did find it when using a manual build of mbedtls 3.1.0 with
2.x compatibility code deleted from libssh2. Being such a trivial error
I wonder why no compiler ever detected it as a regular warning.

linux (clang-tidy, amd64, mbedTLS-prev [3.1.0], cmake, ON):
```
src/mbedtls.c:744:8: error: Branch condition evaluates to a garbage value [clang-analyzer-core.uninitialized.Branch,-warnings-as-errors]
  744 |     if(ret) {
      |        ^
```
Ref: https://github.com/libssh2/libssh2/actions/runs/18620615649/job/53091295760#step:22:44

Follow-up to 186f1a2d75 #132
Cherry-picked from #1727
Closes #1729
2025-10-18 23:59:26 +02:00
Viktor Szakats
7c92792fed GHA: bump crypto lib dependencies
Closes #1728
2025-10-18 11:03:26 +02:00
Viktor Szakats
6c6ea30d3d GHA/dependabot: minor fixes to prev
Follow-up to d223094467 #1724
2025-10-14 11:39:20 +02:00
Viktor Szakats
557611f92b checksrc: update, update local config, fix toctou in examples
Closes #1719
2025-10-14 03:29:05 +02:00
dependabot[bot]
45d52d16c3 GHA: bump components
- bump debian from `c99c733` to `1caf1c7` in /tests/openssh_server
- bump github/codeql-action from 4.30.7 to 4.30.8

Closes #1726
Closes #1725
2025-10-14 03:24:42 +02:00
Viktor Szakats
d1ba043d0a GHA/dependabot: fix Dockerfile path
Follow-up to d223094467 #1724
2025-10-14 02:55:40 +02:00
Viktor Szakats
d223094467 Dockerfile: pin Debian trixie image, enable Dependabot
- pin Debian trixie Docker image to hash.
- set Dependabot to update the pin once every month.
- set Dependabot commit message prefixes to `GHA:` (to match curl).

Closes #1724
2025-10-14 02:39:15 +02:00
Viktor Szakats
51f6259d18 GHA: stop running tests with Libgcrypt
Tests started failing after touching `sshd_config`, which bumped
the test container from Debian Bookworm to Trixie, and openssh-server
from 9.2p1 to 10.0p1 with it. OpenSSH v10 no longer supports legacy KEX
algos `diffie-hellman-group*` and `diffie-hellman-group-exchange-*`,
making libssh2 require ECDSA or ED25519 to enable `curve25519-sha256*`
or `ecdh-sha2-*`, for the tests to succeed.

libgcrypt, stock Ubuntu wolfSSL, and WinCNG CI jobs broke.

- ED25519 is only supported with OpenSSL and LibreSSL 3.7+.
- ECDSA is supported by OpenSSL and mbedTLS (unless disabled),
  by wolfSSL in certain cases (but not on Ubuntu 24.04 with the stock
  v5.6.6 build), and by WinCNG when explicitly enabled, and targeting
  Windows 10/2016 Server.

Fixed by:

- wolfSSL support received an ECDSA detection fix, that resolved
  the issue with the stock Ubuntu builds, via:
  b807dac921 #1723

- WinCNG had ECDSA enabled in CI in the job running tests, via:
  0f5843874b #1721

- to make CI pass, disable running tests with Libgcrypt in this patch.

An alternate option is to downgrade to Bookworm, with the undesired
effect that its openssh-server doesn't support ML-KEM and other modern
SSH features, meaning those could not be tested once implemented in
libssh2, e.g. in #1644.

Ref: https://www.openssh.com/txt/release-10.0
Ref: https://packages.debian.org/trixie/openssh-server
Ref: https://packages.debian.org/bookworm/openssh-server
Ref: https://packages.ubuntu.com/noble/libwolfssl-dev

Bug: https://github.com/libssh2/libssh2/pull/1718#issuecomment-3397142351
Follow-up to 4f9e6e0bfb #1718

Closes #1720
2025-10-14 01:46:26 +02:00
Viktor Szakats
b807dac921 wolfssl: fix detecting ECDSA support
Use `HAVE_ECC` as an indicator for ECDSA when building with wolfSSL.

Before this patch the OpenSSL macros were used, in particular
`OPENSSL_NO_EC`, which made ECDSA support disabled with certain
wolfSSL build configurations, e.g. the Ubuntu 24.04 one.

ECDSA is necessary to run tests with OpenSSH v10, e.g. on Debian Trixie.

Follow-up to b95e758239 #666
Ref: #1720
Closes #1723
2025-10-14 01:04:13 +02:00
Viktor Szakats
f2838c7674 cmake: link wolfSSL macOS/Unix system lib dependencies
To support linking wolfSSL statically.

Closes #1722
2025-10-14 00:13:30 +02:00