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

2878 Commits

Author SHA1 Message Date
Viktor Szakats
5cab802c55 wolfssl: bump version in upstream issue comment [ci skip] 2024-06-24 15:00:29 +02:00
Viktor Szakats
260a721cbe wolfssl: require v5.4.0 for AES-GCM
Earlier versions crash while running tests.

This patch is part of a series of fixes to make wolfSSL AES-GCM support
work together with libssh2.

Possibly related is this wolfSSL bugfix patch, released in v5.4.0:
https://github.com/wolfSSL/wolfssl/pull/5205
fb3c611275
"Fix another AES-GCM EVP control command issue"

Ref: #1020
Ref: #1299
Cherry-picked from #1407
Closes #1411
2024-06-24 14:59:02 +02:00
Viktor Szakats
fbd9d19279 tests: fix excluding AES-GCM tests
Replace hard-coded crypto backends and rely on `LIBSSH2_GCM` macro
to decide whether to run AES-GCM tests.

Without this, build attempted to run AES-GCM tests (and failed)
for crypto backends that have conditional support for this feature, e.g.
wolfSSL without the necessary features built-in
(as in before Homewbrew wolfssl 5.7.0_1, or OpenSSL v1.1.0 and older).

This patch is part of a series of fixes to make wolfSSL AES-GCM support
work together with libssh2.

Cherry-picked from #1407
Closes #1410
2024-06-24 14:39:31 +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
Adam
ac2e8c73b1 src: fix type warning in libssh2_sftp_unlink macro
The `libssh2_sftp_unlink` macro was implicitly casting the `size_t`
returned by `strlen` to the `unsigned int` type expected by
`libssh2_sftp_unlink_ex`.

This fix adds an explicit cast to match similar macro definitions in
the same file (e.g. `libssh2_sftp_rename`, `libssh2_sftp_mkdir`).

Closes #1406
2024-06-14 04:47:44 +02:00
Viktor Szakats
c149a12721 libssh2.pc: reference mbedcrypto pkgconfig
mbedtls 3.6.0 got pkgconfig support:
a4d17b34f3

Reference it from `libssh2.pc`.

Closes #1405
2024-06-08 02:53:20 +02:00
Viktor Szakats
792e1b6fbc tidy-up: typo in comment [ci skip] 2024-06-08 00:49:14 +02:00
Viktor Szakats
e23dea609a RELEASE-NOTES: sync [ci skip]
Also bump planned deprecation dates.
2024-06-07 00:55:18 +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
839bb84e89 ci/GHA: fix Dockerfile failing after Ubuntu package update
Likely due an upstream Ubuntu package update (requiring an apt-get
install call beforehand), tests run via autotools started failing with
no change in the libssh2 repo:
```
FAIL: test_aa_warmup
====================

Error running command 'docker build --quiet -t libssh2/openssh_server %s' (exit 256): Dockerfile:10
--------------------
   8 |      && apt-get clean \
   9 |      && rm -rf /var/lib/apt/lists/*
  10 | >>> RUN mkdir /var/run/sshd
  11 |
  12 |     # Chmodding because, when building on Windows, files are copied in with
--------------------
ERROR: failed to solve: process "/bin/sh -c mkdir /var/run/sshd" did not complete successfully: exit code: 1

Failed to build docker image
Cannot stop session - none started
Cannot stop container - none started
Command: docker build --quiet -t libssh2/openssh_server ../../tests/openssh_server
FAIL test_aa_warmup (exit status: 1)
```
Ref: https://github.com/libssh2/libssh2/actions/runs/9322194756/job/25662748095#step:11:390

Fix it by skipping `mkdir` if `/var/run/sshd` already exists.

(Why cmake-based jobs aren't affected, I don't know.)

Ref: 50143d5867 (commitcomment-142560875)
Closes #1400
2024-05-31 21:21:30 +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
Viktor Szakats
e44f041805 ci: disable dependency tracking in autotools builds
For better build performance. Dependency tracking causes a build
overhead while compiling to help a subsequent build, but in CI there is
never one and the extra work is discarded.

Closes #1396
2024-05-27 21:41:38 +02:00
Viktor Szakats
e973493f99 mbedtls: fail to compile with v3.6.0 outside CI
A compile-time failure is preferred over an unexpected one at
runtime.

The problem is silenced with a macro in CI and this macro will have
to be added to more platforms when mbedTLS v3.6.0 reaches them.

Follow-up to 2e4c5ec462 #1349
Closes #1393
2024-05-24 19:22:29 +02:00
Viktor Szakats
38e50aa06e tests: drop default cygpath option -u 2024-05-24 15:40:54 +02:00
Viktor Szakats
706ec36dc3 tidy-up: fix typo found by codespell
Ref: https://github.com/libssh2/libssh2/actions/runs/9224795055/job/25380857082?pr=1393#step:4:5
2024-05-24 15:39:23 +02:00
Viktor Szakats
3b23e039f7 ci/GHA: shell syntax tidy-up
Closes #1390
2024-05-14 14:55:14 +02:00
Viktor Szakats
64bab99e2e RELEASE-NOTES: sync [ci skip] 2024-05-11 23:28:29 +02:00
Viktor Szakats
e980af729f ci/GHA: bump NetBSD/OpenBSD, add NetBSD arm64 job
OpenBSD arm64 jobs were very slow, so skipped that.

Closes #1388
2024-05-11 01:47:29 +02:00
Viktor Szakats
d19b619070 autotools: fix to update LDFLAGS for each detected dependency
autotools lib detection routine failed to extend LDFLAGS for each
detection. This could cause successful detection of a dependency, but
later failing to use it. This did not cause an issue as long as all
dependencies lived under the same prefix, but started breaking on macOS
ARM + Homebrew where this was no longer true for mbedTLS and zlib in
particular.

Follow-up to 844115393b #1381
Follow-up to ae2770de25 #1377
Closes #1384
2024-05-08 23:44:14 +02:00
Michael Buckley
8b3c6e9dee OpenSSL 3: Fix calculating DSA public key (#1380) 2024-05-08 13:44:09 -07:00
Viktor Szakats
5953c1f153 ci/GHA: tidy-up wolfSSL autotools config on macOS
Closes #1383
2024-05-08 22:19:54 +02:00
Viktor Szakats
736e3d7d8b ci/GHA: shorter mbedTLS autotools workaround
Follow-up to 844115393b #1381
Closes #1382
2024-05-08 22:13:39 +02:00
Michael Buckley
844115393b ci: fix mbedtls runners on macOS (#1381)
Sets LDFLAGS while configuring the autoconf mbedTLS build for macOS.
2024-05-08 12:23:59 -07:00
Viktor Szakats
4c4d28a9fc RELEASE-NOTES: sync [ci skip] 2024-04-29 17:11:08 +02:00
binary1248
4858467199 wincng: fix DH_GEX_MAXGROUP set higher than supported
In 1c3a03ebc3 #493,
`LIBSSH2_DH_GEX_MAXGROUP` was introduced to specify
crypto-backend-specific modulus sizes. Unfortunately, the max size for
the wincng DH modulus was defined to 8192, probably because this is the
value most other backends support.

According to Microsoft documentation [1], `BCryptGenerateKeyPair`
currently only supports up to 4096-bit keys when the selected algorithm
is `BCRYPT_DH_ALGORITHM`. Requesting larger keys when calling
`BCryptGenerateKeyPair` in `_libssh2_dh_key_pair` always results in
`STATUS_INVALID_PARAMETER` being returned and ultimately key exchange
failing.

When attempting to connect to any server that offers 8192 bit DH, this
causes key exchange to always fail when using the wincng backend.
Reducing `LIBSSH2_DH_GEX_MAXGROUP` to 4096 fixes the issue.

[1] https://learn.microsoft.com/en-us/windows/win32/api/bcrypt/nf-bcrypt-bcryptgeneratekeypair

Closes #1372
2024-04-29 17:07:31 +02:00
Viktor Szakats
323a14b2ca build: silence warnings inside FD_SET()/FD_ISSET() macros
Use an ugly workaround to silence `-Wsign-conversion` warnings triggered
by the internals of `FD_SET()`/`FD_ISSET()` macros. They've been showing
up in OmniOS CI builds when compiling `example` programs. They also have
been seen with older Cygwin and other envs and configurations.

Also scope two related variables in examples.

E.g.:
```
../../example/direct_tcpip.c:251:9: warning: conversion to 'long unsigned int' from 'libssh2_socket_t' {aka 'int'} may change the sign of the result [-Wsign-conversion]
  251 |         FD_SET(forwardsock, &fds);
      |         ^~~~~~
../../example/direct_tcpip.c:251:9: warning: conversion to 'long unsigned int' from 'libssh2_socket_t' {aka 'int'} may change the sign of the result [-Wsign-conversion]
../../example/direct_tcpip.c:251:9: warning: conversion to 'long unsigned int' from 'long int' may change the sign of the result [-Wsign-conversion]
../../example/direct_tcpip.c:251:9: warning: conversion to 'long int' from 'long unsigned int' may change the sign of the result [-Wsign-conversion]
../../example/direct_tcpip.c:259:18: warning: conversion to 'long unsigned int' from 'libssh2_socket_t' {aka 'int'} may change the sign of the result [-Wsign-conversion]
  259 |         if(rc && FD_ISSET(forwardsock, &fds)) {
      |                  ^~~~~~~~
../../example/direct_tcpip.c:259:18: warning: conversion to 'long unsigned int' from 'libssh2_socket_t' {aka 'int'} may change the sign of the result [-Wsign-conversion]
../../example/direct_tcpip.c:259:18: warning: conversion to 'long unsigned int' from 'long int' may change the sign of the result [-Wsign-conversion]
```
Ref: https://github.com/libssh2/libssh2/actions/runs/8854199687/job/24316762831#step:3:2020

Closes #1379
2024-04-29 01:16:21 +02:00
Viktor Szakats
6556bfbd43 autotools: use AM_CFLAGS
Use `AM_CFLAGS` to pass custom, per-target C flags. This replaces using
`CFLAGS` which triggered this warning when running `autoreconf -fi`:
```
tests/Makefile.am:8: warning: 'CFLAGS' is a user variable, you should not override it;
tests/Makefile.am:8: use 'AM_CFLAGS' instead
```
(Only for `tests`, even though `example` and `src` also used this
method. The warning is also missing from curl, that also uses
`CFLAGS`.)

Follow-up to 3ec53f3ea2 #1286
Closes #1378
2024-04-26 22:58:55 +02:00
Viktor Szakats
ae2770de25 ci/GHA: fix gcrypt with autotools/macOS/Homebrew/ARM64 (#1377)
mbedtls configure fails to detect anything due to this:
```
configure:23101: gcc -o conftest -g -O2 -I/opt/homebrew/include  conftest.c  -lmbedcrypto -lz >&5
ld: library 'mbedcrypto' not found
clang: error: linker command failed with exit code 1 (use -v to see invocation)
```
2024-04-25 21:12:59 +02:00
Viktor Szakats
790b1178eb autotools: delete bogus square bracket from help text [ci skip]
Follow-up to 3f98bfb090 #1368
2024-04-25 17:33:27 +02:00
Viktor Szakats
499b27ae83 ci/GHA: fix verbose option for autotools jobs (#1376)
Also enable verbose for macOS `make` step.
2024-04-25 17:00:51 +02:00
Viktor Szakats
4fa6921413 ci/GHA: dump config.log on failure for macOS autotools jobs (#1375) 2024-04-25 16:29:49 +02:00
Viktor Szakats
0b64b30b81 ci/GHA: fix autoreconf failure on macOS/Homebrew (#1374)
By manually installing `libtool`.

```
autoreconf -fi
  shell: /bin/bash -e {0}
configure.ac:75: error: possibly undefined macro: AC_LIBTOOL_WIN32_DLL
      If this token and others are legitimate, please use m4_pattern_allow.
      See the Autoconf documentation.
configure.ac:76: error: possibly undefined macro: AC_PROG_LIBTOOL
autoreconf: error: /opt/homebrew/Cellar/autoconf/2.72/bin/autoconf failed with exit status: 1
```
Ref: https://github.com/libssh2/libssh2/actions/runs/8833608758/job/24253334557#step:4:1
2024-04-25 15:59:08 +02:00
Viktor Szakats
6128aee0d7 ci/GHA: fixup Homebrew location (for ARM runners) (#1373)
GHA macOS runners became ARM64 machines. Make the Homebrew prefix
dynamic to adapt to these installations.
2024-04-25 15:47:10 +02:00
Viktor Szakats
9d195e9502 RELEASE-NOTES: sync [ci skip] 2024-04-14 03:26:48 +00:00
Patrick Monnerat
e4c65e5b1b os400: Add two recent files to the distribution
Closes #1364
2024-04-14 03:20:23 +00:00
Viktor Szakats
3f98bfb090 wincng: add to ci/GHA, add ./configure option --enable-ecdsa-wincng
- add `./configure` option `--enable-ecdsa-wincng`

- add WinCNG autotools jobs to GHA.

- enable WinCNG ECDSA in some GHA jobs (both CMake and autotools).

Follow-up to 3e72343737 #1315
Closes #1368
2024-04-14 02:44:38 +00:00
Johannes Passing
3e72343737 wincng: add ECDSA support for host and user authentication (#1315)
The WinCNG backend currently only supports DSA and RSA. This PR
adds ECDSA support for host and user authentication.

* Disable WinCNG ECDSA support by default to maintain backward
  compatibility for projects that target versions below Windows 10.

* Add cmake option `ENABLE_ECDSA_WINCNG` to guard ECDSA support.

* Update AppVeyor job matrix to only enable ECDSA on Server 2016+
2024-04-14 04:19:17 +02:00
Viktor Szakats
1bfae57b55 ci: enable Unity mode for most CMake builds
Ref: 7129ea9ca8 #1034
Closes #1367
2024-04-14 01:54:56 +00:00
Viktor Szakats
81341e1e80 os400: fix shellcheck warnings in scripts (fixups)
- Build scripts must be executed by the os/400 shell (sh), not bash which
  is a PASE program: The `-ot` non-POSIX test extension works in os/400 as
  well. Ref: https://github.com/libssh2/libssh2/pull/1364#issue-2241646754

- Drop/fixup mods trying to make some syntax highlighters happier.

Follow-up to c6625707b9 #1358
Assisted-by: Patrick Monnerat
Closes #1364
Closes #1366
2024-04-14 01:52:11 +00:00
Viktor Szakats
8788bb90a8 cmake: style tidy-up (more)
Follow-up to 3fa5282d62 #1166
Closes #1365
2024-04-14 01:52:11 +00:00
Viktor Szakats
0af3389ee5 RELEASE-NOTES: sync [ci skip] 2024-04-11 07:59:31 +00:00
Viktor Szakats
c6625707b9 os400: fix shellcheck warnings in scripts
- use `$()` instead of backticks, and re-arrange double-quotes inside.
- add missing `|| exit 1` to `cd` calls. (could be dropped by using `set -eu`.)
- add `-n` to a few `if`s.
- shorten redirections by using `{} >` (as shellcheck recommended).
- silence warnings where variables were detected as unused (SC2034).
- a couple misc updates to silence warnings.
- switch to bash shebang for `-ot` feature.
- split two lines to unbreak syntax highlighting in my editor. (`$(expr \`, `$(dirname \`)

Also enable CI checks for OS/400 shell scripts.

Ref: d88b9bcdaf
Closes #1358
2024-04-11 07:53:42 +00:00
Viktor Szakats
6a2f5f2736 RELEASE-NOTES: sync [ci skip] 2024-04-10 01:03:17 +00:00
Viktor Szakats
d88b9bcdaf ci: add shellcheck job and script
Add FIXME for OS/400 scripts.

Cherry-picked from #1358
2024-04-10 00:49:55 +00:00
Viktor Szakats
a2ac8c55be tests: fix shellcheck issues in test_sshd.test
Cherry-picked from #1358
2024-04-10 00:45:46 +00:00
Viktor Szakats
4b3bc74961 RELEASE-NOTES: sync [ci skip] 2024-04-09 16:46:23 +00:00