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

2860 Commits

Author SHA1 Message Date
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
Viktor Szakats
53d9c1a658 ci/appveyor: re-enable OpenSSL 3, also bump to 3.2.1 (#1363)
Ref: 104744f4a5 #1348
2024-04-09 18:36:29 +02:00
Viktor Szakats
0e458b3781 ci: use a better test timestamp [ci skip]
Mar 27 2024 08:00:00 GMT+0000

Follow-up to 2d765e454d #1360
2024-04-09 14:16:35 +00:00
Viktor Szakats
a86e27e8ae ci: verify build and install from tarball (#1362)
Install verification based on:
28c5ddf13a/scripts/installcheck.sh
2024-04-09 15:17:53 +02:00
Viktor Szakats
7aa6cba038 tidy-up: dir names, command-line [ci skip]
Follow-up to 2d765e454d #1360
2024-04-09 12:53:04 +00:00
Viktor Szakats
03547cb8a8 cmake: tidy up function name casing in CopyRuntimeDependencies.cmake
Use lowercase to match callers.
2024-04-09 09:55:04 +00:00
Viktor Szakats
2d765e454d ci: add reproducibility test for maketgz (#1360) 2024-04-09 11:47:15 +02:00
Viktor Szakats
9dbc9e2f8c maketgz: add reproducible dir entries to tarballs
In the initial implementation of reproducible tarballs, they were
missing directory entries, while .zip archives had them. It meant
that on extracting the tarball, on-disk directory entries got the
current timestamp.

This patch fixes this by including directory entries in the tarball,
with reproducible timestamps. It also moves sorting inside tar,
to ensure reproducible directory entry timestamps on extract
(without the need of `--delay-directory-restore` option, when
extracting with GNU tar. BSD tar got that right by default.)

GNU tar 1.28 (2014-07-28) introduced `--sort=`.

Follow-up to d52fe1b435 #1357
Closes #1359
2024-04-09 09:15:12 +00:00
Viktor Szakats
fb8ce480df ci/GHA: improve version number in maketgz test
Follow-up to cba7f97506 #1353
2024-04-09 09:14:44 +00:00
Michael Buckley
95c824d5d9 src: check the return value from _libssh2_bn_*() functions (#1354)
Found by oss-fuzz. In `diffie_hellman_sha_algo()`, we were calling
`_libssh2_bn_from_bin()` with data recieved by the server without
checking whether that data was zero-length or ridiculously long.
In the OpenSSL backend, this would cause `_libssh2_bn_from_bin()`
to fail an allocation, which would eventually lead to a NULL
dereference when the bignum was used.

Add the same check for `_libssh2_bn_set_word()` and
`_libssh2_bn_to_bin()`.
2024-04-08 23:14:59 +02:00
Viktor Szakats
d52fe1b435 maketgz: reproducible tarballs/zip, display tarball hashes
- support `SOURCE_DATE_EPOCH` for reproducibility.
- make tarballs reproducible.
- make file timestamps in tarball/zip reproducible.
- make directory timestamps in zip reproducible.
- make timestamps of tarballs/zip reproducible.
- make file order in tarball/zip reproducible.
- use POSIX ustar tarball format to avoid supply chain vulnerability: https://seclists.org/oss-sec/2021/q4/0
- make uid/gid in tarball reproducible.
- omit owner user/group names from tarball for reproducibility and privacy.
- omit current timestamp from .gz header for reproducibility.
- display SHA-256 hashes of produced tarballs/zip. (Requires `sha256sum`)
- re-sync formatting with curl's `maketgz`.

Closes #1357
2024-04-08 08:31:49 +00:00
Viktor Szakats
cba7f97506 maketgz: set -eu, reproducibility, improve zip, add CI test
- set bash `-eu`.
- fix bash `-eu` issues.
- apply `TZ=UTC` and `LC_ALL=C` for reproducibility.
- sort `.zip` entries for reproducibility.
- zip with `--no-extra` for reproducibliity.
- use maximum zip compression.
- add the gpg sign command-line. Copied from curl.
- add CI test for `maketgz`.

Closes #1353
2024-04-04 16:56:17 +00:00
Viktor Szakats
fe11615a31 RELEASE-NOTES: sync and cleanups [ci skip] 2024-04-04 09:44:01 +00:00
Tejaswikandula
3a6ab70dcf Support RSA SHA2 cert-based authentication (rsa-sha2-512_cert and rsa-sha2-256_cert) (#1314)
Replicating OpenSSH's behavior to handle RSA certificate authentication
differently based on the remote server version.

1. For OpenSSH versions >= 7.8, ascertain server's support for RSA Cert
   types by checking if the certificate's signature type is present in
   the `server-sig-algs`.

2. For OpenSSH versions < 7.8, Set the "SSH_BUG_SIGTYPE" flag when the
   RSA key in question is a certificate to ignore `server-sig-algs` and
   only offer ssh-rsa signature algorithm for RSA certs.

This arises from the fact that OpenSSH versions up to 7.7 accept
RSA-SHA2 keys but not RSA-SHA2 certificate types. Although OpenSSH <=7.7
includes RSA-SHA2 keys in the `server-sig-algs`, versions <=7.7 do not
actually support RSA certs. Therefore, server sending RSA-SHA2 keys in
`server-sig-algs` should not be interpreted as indicating support for
RSA-SHA2 certs. So, `server-sig-algs` are ignored when the RSA key in
question is a cert, and the remote server version is 7.7 or below.

Relevant sections of the OpenSSH source code:
                                                                                          
<https://github.com/openssh/openssh-portable/blob/V_8_9_P1/sshconnect2.c#L1191-L1197>     
<https://github.com/openssh/openssh-portable/blob/master/compat.c#L43>                    
                                                                                          
Assisted-by: Will Cosgrove                                                                
Reviewed-by: Viktor Szakats
2024-04-03 17:55:48 +02:00
Viktor Szakats
1a74775f3e RELEASE-NOTES: sync [ci skip]
Also fix to include 3-digit issue/PR references.
2024-04-03 13:36:06 +00:00
Viktor Szakats
2e4c5ec462 mbedtls: add workaround + FIXME to build with 3.6.0
This is just a stub to make `_libssh2_mbedtls_ecdsa_new_private`
compile.

mbedtls 3.6.0 silently deleted its public API `mbedtls_pk_load_file`,
which this function relies on.

Closes #1349
2024-04-03 13:28:49 +00:00
Viktor Szakats
104744f4a5 ci/appveyor: OpenSSL 3 no longer found by CMake, revert to 1.1.1 (#1348)
Ref: 702e8cdca0
Ref: https://github.com/appveyor/build-images/pull/149
2024-04-03 13:20:43 +02:00
Viktor Szakats
581b72aab7 docs: improve libssh2_userauth_publickey_from* manpages
Reported-by: Lyndon Brown
Assisted-by: Ryan Kelley
Fixes #652
Closes #1308
Closes #xxxx
2024-04-03 11:16:08 +00:00
Viktor Szakats
43983f8709 RELEASE-NOTES: sync [ci skip] 2024-04-03 02:12:56 +00:00