1
0
mirror of https://github.com/libssh2/libssh2.git synced 2025-11-17 04:22:32 +03:00
Commit Graph

3136 Commits

Author SHA1 Message Date
Daniel Stenberg
a312b43325 RELEASE-NOTES: 1.11.1 libssh2-1.11.1 2024-10-16 10:03:11 +02:00
Viktor Szakats
e2b2c02686 RELEASE-NOTES: sync [ci skip] 2024-10-08 23:08:39 +02:00
Anders Borum
1a9e8811f7 session: support server banners up to 8192 bytes (was: 256)
If server had banner exceeding 256 bytes there wasn't enough room in
`_LIBSSH2_SESSION.banner_TxRx_banner`. Only the first 256 bytes would be
read making the first packet read fail but also dooming key exchange as
`session->remote.banner` didn't include everything.

This change bumps the banner buffer to 8KB to match OpenSSH.

Fixes #1442
Closes #1443
2024-10-08 23:04:12 +02:00
Viktor Szakats
c3d6729f90 RELEASE-NOTES: sync [ci skip] 2024-10-07 12:15:56 +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
4b5f6b1031 cmake: initialize LIBSSH2_LIBDIRS [ci skip]
Follow-up to c87f129630 #1466
2024-10-04 13:55:02 +02:00
Viktor Szakats
66f8574ec5 ci/appveyor: fix and bump OpenSSL 3 path, add path check
Follow-up to b5e68bdc37 #1461
Closes #1468
2024-10-04 13:28:04 +02:00
Viktor Szakats
a6d98fb41b cmake: link to OpenSSL::Crypto, not OpenSSL::SSL
Follow-up to 82b09f9b3a #1322
Follow-up to c84745e34e #1128
Cherry-picked from #1445
Closes #1467
2024-10-04 12:58:08 +02:00
Viktor Szakats
c87f129630 cmake: generate LIBSSH2_PC_LIBS_PRIVATE dynamically
Generate `LIBSSH2_PC_LIBS_PRIVATE` from `LIBSSH2_LIBS`.

Also add extra libdirs (`-L`) to `Libs` and `Libs.private`.

Logic copied from curl.

Closes #1466
2024-10-04 11:24:34 +02:00
Viktor Szakats
63898981cc cmake: initialize LIBSSH2_PC_REQUIRES_PRIVATE [ci skip]
Follow-up to 0fce9dcc29 #1464
2024-10-04 02:29:50 +02:00
Viktor Szakats
14b1b9d021 cmake: add comment about ibssh2.pc.in variables [ci skip] 2024-10-04 02:25:15 +02:00
Viktor Szakats
d70cee360e cmake: support absolute CMAKE_INSTALL_INCLUDEDIR/CMAKE_INSTALL_LIBDIR
in `libssh2.pc`.

Also use `${exec_prefix}` (instead of `${prefix}`) as a base for `libdir`.

Closes #1465
2024-10-04 02:21:02 +02:00
Viktor Szakats
0fce9dcc29 cmake: rename two variables and initialize them
- `LIBRARIES` -> `LIBSSH2_LIBS`
- `SOCKET_LIBRARIES` -> `LIBSSH2_LIBS_SOCKET`

Also initialize them before use.

Cherry-picked from #1445
Closes #1464
2024-10-03 21:57:48 +02:00
Viktor Szakats
b5e68bdc37 ci/appveyor: reduce test runs (workaround for infrastructure permafails)
Jobs consistently fail to connect to the test server (run in GHA) since
2024-Aug-29:
https://ci.appveyor.com/project/libssh2org/libssh2/builds/50498393

There was an earlier phase of failures one month before that, that got
fixed by increasing the wait for the server in
bf3af90b3f.

Thus, skip running tests in AppVeyor CI jobs, except: After some
experiments, it seems that running tests with the last OpenSSL job and
the last WinCrypt job _work_, which still leaves some coverage.
It remains to be seen how stable this is.

This is meant as a temporary fix till there is a solution to make all
jobs run tests reliable like up until a few months ago.

Closes #1461
2024-10-03 19:13:59 +02:00
Patrick Monnerat
40e817ff50 os400: drop vsprintf() use
Follow-up to discussion in #1457

Plus e-mail address update.

Closes #1462
2024-10-02 16:04:30 +02:00
Viktor Szakats
a8bc96c794 RELEASE-NOTES: sync [ci skip] 2024-09-30 23:39:41 +02:00
Daniel Stenberg
b942bad190 openssl: free allocated resources when using openssl3
Reproduces consistently with curl test case 638

Closes #1459
2024-09-30 11:43:18 +02:00
Viktor Szakats
1117b677a0 checksrc: update, check all sources, fix fallouts
update from curl:
cff75acfec/scripts/checksrc.pl

Closes #1457
2024-09-28 11:41:52 +02:00
Viktor Szakats
d9c2e550ca cmake: prefer find_dependency() in libssh2-config.cmake
CMake manual suggest using `find_dependency()` (over  `find_package()`)
in `config.cmake` scripts.

Ref: https://cmake.org/cmake/help/latest/module/CMakeFindDependencyMacro.html

Closes #1460
2024-09-28 11:41:48 +02:00
Viktor Szakats
20ad047df5 ci: use Ninja with cmake
Closes #1458
2024-09-27 20:52:09 +02:00
dksslq
8d3bc19b3b Fix memory leaks in _libssh2_ecdsa_curve_name_with_octal_new and _libssh2_ecdsa_verify (#1449)
Better error handling in`_libssh2_ecdsa_curve_name_with_octal_new` and `_libssh2_ecdsa_verify` to prevent leaks.

Credit: dksslq <dksslq@github.com>
2024-09-27 08:54:22 -07:00
rolag
de0048759b Fix unstable connections over nonblocking sockets (#1454)
The `send_existing()` function allows partially sent packets to be sent
fully before any further packets are sent. Originally this returned
`LIBSSH2_ERROR_BAD_USE` when a different caller or thread tried to send
an existing packet created by a different caller or thread causing the
connection to disconnect. Commit 33dddd2f8a removed the return
allowing any caller to continue sending another caller's packet. This
caused connection instability as discussed in #1397 and confused the
client and server causing occasional duplicate packets to be sent and
giving the error `rcvd too much data` as discussed in #1431. We return
`LIBSSH2_ERROR_EAGAIN` instead to allow existing callers to finish
sending their own packets.

Fixes #1397
Fixes #1431
Related #720

Credit: klux21, rolag
2024-09-27 08:52:47 -07:00
Will Cosgrove
b346541847 Prevent possible double free of hostkey (#1452)
NULL server hostkey based on fuzzer failure case.
2024-09-10 09:35:26 -07:00
Viktor Szakats
9d9ee7807d cmake: tidy up syntax, minor improvements
- make internal variables underscore-lowercase.
- unfold lines.
- fold lines setting header directories.
- fix indent.
- drop interim variable `EXAMPLES`.
- initialize some variables before populating them.
- clear a variable after use.
- add `libssh2_dumpvars()` function for debugging.
- allow to override default `CMAKE_UNITY_BUILD_BATCH_SIZE`.
- bump up default `CMAKE_UNITY_BUILD_BATCH_SIZE` to 0 (was 32).
- tidy up option descriptions.

Closes #1446
2024-09-07 21:27:55 +02:00
Viktor Szakats
570de0f23f cmake: rename mbedTLS and wolfSSL Find modules
To match the curl ones.

Cherry-picked from #1445
2024-08-18 12:57:04 +02:00
Viktor Szakats
0e9b5daa25 RELEASE-NOTES: sync [ci skip] 2024-08-13 19:40:19 +02:00
Viktor Szakats
8e3c40b2a3 cmake: fixup version detection in mbedTLS find module
- avoid warning with 2.x versions about missing header file while
  extracting the version number.

- clear temp variables.

Closes #1444
2024-08-13 19:34:25 +02:00
Viktor Szakats
814a850c97 buildconf: drop
Use `autoreconf -fi` instead.

Follow-up to fc5d77881e
Closes #1441
2024-08-07 18:19:15 +02:00
Michael Buckley
492bc543bb Implement chacha20-poly1305@openssh.com
Probably the biggest and potentially most controversial change we have
to upstream.

Because earlier versions of OpenSSL implemented the algorithm before
standardization, using an older version of OpenSSL can cause problems
connecting to OpenSSH servers. Because of this, we use the public domain
reference implementation instead of the crypto backends, just like
OpenSSH does.

We've been holding this one for a few years. We were about to upstream
it around the same time as aes128gcm landed upstream, and the two
changes were completely incompatible. Honestly, it took me weeks to
reconcile these two implementations, and it could be much better.

Our original implementation changed every crypt method to decrypt the
entire message at once. the AESGCM implementation instead went with this
firstlast design, where a firstlast paramater indicates whether this is
the first or last call to the crypt method for each message. That added
a lot of bookkeeping overhead, and wasn't compatible with the chacha
public domain implementation.

As far as I could tell, OpenSSH uses the technique of decrypting the
entire message in one go, and doesn't have anything like firstlast.
However, I could not get out aes128gcm implementation to work that way,
nor could I get the chacha implementation to work with firstlast, so I
split it down the middle and let each implementation work differently.
It's kind of a mess, and probably should be cleaned up, but I don't have
the time to spend on it anymore, and it's probably better to have
everything upstream.

Fixes #584
Closes #1426
2024-08-06 10:56:23 +02:00
Viktor Szakats
29a4b607d8 tidy-up: do/while formatting
Also fix an indentation and delete empty lines.

Closes #1440
2024-08-06 10:56:22 +02:00
Viktor Szakats
8ae1b2d742 wolfssl: drop header path hack
The wolfSSL OpenSSL headers reside in `wolfssl/openssl/*.h`.

Before this patch the wolfSSL OpenSSL compatibilty header includes were
shared with the native OpenSSL codepath, and used `openssl/*h`. For
wolfSSL builds this required a hack to append the
`<wolfssl-prefix>/wolfssl` directory to the header search path, to find
the headers.

This patch changes the source to use the correct header references,
allowing to drop the header path hack.

Also fix to use the correct variable to set up the header path in CMake:
`WOLFSSL_INCLUDE_DIRS` (was: `WOLFSSL_INCLUDE_DIR`, without the `S`)

Closes #1439
2024-08-06 10:56:22 +02:00
Viktor Szakats
6d1d13c2a6 cmake: mbedTLS detection tidy-ups
- set and use `MBEDTLS_INCLUDE_DIRS`.
- stop marking `MBEDTLS_LIBRARIES` as advanced.

Closes #1438
2024-08-06 10:56:22 +02:00
Viktor Szakats
2bb46d4481 cmake: add quotes, delete ending dirseps
Follow-up to 3fa5282d62 #1166
Closes #1437
2024-08-06 10:56:22 +02:00
Viktor Szakats
bf3af90b3f CI/appveyor: increase wait for SSH server on GHA [ci skip]
Blind attempt to make AppVeyor CI tests work again.
2024-07-30 23:35:32 +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
Will Cosgrove
a50d7debfd Always init mbedtls_pk_context (#1430)
In the failure case, mbedtls_pk_context could be free'd without first being initialized.
2024-07-23 10:32:13 -07:00
Viktor Szakats
457b02e8dd mbedtls: tidy-up (#1429) 2024-07-22 11:50:38 -07:00
Will Cosgrove
1701d5c0d3 Correctly initialize values (#1428)
Fix regression with commit from #1421
2024-07-22 09:57:24 -07:00
Viktor Szakats
c0357b73a2 RELEASE-NOTES: sync [ci skip] 2024-07-14 11:01:49 +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
Michael Buckley
9f23a3bbaf Always check for null pointers before calling _libssh2_bn_set_word (#1423) 2024-07-12 21:24:18 -07:00
Viktor Szakats
ae04b1b953 ci/GHA: FreeBSD 14.1, actions bump (#1424) 2024-07-12 01:54:26 +02:00
Michael Buckley
75de6a37cb Increase SFTP_HANDLE_MAXLEN back to 4092 (#1422)
Match OpenSSH for compatibility.
2024-07-11 13:42:00 -07:00
Viktor Szakats
c6d42df5d3 ci/GHA: tidy up casing [ci skip] 2024-07-10 00:29:00 +02:00
Viktor Szakats
420f902617 REUSE: fix typo in comment 2024-07-06 02:37:34 +02:00
Viktor Szakats
99723f07af REUSE: shorten and improve
Follow-up to 70b8bf314c #1419
2024-07-05 16:42:31 +02:00
Viktor Szakats
70b8bf314c REUSE: upgrade to REUSE.toml
Closes #1419
2024-07-05 15:13:18 +02:00