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

182 Commits

Author SHA1 Message Date
dependabot[bot]
a0dafb3197 ci/GHA: bump actions
actions/upload-artifact from 4.6.1 to 4.6.2
cygwin/cygwin-install-action from 5 to 6
msys2/setup-msys2 from 2.26.0 to 2.29.0

Closes #1649
Closes #1650
Closes #1651
2025-09-09 11:29:06 +02:00
Viktor Szakats
60c528be07 ci/GHA: enable Dependabot to bump GitHub Actions 2025-09-09 09:19:22 +02:00
Viktor Szakats
2fcba30a7e GHA: stay on windows-2022 runners
windows-latest is soon to bump to window-2025. windows-2025 drops
the fast D: drive and becomes slower overall. Stay on 2022.

Closes #1645
2025-08-30 11:30:54 +02:00
Viktor Szakats
0ec6b3e842 GHA: bumps, delete two jobs with fallouts
Bump GHA actions and locally built crypto libs to their latest versions.

Also delete:

- linux autotools libgcrypt i386 job that started failing
  around 2 weeks ago, unrelated to any recent libssh2 changes.
  Good: https://github.com/libssh2/libssh2/actions/runs/16805274874/job/47596007399
  Bad: https://github.com/libssh2/libssh2/actions/runs/16900307497/job/47877965823
  ```
  # TOTAL: 43
  # PASS:  8
  # SKIP:  0
  # XFAIL: 0
  # FAIL:  35

  FAIL: test_aa_warmup
  ====================
  [...]
  ```

- OmniOS job which started failing after bumping in this PR from
  vmactions/omnios-vm@16b5996777 # v1
  to
  vmactions/omnios-vm@c31844c7ab # v1
  ```
  1..2
  libssh2_userauth_list failed (0):
  ok 1 - sshd-test_ssh2
  PASS: test_sshd.test 1 - sshd-test_ssh2
  not ok 2 - sshd-test_auth_pubkey_ok_ed25519
  FAIL: test_sshd.test 2 - sshd-test_auth_pubkey_ok_ed25519
  ```

Closes #1642
2025-08-24 17:23:27 +02:00
Viktor Szakats
714fa876ee cmake: make the ExternalProject test work
By micromanaging the project dependency and its inclusion into the test
project. It feels like an awkward construct, but perhaps better than
nothing.

It's also fragile because it's a static build with no assistance from
the external project (curl in this case). Mitigated in test by disabling
all dependencies and some features.

Since there is no special core cmake logic to be tested here, in CI
the test is tested really. To keep CI jobs at minimum, only add 3 of
them, taking 26s in total. (All 6 would take 203s.)

Follow-up to 77df767784 #1589

Closes #1637
2025-08-07 10:38:18 +02:00
Viktor Szakats
dfe7aca9b0 ci/GHA: allow more time for 'CM integration' job
Sometime 5 minutes wasn't enough for the Windows platform.

Ref: https://github.com/libssh2/libssh2/actions/runs/16251541971/job/45881908411?pr=1622
Ref: https://github.com/libssh2/libssh2/actions/runs/15478243283/job/43578759660?pr=1600
2025-07-13 19:25:17 +02:00
Viktor Szakats
e62a72b22f ci/GHA: move CI checks to Linux, other CI tweaks
Also:
- merge CI check and shellcheck jobs into a single one.
  To share the same shellcheck version and less overhead.
- use `set -eu` in more scripts.
- make sure CI scripts run from any cwd.
  To make it easy to run them on local machine.
- minor tidy-ups.

Closes #1618
2025-07-13 11:21:39 +02:00
Viktor Szakats
339ea0f61f GHA: fix new zizmor warnings
Also:
- fix old yamllint warnings.
- make quoting more consistent.
- drop stray step name: "checkout".
- merge REUSE workflow into main CI one.

Closes #1614
2025-07-02 11:03:41 +02:00
Viktor Szakats
694b9d964b cmake: add linter, fix issues
Ref: https://cmake-format.readthedocs.io/en/latest/cmake-lint.html
Ref: https://github.com/cheshirekow/cmake_format

Closes #1610
2025-06-11 07:09:10 +02:00
Viktor Szakats
d7cf63bb05 GHA: fix zizmor and shellcheck warnings, verify in CI
Closes #1609
2025-06-09 16:40:26 +02:00
Viktor Szakats
201c368aa1 ci/GHA: avoid touching GITHUB_ENV
To make configuration simpler, easier to understand and possibly more
secure.

Closes #1598
2025-05-08 23:50:28 +02:00
Viktor Szakats
f522f10c2f cmake: test integration with old cmake (v3.11.4 2018-03-28)
It was an exercise to run old cmake versions in CI and in the test suite.

It also revealed that 3.7.2 2017-01-13 is too old to consume libssh2 via
`find_package()` due to:
```
CMake Error at bld-libssh2/_pkg/lib/cmake/libssh2/libssh2-config.cmake:35 (add_library):
  add_library cannot create ALIAS target "libssh2::libssh2" because target
  "libssh2::libssh2_shared" is IMPORTED.
Call Stack (most recent call first):
  CMakeLists.txt:27 (find_package)
```
The mitigation for this issue requires 3.11.

Also:
- rename a few existing envs to use the `TEST_` prefix.
- make the `find_package` test provider stage verbose.

Closes #1591
2025-05-08 15:05:07 +02:00
Viktor Szakats
77df767784 cmake: extend integration tests
- ci/GHA: add cmake integration tests for Windows.
- ci/GHA: test `add_subdirectory` with Libgcrypt.
- make them run faster with prefill, unity, Ninja, omitting curl tool.
- add support for any build configuration.
- add old-cmake support with auto-detection.
- auto-detect Ninja.
- run consumer test apps to see if they work.
  Also show the cryptography backend.
- add support for Windows.
- make it more verbose.
- re-add `ExternalProject` cmake consumer test. It's broken.
- tidy up terminology.

Cherry-picked from #1581

Closes #1589
2025-04-27 13:46:30 +02:00
Viktor Szakats
09c948c93c ci/GHA: use more Ninja
It's installed now on all GHA runners by default.

Also drop explicit installs.

Closes #1585
2025-04-25 14:59:59 +02:00
Viktor Szakats
01b8d3565e ci/GHA: skip updating man-db for faster installs (Ubuntu)
To save 5+ seconds per CI job.

Also drop `/etc/apt/sources.list.d/microsoft-prod.list`.

Closes #1584
2025-04-25 14:37:00 +02:00
Viktor Szakats
1323e17ba9 ci/GHA: move Cygwin to drive D: for install speed
Save 30-90s per job in the Cygwin install step.

Closes #1567
2025-03-24 15:26:03 +01:00
Viktor Szakats
fb7ea5d7e1 ci/GHA: add clang-tidy jobs for Linux and Windows
With their supported crypto backends.

Cherry-picked from #1561

Closes #1566
2025-03-24 15:05:31 +01:00
Viktor Szakats
15752e5f0b ci/GHA: sync linux-mingw workflow with curl
To prepare for the addition of a clang-tidy job for Windows.

Cherry-picked from #1561
2025-03-24 14:06:28 +01:00
Viktor Szakats
df0563a857 cmake: make Find modules use INTERFACE
- move dependency properties (libs, libdirs, C flags, header dirs,
  pkg-config module names) from global lists to imported target
  `INTERFACE` properties. Rework FInd modules to return their results
  like this and update the libssh2 build process to use it. It makes
  Find modules re-usable from the cmake-config script by libssh2
  consumers, to integrate with libssh2 dependencies.

- define libssh2 dependencies as "imported targets" by the name:
  `libssh2::<depname>`, e.g. `libssh2::libgcrypt`.

- cmake-config: add fall-back logic for CMake without
  CMP0099 (v3.17 2020-03-20) to set lib directories.

- generate `libssh2.pc` based on imported target properties (instead of
  global lists).

- add target property dump debug function.

- ci/GHA: also test cmake integration on macOS.

Follow-up to 96d7f404e7 #1534

Closes #1535
2025-03-19 18:31:19 +01:00
Justin Smith
d32ab16241 ci/GHA: add CI test for AWS-LC
* Adds AWS-LC (cmake, gcc, amd64) to the GitHub CI tests.
* Adds note on how to build w/ BoringSSL or AWS-LC in `INSTALL_CMAKE.md`

AWS-LC recently added CI integration tests for Libssh2 to the AWS-LC
GitHub repo to ensure that we maintain our compatibility with libssh2:
https://github.com/aws/aws-lc/pull/2222

I've verified this change by running the CI job on my fork, which
completed successfully:
https://github.com/justsmth/libssh2/actions/runs/13547314774/job/37862097664

Closes #1557
2025-03-15 03:12:38 +01:00
Viktor Szakats
5f51c7a21a ci/GHA: limit ENABLE_ECDSA_WINCNG option to WinCNG
To avoid cmake warning:
```
CMake Warning:
  Manually-specified variables were not used by the project:

    ENABLE_ECDSA_WINCNG
```
https://github.com/libssh2/libssh2/actions/runs/13126062299/job/36622533686?pr=1535#step:3:88

Follow-up to 3f98bfb090 #1368
Cherry-picked from #1535
2025-02-05 12:37:22 +01:00
Viktor Szakats
96d7f404e7 cmake: make libssh2-config work with all TLS-backends
CMake:

- Find*: set `<modulename>_FOUND` for compatibility when found via
  `pkg-config`. E.g. `MbedTLS_FOUND`.
  `find_package_handle_standard_args()` sets both `<MODULENAME>_FOUND`
  and `<Modulename>_FOUND` when detecting the dependency. Some CMake
  code relies on this and 3rd-party code may rely on it too. Make sure
  to set the latter variant when detecting the dependency via
  `pkg-config`, where we don't call
  `find_package_handle_standard_args()`.

  CMake sets these variable to `TRUE` (not `ON` or `1`). Replicate this
  for compatibility.

- libssh2-config.cmake: inherit default `LIBSSH2_USE_PKGCONFIG`.
  Follow-up to a3aa6b4ca8 #1525

- document variables consumed by `libssh2-config.cmake.in`.

- `libssh2-config.cmake`: fix to link to non-OpenSSL crypto backends.
  This is most likely not how this is supposed to be done, but better
  than failing.
  What's the canonical way to do this, and how OpenSSL and zlib does it
  is yet to be figured out.

- use `ZLIB::ZLIB` to reference zlib.
- use `IN ITEMS` where missed.
- harmonize variable dump output formats.

CMake `find_package` integration tests:

- extend to all crypto backends (was: OpenSSL).
- show libssh2 variables set by `find_package()`.
- stop building examples and tests for the consumed package.
  For performance.
- enable zlib, for coverage.
- be verbose when building the test targets.

ci/GHA:

- add packaged mbedTLS (2.x) build to Linux matrix.
- alphasort some tests.

Follow-up to d9c2e550ca #1460
Follow-up to 82b09f9b3a #1322

Closes #1534
2025-02-04 00:39:38 +01:00
Viktor Szakats
6443b2f9d0 ci/GHA: bump BoringSSL
Also replace manual `-fPIC` C flag with
`-DCMAKE_POSITION_INDEPENDENT_CODE=ON`. It makes it pass it to C++,
which is necessary for BoringSSL after this bump.

Fixes:
```
/usr/bin/ld: /home/runner/usr/lib/libcrypto.a(crypto.cc.o): warning: relocation against `stderr@@GLIBC_2.2.5' in read-only section `.text'
/usr/bin/ld: /home/runner/usr/lib/libcrypto.a(urandom.cc.o): relocation R_X86_64_PC32 against symbol `stderr@@GLIBC_2.2.5' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: final link failed: bad value
```
https://github.com/libssh2/libssh2/actions/runs/13065421829/job/36456862458#step:27:23

Closes #1530
2025-01-31 04:19:26 +01:00
Viktor Szakats
7d5a4c7651 cmake: split integration tests into steps
Closes #1529
2025-01-31 04:19:25 +01:00
Viktor Szakats
2da28146a0 openssl: make it compatible with wolfSSL built without OPENSSL_ALL
Cherry-picked from #1484
2025-01-31 01:50:15 +01:00
Viktor Szakats
008e82c0f8 ci/GHA: general maintenance, security, add LibreSSL and old OpenSSL jobs with tests
- add Linux jobs with old OpenSSL versions: 1.1.1, 1.1.0, 1.0.2, with
  tests.
  (Meaning we test these again after losing them in AppVeyor CI)
- add LibreSSL Linux job with tests.
- cache most dependency packages built from source.
  (exception: wolfSSL, which would have added too much complexity
  due to the multiple versions, and it's fast to build anyway.)
- change source tarball sources to GitHub for better stability and
  performance.
- move dependency versions to the env.
- set `persist-credentials: false` for checkout steps for security.
- pin actions to hash for security.
- checkout repo later, right before use.
- skip building BoringSSL tests to finish quicker.
- set `fail-fast: false` in the BSD build matrix.
- cmake: move UWP workaround from GHA to `CMakeLists.txt`, making it
  available for everyone.
- list installed packages in OpenBSD job.
- bump BoringSSL, mbedTLS, wolfSSL, OpenSSL.
- bump cross-platform-actions to v0.26.
- bump docker/build-push-action to v6.
- bump actions/upload-artifact to v4.
- bump NetBSD to 10.1.
- drop `--quiet 2` `apt-get` option to keep useful output.
- drop `--no-install-suggests --no-install-recommends` `apt-get`
  options. They are the defaults with the `ubuntu-24.04` image.
- tidy up quotes.

Cherry-picked from #1484

Closes #1528
2025-01-31 01:48:39 +01:00
Viktor Szakats
854cfa8292 build: prepare builds for clang-cl, add cmake ossfuzz support
- cmake: add support to build ossfuzz.
  Enable with `-DBUILD_OSSFUZZ=ON`.
  Also supports `-DLIB_FUZZING_ENGINE=` like autotools does.
- check for `__clang__` when suppressing warnings in source. Necessary
  for clang-cl, which set `__clang__`, but doesn't set `__GNU__`.
- cmake: optimize out 4 picky warning option detections with gcc.
- cmake: bring `-pedantic-error`, `-Wall` use closer to curl's.
- cmake: set `-Wno-language-extension-token` for clang-cl.
- cmake: escape only the necessary `-W` options for clang-cl.
- cmake: apply picky warnings to C++.
- cmake: replace `unset(VAR)` with `set(VAR "")` for init.
- cmake: prefer dash-style MSVC options.
- cmake: simplify `MATCHES` expression.
- cmake: formatting/whitespace.
- ci/GHA: bump `actions/upload-artifact` to v4

Closes #1524
2025-01-30 22:01:49 +01:00
Viktor Szakats
bc78138371 ci/GHA: bump to cygwin v5 (#1512) 2025-01-07 11:09:33 +01:00
Viktor Szakats
389d70bfeb cmake: tidy up -j make option in integration tests (#1509) 2025-01-04 23:24:51 +01:00
Viktor Szakats
91b0e09934 tidy-up: spelling [ci skip] 2024-10-31 21:19:43 +01:00
Viktor Szakats
d01680ca09 ci/GHA: make apg-get install faster, drop a workaround
- always pass `--no-install-suggests --no-install-recommends`
  to `apt-get` to avoid spending time to install packages we don't need.
  (notably in the i386 Linux job.)

- drop an `apt-get` hack that's no longer necessary.

Closes #1476
2024-10-23 01:15:07 +02:00
Viktor Szakats
9d6836e098 ci/GHA: adjust job for Ubuntu 24.04 image
Closes #1470
2024-10-21 11:55:29 +02:00
Viktor Szakats
45064137ac cmake: sync and improve Find modules, add pkg-config native detection
- sync code between Find modules.
- wolfssl: replace `pkg-config` hints with native detection.
- libgcrypt, mbedtls: add `pkg-config`-based native detection.
- libgcrypt: add version detection.
- limit `pkg-config` use for `UNIX`, vcpkg, and non-cross MinGW builds,
  and builds with no manual customization via `*_INCLUDE_DIR` or
  `*_LIBRARY`.
- replace and sync Find module header comments.
- ci: delete manual mbedTLS config that's now redundant.

Based on similar work done in curl.

Second attempt at #1420
Closes #1445
2024-10-05 20:59:27 +02:00
Viktor Szakats
20ad047df5 ci: use Ninja with cmake
Closes #1458
2024-09-27 20:52:09 +02:00
Viktor Szakats
b7ab0faa70 disable DSA by default
Also:
- add `LIBSSH2_DSA_ENABLE` to enable it explicitly.
- test the above option in CI.
- say 'deprecated' in docs and public header.
- disable DSA in the CI server config.
  (OpenSSH 9.8 no longer builds with it by default)
  https://www.openssh.com/txt/release-9.8
  Patch-by: Jose Quaresma
- disable more DSA code when not enabled.

Fixes #1433
Closes #1435
2024-07-30 22:59:02 +02:00
Viktor Szakats
c905bfd27c tidy-up: link updates (#1434) 2024-07-30 19:35:38 +02:00
Marc Hoersken
e4c042f6c2 ci/GHA: revert concurrency and improve permissions
Statuses are per AppVeyor event and commit, not pull-request.
Also align permissions approach with curl, least priviledge.

Partially reverts b08cfbc99f.
2024-07-27 20:50:42 +02:00
Seo Suchan
1628f6cab8 mbedtls: expose mbedtls_pk_load_file() for our use
While it's moved to pk_internal, it won't removed in mbedTLS 3.6 LTS
so it's safe to redeclare it on our side to find it.

This is implementing emergency fix suggested from
2e4c5ec462 (commitcomment-141379351)

Follow-up to e973493f99 #1393
Follow-up to 2e4c5ec462 #1349
Closes #1421
2024-07-13 17:47:53 +02:00
Viktor Szakats
42ef8f3f0b ci/GHA: simplify mbedTLS build hack for autotools (#1425)
Follow-up to e973493f99 #1393
2024-07-13 11:40:07 +02:00
Viktor Szakats
ae04b1b953 ci/GHA: FreeBSD 14.1, actions bump (#1424) 2024-07-12 01:54:26 +02:00
Viktor Szakats
c6d42df5d3 ci/GHA: tidy up casing [ci skip] 2024-07-10 00:29:00 +02:00
Viktor Szakats
70b8bf314c REUSE: upgrade to REUSE.toml
Closes #1419
2024-07-05 15:13:18 +02:00
Viktor Szakats
a5b0fac292 wolfssl: fix EVP_Cipher() use with v5.6.0 and older
Add workaround for the wolfSSL `EVP_Cipher(*p, NULL, NULL, 0)` bug to
make libssh2 work with wolfSSL v5.6.0 and older.

wolfSSL fixed this issue in v5.7.0:
https://github.com/wolfSSL/wolfssl/pull/7143
b0de0a1c95

Without our local workaround:

- v5.3.0 and older fail most tests:
  Ref: https://github.com/libssh2/libssh2/actions/runs/9646827522/job/26604211476#step:17:1263

- v5.4.0, v5.5.x, v5.6.0 fail these:
  ```
  29 - test_read-aes128-cbc (Failed)
  30 - test_read-aes128-ctr (Failed)
  32 - test_read-aes192-cbc (Failed)
  33 - test_read-aes192-ctr (Failed)
  34 - test_read-aes256-cbc (Failed)
  35 - test_read-aes256-ctr (Failed)
  ```
  Ref: https://github.com/libssh2/libssh2/actions/runs/9646827522/job/26604233819#step:17:978

Oddly enough the workaround breaks OpenSSL tests, so only enable it for
the affected wolfSSL versions.

Also add new build-from-source wolfSSL CI job to test the new codepath.

wolfSSL has a build bug where `wolfssl/options.h` and
`wolfssl/version.h` are not copied to the `install` destination with
autotools. With CMake it has a different bug where `wolfcrypt/sp_int.h`
is not copied (with v5.4.0). And another with CMake where `FIPS_mode()`
remains missing (with v5.6.0 and earlier.)

Therefore use CMake with v5.5.4 and a workaround for `FIPS_mode()`.
Another option is autotools with v5.4.0 and a workaround for `install`,
but CMake builds quicker.

Regression-from 3c953c05d6 #797
Fixes #1020
Fixes #1299
Assisted-by: Michael Buckley via #1394
Closes #1394 (another attempt to fix the mentioned wolfSSL bug)
Closes #1407
2024-06-24 17:01:39 +02:00
Viktor Szakats
1c0b07a726 ci/GHA: fix wolfSSL-from-source AES-GCM tests
Turns out these tests:
```
31 - test_read-aes128-gcm@openssh.com (Failed)
36 - test_read-aes256-gcm@openssh.com (Failed)
```
were failing because AES-GCM wasn't enabled in libssh2. This in turn
happened because the `WOLFSSL_AESGCM_STREAM` macro wasn't enabled while
building wolfSSL. Which happened because this macro isn't enabled by
any CMake-level wolfSSL option. Passing it as `CPPFLAGS` fixes it.

This allows enabling tests with wolfSSL 5.7.0.

Follow-up to d4cea53f53 #1408
Closes #1409
2024-06-22 01:56:17 +02:00
Viktor Szakats
d4cea53f53 ci/GHA: add Linux job with latest wolfSSL built from source
After this patch it's possible to run tests with wolfSSL 5.7.0.

wolfSSL 5.7.0 fixes this bug that affects open issues #1020 and #1299:
https://github.com/wolfSSL/wolfssl/pull/7143

`-DWOLFSSL_OPENSSLALL=ON` is necessary for `wolfSSL_FIPS_mode()`

Closes #1408
2024-06-22 00:52:47 +02:00
Viktor Szakats
2c63303384 ci/GHA: tidy up build-from-source steps [ci skip]
- make curl downloads less verbose.

- fix cmake warning:
  ```
  CMake Warning:
    No source or binary directory provided.  Both will be assumed to be the
    same as the current working directory, but note that this warning will
    become a fatal error in future CMake releases.
  ```
  Ref: https://github.com/libssh2/libssh2/actions/runs/9509866494/job/26213472410#step:5:32
2024-06-22 00:29:25 +02:00
Viktor Szakats
dab48398b9 ci/GHA: show configure logs on failure and other tidy-ups
- dump cmake error log on configure failure. (for cmake 3.26 and newer)
- dump `config.log` on autotools configure failure.
- convert specs filename to Windows format before passing to CMake.
- add missing quotes.

Closes #1403
2024-06-05 14:05:03 +02:00
Viktor Szakats
6f3d3bc8ff ci/GHA: bump parallel jobs to nproc+1
Ref: https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners/about-github-hosted-runners#standard-github-hosted-runners-for-public-repositories

Closes #1402
2024-06-04 23:26:53 +02:00
Viktor Szakats
b8ffa7a56d ci/GHA: show test logs on failure
Closes #1401
2024-05-31 22:34:23 +02:00
Viktor Szakats
50143d5867 ci/GHA: use ubuntu-latest with OmniOS job
It's the same as ubuntu-22.04.

Also update OmniOS package search link.
2024-05-30 12:12:20 +02:00