NEWS
NEWS
NEWS
pl
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.
Fixes #1442
Closes #1443
- cmake: sync and improve Find modules, add `pkg-config` native detection
Closes #1466
in `libssh2.pc`.
Closes #1465
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
bf3af90b3f1bb14cf452df7a8eb55cc9088f3e7f.
Closes #1461
Closes #1459
Closes #1457
Ref: https://cmake.org/cmake/help/latest/module/CMakeFindDependencyMacro.html
Closes #1460
Closes #1458
Fixes #1397
Fixes #1431
Related #720
Closes #1446
- avoid warning with 2.x versions about missing header file while
extracting the version number.
Closes #1444
- buildconf: drop
Follow-up to fc5d77881eb6bb179f831e626d15f4f29179aad5
Closes #1441
Implement [email protected]
Probably the biggest and potentially most controversial change we have
to upstream.
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.
Fixes #584
Closes #1426
Closes #1440
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
Closes #1438
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
https://github.com/libssh2/libssh2/commit/2e4c5ec4627b3ecf4b6da16f365c011dec9a31b4#
commitcomment-141379351
Closes #1419
If the server does not support this extension, the function returns
`LIBSSH2_FX_OP_UNSUPPORTED` and it's up to the user to recover, possibly
by calling `libssh2_sftp_rename()`.
Closes #1413
Add workaround for the wolfSSL `EVP_Cipher(*p, NULL, NULL, 0)` bug to
make libssh2 work with wolfSSL v5.6.0 and older.
https://github.com/wolfSSL/wolfssl/commit/b0de0a1c95119786cf5651dd76dd7d7bdfac5a04
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.
https://github.com/wolfSSL/wolfssl/commit/fb3c611275dfe454c331baa0818445a0406c208a
"Fix another AES-GCM EVP control command issue"
Ref: #1020
Ref: #1299
Cherry-picked from #1407
Closes #1411
- 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
Closes #1408
Closes #1406
https://github.com/Mbed-TLS/mbedtls/commit/a4d17b34f354557838e05d2cb47200e8dcaaf59b
Closes #1405
- 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
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
Closes #1401
Ref:
https://github.com/libssh2/libssh2/commit/50143d5867d35df76a6cf589ca8a13b22105aa64#
commitcomment-142560875
Closes #1400
Closes #1396
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.
Ref: https://github.com/libssh2/libssh2/actions/runs/9224795055/job/25380857082?
pr=1393#step:4:5
Closes #1390
Closes #1388
Closes #1383
Sets LDFLAGS while configuring the autoconf mbedTLS build for macOS.
In 1c3a03ebc3166cf69735111aba2b8cee57cdba51 #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.
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
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:2
020
Closes #1379
```
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
GHA macOS runners became ARM64 machines. Make the Homebrew prefix
dynamic to adapt to these installations.
Closes #1364
- enable WinCNG ECDSA in some GHA jobs (both CMake and autotools).
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.
- 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
Ref: d88b9bcdafe9d19aad2fb120d0a0acb3edab64f7
Closes #1358
Closes #1357
Closes #1353
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.
<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>
Closes #1349
Ref:
https://github.com/appveyor/build-images/commit/702e8cdca01f28f6a40687783f493c786ce
bbe2c
Ref: https://github.com/appveyor/build-images/pull/149
The unexplained CI fallouts are gone with the latest debian:testing (20240330).
Ref #1328 #1329 #1338.
Closes #1346
Closes #1343
Closes #1342
Closes #1337
Fixes #1331
Fixes #1326
A while ago the `distcheck` CI job became flaky. This continued after
switching to Debian stable (from testing). Try stabilzing it by running
it single-threaded.
Closes #1339
This fixes flakiness experienced recently with two OpenSSL jobs and one
libgcrypt job, and/or intermittently causing all Docker-based tests to
fail.
Reported-by: András Fekete
Fixes #1328
Fixes #1329
Closes #1338
Supply empty hash functions for mac_method_hmac_aesgcm to avoid a crash when e.g.
setting LIBSSH2_METHOD_CRYPT_CS (#1321)
Closes #1307
Also:
- delete unused internal macro `libssh2_md5()` where defined.
- prefix `libssh2_os400qc3_hash*()` function names with underscore.
These are public/visible, but internal.
- add FIXMEs to OS/400 code to verify update/final calls; some OS API,
some internal.
Ref: https://github.com/libssh2/libssh2/pull/1301#discussion_r1446861650
Reviewed-by: Michael Buckley
Reviewed-by: Patrick Monnerat
Closes #1303
- RELEASE-NOTES: sync [ci skip]
Closes #1306
- openssl: formatting/whitespace
Closes #1305
Before this patch, SHA2 and SHA1 init function results were cast to
`void`. This patch makes sure to verify these values.
Also:
- exclude an `assert(0)` from release builds in `_libssh2_sha_algo_ctx_init()`.
(return error instead)
- fix indentation / whitespace
The comment cited earlier is no longer true with recent CMake versions.
This options does actually enable parallel builds with MSVC since CMake
v3.26.0: https://gitlab.kitware.com/cmake/cmake/-/issues/20564
The effect isn't much for libssh2, because it spends most time in tests,
but let's enable it anyway for efficiency.
Closes #1294
Closes #1292
Closes #1279
Refs:
https://terrapin-attack.com/
https://seclists.org/oss-sec/2023/q4/292
https://osv.dev/list?ecosystem=&q=CVE-2023-48795
https://github.com/advisories/GHSA-45x7-px36-x8w8
https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2023-48795
Fixes #1290
Closes #1291
The new implementation offers the same functionality, but accepts and
returns a generic function pointer (of type `libssh2_cb_generic *`), as
opposed to the old function that used data pointers (`void *`). The new
solution thus avoids data to function (and vice versa) pointer
conversions, which has undefined behaviour in standard C.
About the name: It seems the `*2` suffix was used in the past for
replacement functions for deprecated ones. Let's stick with that.
`*_ex` was preferred for new functions that extend existing ones with
new features.
Closes #1285
https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#index-pedantic-errors-1
This option has an effect only with gcc 5.0 and newer as of this commit.
Let's enable it for clang and older versions too for simplicity. Ref:
https://github.com/curl/curl/commit/d5c0351055d5709da8f3e16c91348092fdb481aa
https://github.com/curl/curl/pull/2747
Closes #1286
Closes #1287
Ref: https://github.com/libssh2/libssh2/pull/1260#issuecomment-1837017987
Closes #1289
To avoid the log noise till we fix those ~360 compiler warnings.
Closes #1284
On Windows.
Closes #1283
Ref: https://github.com/libssh2/libssh2/pull/1241#issuecomment-1830118584
- RELEASE-NOTES: avoid splitting names, fix typo, refine order [ci skip]
Closes #1278
```
make: Fatal error in reader: Makefile, line 438: Unexpected end of line seen
```
Ref:
https://github.com/libssh2/libssh2/actions/runs/7135524843/job/19432451767#step:3:1
966
- fix error:
```
../../src/hostkey.c:1227:44: error: pointer targets in passing argument 5 of
'_libssh2_ed25519_sign' differ in signedness [-Werror=pointer-sign]
1227 | datavec[0].iov_base,
datavec[0].iov_len);
| ~~~~~~~~~~^~~~~~~~~
| |
| caddr_t {aka char *}
```
Ref:
https://github.com/libssh2/libssh2/actions/runs/7135102832/job/19431233967#step:3:2
225
https://docs.oracle.com/cd/E36784_01/html/E36887/iovec-9s.html
Handle EINTR from send/recv/poll/select to try again as the error is not fatal
fail: https://ci.appveyor.com/project/libssh2org/libssh2/builds/48678129/job/
yb8n2pox8mfjwv6m
good: https://ci.appveyor.com/project/libssh2org/libssh2/builds/48673013
This seems to be the culprit, which could mean that this update broke
CMake detection, needs a different CMake configuration on our end, or
that this MSVC update pulled support for UWP apps:
Closes #1275
Closes #1272
Delete this option from Cygwin and FreeBSD CI tests, where it caused
`make check` to do nothing. Tests are built now, and runtime tests are
too, where supported.
Also disable Docker-based tests for these, and add a missing `make -j3`
for FreeBSD.
Closes #1271
The following APIs have been deprecated for over 10 years and
use `LIBSSH2_NO_DEPRECATED` to mark them as deprecated:
libssh2_session_startup()
libssh2_banner_set()
libssh2_channel_receive_window_adjust()
libssh2_channel_handle_extended_data()
libssh2_scp_recv()
Closes #1269
- tidy-up: bump casts from int to long for large C99 types in printfs
Cast large integer types to avoid dealing with printf masks for
`size_t` and other C99 types. Some of existing code used `int`
for this, bump them to `long`.
Closes #1264
Ref:
https://best.openssf.org/Compiler-Hardening-Guides/Compiler-Options-Hardening-
Guide-for-C-and-C++.html
(2023-11-29)
Fix them in example, tests and wincng. There remain about 360 of these
warnings in `src`. Add a TODO item for those and disable `-Werror` for
this particular warning.
- enable `-Wimplicit-fallthrough`.
- enable `-Wtrampolines`.
Fix them:
Cast large types to `long` to avoid dealing with printf masks for
`size_t` and other C99 types. Existing code often used `int` for this.
I'll update them to `long` in an upcoming commit.
Closes #1257
It works with gcc without the libtool warnings seen with clang
on Windows in 96682bd5e14c20828e18bf10ed5b4b5c7543924a #1227.
Closes #1262
Closes #1261
Seems like a false positive and/or couldn't figure how to fix it, so silence:
```
example/ssh2.c:227:38: error: '%s' directive output may be truncated writing
likely 1 or more bytes into a region of size 0 [-Werror=format-truncation=]
227 | snprintf(fn1, fn1sz, "%s/%s", h, pubkey);
| ^~
example/ssh2.c:227:34: note: assuming directive output of 1 byte
227 | snprintf(fn1, fn1sz, "%s/%s", h, pubkey);
| ^~~~~~~
example/ssh2.c:227:13: note: 'snprintf' output 3 or more bytes (assuming 4) into
a destination of size 2
227 | snprintf(fn1, fn1sz, "%s/%s", h, pubkey);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
example/ssh2.c:228:38: error: '%s' directive output may be truncated writing
likely 1 or more bytes into a region of size 0 [-Werror=format-truncation=]
228 | snprintf(fn2, fn2sz, "%s/%s", h, privkey);
| ^~
example/ssh2.c:228:34: note: assuming directive output of 1 byte
228 | snprintf(fn2, fn2sz, "%s/%s", h, privkey);
| ^~~~~~~
example/ssh2.c:228:13: note: 'snprintf' output 3 or more bytes (assuming 4) into
a destination of size 2
228 | snprintf(fn2, fn2sz, "%s/%s", h, privkey);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
```
Ref:
https://github.com/libssh2/libssh2/actions/runs/7055480458/job/19205970397#step:10:
98
Fix:
```
tests/openssh_fixture.c:116:38: error: ' 2>&1' directive output may be truncated
writing 5 bytes into a region of size between 1 and 1024 [-Werror=format-
truncation=]
tests/openssh_fixture.c:116:11: note: 'snprintf' output between 6 and 1029 bytes
into a destination of size 1024
```
Ref:
https://github.com/libssh2/libssh2/actions/runs/7055480458/job/19205969221#step:10:
51
Follow-up to 9e896e1b80911a53d6aabb322e034e6ca51b6898
Follow-up to 6c84a426beb494980579e5c1d244ea54d3fc1a3f
Fixes #1235
Closes #1243
Follow-up to eee4e8055ab375c9f9061d4feb39086737f41a9c
https://github.com/openbsd/ports/commit/2c5b2f3e94381914a3e8ade960ce8c997ca9d6d7
"The old code is also broken, as it passes a pointer to a variable
of a different size (on LP64). There is no check for truncation,
but buf[] is 1MB in size."
Patch-by: naddy
```
/home/runner/work/libssh2/libssh2/example/subsystem_netconf.c:252:17: error:
'%n' format specifier support is deactivated and will call abort(3) [-Werror]
"]]>]]>\n%n", (int *)&len);
~^
/home/runner/work/libssh2/libssh2/example/subsystem_netconf.c:270:17: error:
'%n' format specifier support is deactivated and will call abort(3) [-Werror]
"]]>]]>\n%n", (int *)&len);
~^
2 errors generated.
```
Ref:
https://github.com/libssh2/libssh2/actions/runs/6991449778/job/19022024280#step:3:4
20
Also made tests with arm64, but it takes consistently almost 14m to
finish the job, vs. 2-3m for the native amd64:
https://github.com/libssh2/libssh2/actions/runs/6991648984/job/19022440525
https://github.com/libssh2/libssh2/actions/runs/6991551220/job/19022233651
Use CMake, OpenSSL (v1.1) and clang from the base install.
Underscored macros are reserved for the compiler / standard lib / etc.
Stop using them in user code.
Closes #1248
Closes #1247
Closes #1246
Closes #1245
Closes #1244
- libssh2.h: use `_WIN32` for Windows detection instead of rolling our own
Closes #1238
Fixes:
```
src/openssl.c:650:5: error: use of undeclared identifier 'EC_KEY'
EC_KEY *ec_key = EC_KEY_new_by_curve_name(curve);
^
src/openssl.c:650:13: error: use of undeclared identifier 'ec_key'
EC_KEY *ec_key = EC_KEY_new_by_curve_name(curve);
^
src/openssl.c:650:22: error: implicit declaration of function
'EC_KEY_new_by_curve_name' is invalid in C99 [-Werror,-Wimplicit-function-
declaration]
EC_KEY *ec_key = EC_KEY_new_by_curve_name(curve);
^
src/openssl.c:650:22: note: did you mean 'EC_GROUP_new_by_curve_name'?
./quictls/_a64-mac-sys/usr/include/openssl/ec.h:483:11: note:
'EC_GROUP_new_by_curve_name' declared here
EC_GROUP *EC_GROUP_new_by_curve_name(int nid);
^
In file included from
./_a64-mac-sys-bld/src/CMakeFiles/libssh2_static.dir/Unity/unity_0_c.c:19:
In file included from src/crypto.c:10:
src/openssl.c:652:8: error: use of undeclared identifier 'ec_key'
if(ec_key) {
^
```
Ref:
https://github.com/curl/curl-for-win/actions/runs/6950001225/job/18909297867#step:3
:4341
Bug #1235
Closes #1236
- openssl: formatting
Sync up these lines with the other two similar occurrences in the code.
Closes #1233
- fix Apple clang version detection for 'Apple clang version 11.0.0'
and newer where the Apple clang version was detected, instead of its
llvm/clang equivalent.
Used this collection for Apple clang / llvm/clang translation and test
inputs: https://gist.github.com/yamaya/2924292
Closes #1232
Follow-up to 8c320a93a48775b74f40415e46f84bf68b4d5ae8
Also:
- show if we detected Apple clang.
- delete duplicate version detection for clang.
Closes #1230
Closes #1227
Closes #1226
To match the camel-case style used in other CMake scripts and also
to match the name used in curl.
Closes #1225
Enable more picky compiler warnings. I've found these options in the
nghttp3 project when implementing the CMake quick picky warning
functionality for it.
- crypto.h: formatting.
Ref:
https://github.com/ngtcp2/nghttp3/blob/a70edb08e954d690e8fb2c1df999b5a056f8bf9f/
cmake/PickyWarningsC.cmake
Closes #1224
Closes #1223
Ref: https://github.com/curl/curl/blob/d1820768cce0e797d1f072343868ce1902170e93/
m4/curl-compilers.m4#L479
Closes #1222
Closes #1221
Closes #1219
Stop trying to set the version and instead rely on the action
providing the latest supported one automatically.
Follow-up to a7d2a573be26238cc2b55e5ff6649bbe620cb8d9
Also:
- add more details to the FreeBSD job description.
- bump mbedtls version while here.
Closes #1217
Also extend our integration test double inclusion. It will still not
catch this case, because that requires
`cmake_minimum_required(VERSION 3.18)` or higher.
Fixes:
```
CMake Error at .../lib/cmake/libssh2/libssh2-config.cmake:8 (add_library):
add_library cannot create ALIAS target "libssh2::libssh2" because another
target with the same name already exists.
Call Stack (most recent call first):
CMakeLists.txt:24 (find_package)
Test to reproduce:
```cmake
cmake_minimum_required(VERSION 3.18) # must be 3.18 or higher
project(test)
find_package(libssh2 CONFIG)
find_package(libssh2 CONFIG) # fails
add_executable(test main.c)
target_link_libraries(test libssh2::libssh2)
```
Ref: https://cmake.org/cmake/help/latest/release/3.18.html#other-changes
Ref: https://cmake.org/cmake/help/v3.18/policy/CMP0107.html
Closes #1216
It runs over Linux via qemu. First two runs were (very) slow, then it
became (much) more performant at just 2x slower than a native Linux
build. Then got slow again, then fast again. Still seems acceptable
for the value this adds.
Successful builds:
1. https://github.com/libssh2/libssh2/actions/runs/6802676786/job/18496286419
(13m59s, -j3)
2. https://github.com/libssh2/libssh2/actions/runs/6802976375/job/18497243225
(11m5s, -j2)
3. https://github.com/libssh2/libssh2/actions/runs/6803142201/job/18497785049
(3m6s, -j1)
4. https://github.com/libssh2/libssh2/actions/runs/6803194839/job/18497962766
(3m10s, -j2)
5. https://github.com/libssh2/libssh2/actions/runs/6803267201/job/18498208501
(3m13s)
6. https://github.com/libssh2/libssh2/actions/runs/6803510333/job/18498993698
(15m25s)
7. https://github.com/libssh2/libssh2/actions/runs/6813602863/job/18528571057
(3m13s)
Similar solution exists for Solaris (over macOS via VirtualBox), but it
hangs forever at `Waiting for text: solaris console login`:
https://github.com/libssh2/libssh2/actions/runs/6802388128/job/18495391869#step:4:1
85
https://github.com/libssh2/libssh2/actions/runs/6802976375/job/18497256437#step:10:
536
```
FAIL: test_auth_pubkey_ok_rsa_aes256gcm
```
https://github.com/libssh2/libssh2/actions/runs/6813602863/job/18528588933#step:10:
533
```
FAIL: test_read
```
Closes #1215
```
PendingDeprecationWarning:
Copyright and licensing information for 'tests/openssh_server/Dockerfile'
has been found in both 'tests/openssh_server/Dockerfile' and in the DEP5
file located at '.reuse/dep5'. The information for these two sources has
been aggregated. In the future this behaviour will change, and you will
need to explicitly enable aggregation. [...]
```
Ref:
https://github.com/libssh2/libssh2/actions/runs/6789274955/job/18456085964#step:4:4
Also:
- migrate `LIBSSH2_NO_*` option CI tests to CMake.
- make MSYS2 CMake builds verbose to show compilation options.
Closes #1204
Closes #1212
- cmake: show crypto backend in feature summary
This was visible as an enabled package before this patch, but it missed
to show WinCNG.
Closes #1211
- `- ` -> `- `
- `. ` -> `. `
- `\- ` -> `- `
- `-1` -> `\-1`
- fold long lines along the way
This makes the minus sign come out as a Unicode minus sign
(0x2212), and title separator dashes as Unicode hyphen (0x2010),
with `groff -Tutf8` v1.23.0.
Ref: https://lwn.net/Articles/947941/
Closes #1210
```
src/session.c: In function 'libssh2_poll':
src/session.c:1776:22: warning: conversion from 'long int' to
'__darwin_suseconds_t' {aka 'int'} may change value [-Wconversion]
1776 | tv.tv_usec = (timeout_remaining % 1000) * 1000;
| ^
```
Ref:
https://github.com/curl/curl-for-win/actions/runs/6711735060/job/18239768548#step:3
:4368
Follow-up to 08354e0abbe86d4cc5088d210d53531be6d8981a
Closes #1209
Manual: https://www.openssl.org/docs/man3.1/man3/BIO_reset.html
```
./quictls/linux-a64-musl/usr/include/openssl/bio.h:555:34: warning: value
computed is not used [-Wunused-value]
555 | # define BIO_reset(b) (int)BIO_ctrl(b,BIO_CTRL_RESET,0,NULL)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./libssh2/src/openssl.c:3518:5: note: in expansion of macro 'BIO_reset'
./libssh2/src/openssl.c:3884:5: note: in expansion of macro 'BIO_reset'
./libssh2/src/openssl.c:3995:5: note: in expansion of macro 'BIO_reset'
```
Ref:
https://github.com/curl/curl-for-win/actions/runs/6696392318/job/18194032712#step:3
:5060
Closes #1205
https://github.com/zlib-ng/zlib-ng/blob/61e181c8ae93dbf56040336179c9954078bd1399/
CMakeLists.txt#L7
Closes #1203
Closes #1202
Closes #1201
Closes #1200
- use shallow git clones in AppVeyor CI to save data over the wire.
Closes #1199
Instead of `WIN32`.
The compiler defines `_WIN32`. Windows SDK headers or build env defines
`WIN32`, or we have to take care of it. The agreement seems to be that
`_WIN32` is the preferred practice here.
Closes #1195
Closes #1196
- libssh2 needs the crypto lib only, stop dealing with the rest.
- simplify logic.
- drop hard-wired toolchain specific options that broke with e.g. MSVC.
Reported-by: Jack L
Fixes #1186
- Add Linux -> mingw-w64 cross-builds for autotools and CMake. This
doesn't detect #1186, because that happened when explicitly specifying
WinCNG via `--with-crypto=wincng`, but not when falling back to WinCNG
by default.
Closes #1187
Credit:
Michael Buckley, signed off by Will Cosgrove
Viktor Szakats (28 Aug 2023)
- os400qc3: move FIXME comment [ci skip]
Follow-up to eb9f9de2c19ec67d12a444cce34bdd059fd26ddc
Before this patch, this happened at runtime when using an old (pre-3.0),
FIPS-enabled OpenSSL backend.
This patch makes it possible to disable this via the build-time option
`LIBSSH2_NO_MD5_PEM`.
Also:
- make sure to exclude all MD5 internal APIs when both the above and
`LIBSSH2_NO_MD5` are enabled.
- fix tests to support build with`LIBSSH2_NO_MD5`, `LIBSSH2_NO_MD5_PEM`
and `LIBSSH2_NO_3DES`.
- add FIXME to apply this change to `os400qc3.*`.
Old-style encrypted private keys require MD5 and they look like this:
```
-----BEGIN RSA PRIVATE KEY-----
Proc-Type: 4,ENCRYPTED
DEK-Info: AES-128-CBC,<MD5-hex>
<base64>
-----END RSA PRIVATE KEY-----
```
E.g.: `tests/key_rsa_encrypted`
Ref: https://github.com/libssh2/www/issues/20
Closes #1181
Use `IN LISTS` and `IN ITEMS`. This appears to be the preferred way
within CMake's own source code and possibly improves readability.
https://cmake.org/cmake/help/v3.7/command/foreach.html
Closes #1180
Also:
- replace tab with spaces in generated config file
- formatting
Cherry-picked from #1175
Follow-up to 3fa5282d6284efba62dc591697e6a687152bdcb1
Closes #1173
Ref:
https://github.com/libssh2/www/commit/ccf4a7de7f702a8ee17e2c697bcbef47fcf485ed
Closes #1172
- cmake: add `ExternalProject` integration test
- via `ExternalProject_Add()`:
https://cmake.org/cmake/help/latest/module/ExternalProject.html
(as documented in `docs/INSTALL_CMAKE.md`)
- also make `FetchContent` fetch from local repo instead of live master.
Closes #1171
Closes #1170
- `libssh2:libssh2_static`
- `libssh2:libssh2_shared`
- `libssh2:libssh2` (shared, or static when not building shared)
- `libssh2` (shared, or static when not building shared)
Closes #1169
Follow-up to 3fa5282d6284efba62dc591697e6a687152bdcb1
Follow-up to 9cd18f4578baa41dfca197f60557063cad12cd59
Closes #1166
To match with the types used by the `Crypt*()` (uses `DWORD`) and
`BCrypt*()` (uses `ULONG`) Windows APIs.
Closes #1165
- wincng: tidy-ups
- add a newline.
Closes #1164
Use existing MSYS2 section and extend it with builds for the MSYS
environment with both autotools and cmake.
MSYS builds resemble Cygwin ones: The env is Unixy, where Windows
headers are all available but we don't use them.
Also:
Closes #1162
autotools build seemed to take slightly longer than other jobs. To save
turnaround time I disabled building tests.
[1] https://github.com/cygwin/cygwin-install-action/tree/v4#path
Closes #1161
It holds the name `libssh2`. Mainly to document its uses, and also
syncing up with the same variable in libcurl.
Closes #1159
Follow-up to 72fd25958a7dc6f8e68f2b2d5d72839a2da98f9c
Closes #1158
Closes #1157
Add a CI test for Windows UWP builds using mingw-w64. Before this patch
we had UWP builds tested with MSVC only.
Alike existing UWP jobs, it's not possible to run the binaries due to
the missing UWP runtime DLL:
https://github.com/libssh2/libssh2/actions/runs/5821297010/job/15783475118#step:11:
42
This also hit a CMake bug (with v3.26.4), where CMake gets confused and
sets up `windres.exe` to use the MSVC rc.exe-style command-line:
https://github.com/libssh2/libssh2/actions/runs/5819232677/job/15777236773#step:9:1
26
Ref: https://github.com/libssh2/libssh2/pull/1147#issuecomment-1670850890
Closes #1155
Where applicable.
This also makes it more obvious which `libssh2` uses were referring
to the project itself.
Closes #1152
This caused a CMake error instead of our custom error when manually
selecting the `WinCNG` crypto-backend for a non-Windows target.
Closes #1151
Closes #1149
Closes #1153
Ref: https://ftp.openbsd.org/pub/OpenBSD/LibreSSL/libressl-2.7.0-relnotes.txt
Ref:
https://github.com/libressl/openbsd/commit/46f29f11977800547519ee65e2d1850f2483720b
Ref: https://github.com/libssh2/libssh2/issues/302
Closes #1146
Without curly braces it was less obvious which string is a GHA expression.
Also fix an `if` expression that always missed its curly braces.
Reverts cab3db588769d6deed97ba89ca9221fd7503405e
Closes #1145
Fixes https://github.com/libssh2/libssh2/issues/773
Reported-by: mike-jumper
Before:
https://ci.appveyor.com/project/libssh2org/libssh2/builds/47668870/job/
i17e0e9yx8rgpv4i
After:
https://ci.appveyor.com/project/libssh2org/libssh2/builds/47674950/job/
ysa1jq0pxtyhui3f
Closes #1142
On a second look this change did not improve anything with autotools
builds. autotools seems to handle the dll export matter without it.
This patch also broke (e.g.) curl-for-win autotools builds, where the
curl build defines `DLL_EXPORT` while building libcurl DLL. `libssh2.h`
picks it up, resulting in unresolved symbols while trying to link a
static libssh2 on Windows. The best fix seems to be to revert this,
instead of adding extra tweaks to dependents.
Fixes:
https://ci.appveyor.com/project/curlorg/curl-for-win/builds/47667412#L11035
```
ld.lld-15: error: undefined symbol: __declspec(dllimport)
libssh2_session_block_directions
>>> referenced by vssh/.libs/libcurl_la-libssh2.o:(ssh_do)
>>> referenced by vssh/.libs/libcurl_la-libssh2.o:(ssh_connect)
>>> referenced by vssh/.libs/libcurl_la-libssh2.o:(ssh_multi_statemach)
>>> referenced 8 more times
Closes #1141
Closes #1140
Closes #1139
Closes #1138
- NMakefile: delete
This make file was for long time unmaintained (last updated in 2014).
Despite best efforts to keep it working in the recent round of major
overhauls, it appears to be broken now. There is also no way to test it
without an actual MSVC env and it's also missing from our CI. Based on
our Issue tracker, it's also not widely used.
Since its addition in 2005, libssh2 got support for CMake in 2014.
CMake should be able to generate NMake makefiles with the option
`-G "NMake Makefiles"`. (I haven't tested this.)
Ref: https://github.com/libssh2/libssh2/discussions/1129
Closes #1134
Follow-up to #1133
Closes #1135
To reproduce the issue, you can create a test key with a command like
the following:
```bash
ssh-keygen -Z [email protected] -f id_aes256-gcm
```
If you attempt to use this key for authentication, libssh2 returns the
not-so-helpful error message "Wrong passphrase or invalid/unrecognized
private key file format".
This patch fixes the code for reading OpenSSH private keys encrypted
with AES-GCM methods.
Closes #1132
Also add zlib when used as a direct dependency when zlib compression
support is enabled.
Follow-up to ef538069a661a43134fe7b848b1fe66b2b43bdac
Closes #1131
Closes #1130
Closes #1128
Closes #1127
Update the VERSION argument <min> value or use a ...<max> suffix to tell
CMake that the project does not need compatibility with older versions.
```
Closes #1125
Adapted for libssh2 from the curl commit message by James Le Cuirot:
Consider that this is what the Meson build system does when it generates
`pkg-config` files."
Ref: https://github.com/libssh2/libssh2/pull/1114#issuecomment-1634334809
Ref: https://github.com/curl/curl/commit/98e5904165859679cd78825bcccb52306ee3bb66
Ref: https://github.com/curl/curl/pull/5373
Closes #1119
Ref: https://linux.die.net/man/1/pkg-config
Ref:
https://gitlab.freedesktop.org/pkg-config/pkg-config/-/blob/d97db4fae4c1cd099b50697
0b285dc2afd818ea2/pkg-config.1
Closes #1124
https://github.com/gpg/libgcrypt/blob/e76e88eef7811ada4c6e1d57520ba8c439139782/
src/libgcrypt.pc.in
Present since 2005-04-22:
https://github.com/gpg/libgcrypt/commit/32bf3f13e8b45497322177645bebf0b5d0c9cb8e
Released in v1.3.0 2007-05-04:
https://github.com/gpg/libgcrypt/releases/tag/libgcrypt-1.3.0
Closes #1123
- cmake: tidy-ups
Closes #1122
Ref: https://github.com/libssh2/libssh2/issues/1115#issuecomment-1631845640
Closes #1117
Ref: https://github.com/libssh2/libssh2/pull/1109#discussion_r1246613274
Closes #1111
Fixes #1103
Fixes #731
Closes #1104
Reported-by: PewPewPew
Fixes #1105
Closes #1106
Use regular variables and separate file open modes from filenames.
Suggested by perlcritic
Copied from
https://github.com/curl/curl/commit/7f669aa0f1d40ef5d64543981f22bdc5af1272f5
Copied from https://github.com/curl/trurl/commit/f2784a9240f47ee28a845
The checker tool was upgraded upstream to 2.0.0 and the REUSE
Specification to version 3.1 (from 3.0), causing these new errors:
```
reuse.project - WARNING - Copyright and licensing information for
'docs/INSTALL_AUTOTOOLS' have been found in 'docs/INSTALL_AUTOTOOLS' and the DEP5
file located at '.reuse/dep5'. The information in the DEP5 file has been
overridden. Please ensure that this is correct.
reuse.project - WARNING - Copyright and licensing information for
'tests/openssh_server/Dockerfile' have been found in
'tests/openssh_server/Dockerfile' and the DEP5 file located at '.reuse/dep5'. The
information in the DEP5 file has been overridden. Please ensure that this is
correct.
Ref: https://github.com/fsfe/reuse-tool/releases/tag/v2.0.0
Ref: https://git.fsfe.org/reuse/docs/src/branch/stable/CHANGELOG.md#3-1-2023-06-
21
Fixes #1101
Closes #1102
Closes #1098
Fixes:
```
ERROR: test_sshd.test - missing test plan
ERROR: test_sshd.test - exited with status 1
```
Ref:
https://github.com/libssh2/libssh2/actions/runs/5322354271/jobs/9638694218#step:10:
532
Follow-up to 299c2040625830d06ad757d687807a166b57d6de
Closes #1099
test_sshd.test: show sshd and test connect logs on harness failure (#1097)
Credit:
Joel Depooter
Before this patch OpenSSL, mbedTLS, WinCNG and OS/400 advertised both
SHA2 and SHA1 host key algos, even when SHA1 was not supported by the
crypto backend or when forcefully disabled via `LIBSSH2_NO_RSA_SHA1`.
Fixes #1090
Closes #1091
Closes #1084
Simplify the code to avoid this warning. This might also help avoiding
it with other compilers (e.g. gcc?).
Also:
- uppercase `(C)`.
- add missing 'All rights reserved.' lines.
- drop duplicate 'Author' lines.
- add copyright headers where missing.
- enable copyright header check in checksrc.
Closes #1082
```
In file included from
$HOME/src/cygwin/libssh2/libssh2-1.11.0-1.x86_64/src/libssh2-1.11.0/tests/
openssh_fixture.c:57:
$HOME/src/cygwin/libssh2/libssh2-1.11.0-1.x86_64/src/libssh2-1.11.0/tests/
openssh_fixture.c: In function 'run_command_varg':
$HOME/src/cygwin/libssh2/libssh2-1.11.0-1.x86_64/src/libssh2-1.11.0/tests/
openssh_fixture.c:136:37: warning: array subscript has type 'char' [-Wchar-
subscripts]
136 | while(end > 0 && isspace(buf[end - 1])) {
| ~~~^~~~~~~~~
```
Ref: https://github.com/libssh2/libssh2/files/11644340/cygwin-x86_64-libssh2-
1.11.0-1-check.log
Closes #1079
Follow-up to 7b8e02257f01a6dac5f65305b18bb74a157fb5c4
Closes #1076
- ci: add non-static autotools i386 build, ignore GHA updates on AppVeyor
Also:
- GHA: add necessary generic bits for i386 autotools builds.
- AppVeyor CI: teach it to ignore commits updating our GHA config.
Closes #1073
Closes #1055
- scp: fix missing cast for targets without large file support
E.g. on 32-bit Linux. Issue revealed after adding i386 Linux CI build
in abdf40c741c575f94bdea1c67a9d1182ff813ccb #1057.
```
/home/runner/work/libssh2/libssh2/src/scp.c: In function 'scp_recv':
/home/runner/work/libssh2/libssh2/src/scp.c:765:23: error: conversion from
'libssh2_int64_t' {aka 'long long int'} to '__off_t' {aka 'long int'} may change
value [-Werror=conversion]
765 | sb->st_size = session->scpRecv_size;
| ^~~~~~~
```
Ref: https://github.com/libssh2/libssh2/actions/runs/5126803482/jobs/9221746299?
pr=1054#step:12:51
Follow-up to 1153ebdeba563ac657b525edd6bf6da68b1fe5e2
Fixes #1053
Closes #1054
Closes #1059
Also:
- reorder Linux build matrix to make build tool more visible.
- hide apt-get progress bar.
- prepare package install step for i386 builds.
Closes #1052
Closes #1050
Closes #1049
```
2/43 Test #2: test_aa_warmup ............................***Failed 5.59 sec
libssh2_session_handshake failed (-44): Unable to ask for ssh-userauth service
```
Ref:
https://github.com/libssh2/libssh2/actions/runs/5085775952/jobs/9139583212#step:12:
942 (with logging)
Ref:
https://github.com/libssh2/libssh2/actions/runs/5085586301/jobs/9139192562#step:12:
225
wolfSSL version:
```
Get:1 http://azure.archive.ubuntu.com/ubuntu jammy/universe amd64 libwolfssl32
amd64 5.2.0-2 [818 kB]
Get:2 http://azure.archive.ubuntu.com/ubuntu jammy/universe amd64 libwolfssl-dev
amd64 5.2.0-2 [1194 kB]
```
Follow-up to df513c0128e1a811ad863d153892618e728845f0
Ref: https://github.com/libssh2/libssh2/issues/1020#issuecomment-1562069241
Closes #1045
- build: fix 'unused' compiler warnings with all `NO` options set
- openssl: fix unused variable and function warnings with all supported
`LIBSSH2_NO_*` options enabled.
Closes #1044
Ref: https://cmake.org/cmake/help/latest/command/list.html#prepend
Closes #1043
Ref: https://github.com/curl/curl/pull/11134
Closes #1042
Ref: 896154bc17f000c0a1bb89b74bc879692ac0d47c
This brings default behaviour in sync with autotools, which builds both
lib flavours by default.
Workarounds:
The collision issue affects (typically) MSVC, when building both shared
and static libssh2 in one go.
Ref: https://stackoverflow.com/questions/2140129/what-is-proper-naming-
convention-for-msvc-dlls-static-libraries-and-import-libr
(MinGW, Cygwin and unixy platforms are not affected by this issue.)
Follow-up to 4e2580628dd1f8dc51ac65ac747ebcf0e93fa3d1
Follow-up to 4e2580628dd1f8dc51ac65ac747ebcf0e93fa3d1
Before this patch this was broken for building tests. This patch skips
building tests that require the static libssh2 library, so the build now
succeeds.
Also move the list of tests that require static lib from
`CMakeLists.txt` to `Makefile.inc`, so that we can reuse it in
`Makefile.mk`.
Before this patch, the CMake build did not allow to disable static
libssh2 library while also building tests.
This patch removes this constraint, and makes this combination possible.
In this case the 3 (at the moment) tests that require a static libssh2
library, are skipped from the build and test runs.
Before this patch, `src` and `tests` declared the `session` structure
differently, due to extra struct members added with the `LIBSSH2DEBUG`
macro set. But, the macro was only set for `src` when using CMake. At
runtime this caused struct members to be at different offsets between
lib and test code, resulting in the test failures below.
Due to another bug in the affected test, these failures did not reflect
in the exit code, which always returned success, so this went unnoticed
for a good while. Fixed in: 84d31d0ca7b647ad4c2aa92bf8f4a94b233f5d3b
```
Start 5: test_auth_keyboard_info_request
[...]
5: Test case 1 passed
5: Test case 2 passed
5: Test case 3: expected return code to be 0 got -1
5: Test case 4: expected last error code to be "-6" got "-38"
5: Test case 5: expected last error code to be "-6" got "-38"
5: Test case 6: expected last error code to be "-6" got "-38"
5: Test case 7: expected last error message to be "Unable to decode keyboard-
interactive number of keyboard prompts" got "userauth keyboard data buffer too
small to get l
5: Test case 8: expected last error code to be "-41" got "-38"
5: Test case 9: expected return code to be 0 got -1
5: Test case 10: expected return code to be 0 got -1
5: Test case 11: expected last error code to be "-6" got "-38"
5: Test case 12: expected last error message to be "Unable to decode user auth
keyboard prompt echo" got "userauth keyboard data buffer too small to get length"
5: Test case 13: expected return code to be 0 got -1
5: Test case 14: expected return code to be 0 got -1
5: Test case 15: expected last error code to be "-6" got "-38"
5: Test case 16: expected last error code to be "-6" got "-38"
5: Test case 17: expected last error code to be "-6" got "-38"
5: Test case 18: expected last error code to be "-6" got "-38"
```
Ref: https://ci.appveyor.com/project/libssh2org/libssh2/builds/46925869/job/
i9uasceu3coss0i2#L440
Ref: https://ci.appveyor.com/project/libssh2org/libssh2/builds/46983040/job/
c3vag25c26a77lyr#L485
Before this patch, this test returned success even when one of its tests
failed. Fix it by returning 1 in case any of the tests fails.
This issue masked a CMake build bug with logging enabled. Subject to an
upcoming patch.
Follow-up to 3d64a3f5100f7f4cf52202396eb4f1c3f3567771
Follow-up to d93ccf4901ef26443707d341553994715414e207
Tests:
https://github.com/libssh2/libssh2/actions/runs/4906586658: unity builds enabled
https://github.com/libssh2/libssh2/actions/runs/4906925743: unity builds enabled
+ parallel msys2 builds
https://github.com/libssh2/libssh2/actions/runs/4906777629: unity + shared lib
(this commit)
https://github.com/libssh2/libssh2/actions/runs/4906927190: unity + shared lib
(this commit) + parallel msys2 builds
Consider making shared libs enabled by default also in CMake, to sync it with
autotools?
Closes #1035
Follow-up to 3d64a3f5100f7f4cf52202396eb4f1c3f3567771
- enable unity builds for some existing CI builds to test this build
scenario.
- tune `UNITY_BUILD_BATCH_SIZE` size.
- disable unity build for example and test programs (they use one source
each already).
Ref: https://cmake.org/cmake/help/latest/prop_tgt/UNITY_BUILD.html
Closes #1034
Before this patch libssh2 used a variety of solutions to pass the source
directory to tests: `FIXTURE_WORKDIR` build-time macro (cmake),
`FIXTURE_WORKDIR` envvar (unused), setting `srcdir` manually
(autotools), setting current directory (cmake), and also `builddir`
envvar (autotools) for passing current working dir to `mansyntax.sh`.
This patch reduces this to using existing `srcdir` with autotools and
setting it ourselves in CMake. This was mostly enabled by this recent
patch: 4c9ed51f962f542b98789b15bedaaa427f4029a2
Details:
The `srcdir` envvar was already exported by autotools, and now we're
also setting it from CMake.
https://github.com/autotools-mirror/automake/blob/c04c4e8856e3c933239959ce18e16599f
cc04a8b/doc/automake.texi#L9302-L9304
https://www.gnu.org/software/automake/manual/html_node/Scripts_002dbased-
Testsuites.html
It's mentioned in the docs back in 1997 and got a regression test in
2012. We can safely assume it to be available without setting it
ourselves.
It seems this wasn't necessary to make the above fix work, and
`mansyntax.sh` is able to figure out the build workdir by reading
`$PWD`. Our out-of-tree and `make distcheck` CI builds also work
without it.
Let us know if there is a scenario we're missing and needs this.
Closes #1032
With inputs larger than `UINT_MAX` this means the stored size is smaller
than the data that follows it.
This patch truncates the stored data to the stored size, and now returns
a boolean with false if the stored length differs from the requested
one. Also add `assert()`s for this condition.
This is still not a correct fix, as we now dump consistent, but still
truncated data which is not what the caller wants. In future steps we'll
need to update all callers that might pass large data to this function
to check the return value and handle an error, or make sure to not call
this function with more than UINT_MAX bytes of data.
Closes #1025
Follow-up to 1289033598546ee5089ff0fc4369d24e1e2be81f
Tested-in #1032
To not force this setting for local builds where they might serve
a good purpose.
- ci: merge make job into msys2 section, enable zlib + openssl
Follow up to dd625766271a0ba13f5ac661bdc2fa40bbfa580a
autotools already didn't check for `bcrypt.h`, and such check is only
required for old/legacy mingw without obsolete/incomplete Windows
headers.
curl deprecated old-mingw support just recently and will delete support
in September 2023.
This patch saves some complexity and detection time by dropping this
check for CMake. Meaning that mingw-w64 is now required to compile
libssh2 when using the WinCNG backend for 32-bit builds. Other backends
and CPU platforms are not affected.
Ref: https://github.com/curl/curl/commit/e4d5685cb5d6eb07e1b43156fd7e3ba3563afba5
Closes #1026
Closes #1027
Also:
- merge back `agent.h` into `agent.c` where it was earlier.
Ref: c998f79384116e9f6633cb69c2731c60d3a442bb
- introduce `HAVE_WIN32_AGENT` internal macro.
- fix two guards to exclude more code unused in UWP builds.
Follow-up to 1c1317cb768688eee0e5496c72683190aaf63b29
Closes #1028
Closes #1029
Merge the loop executing multiple tests and the script that actually
launches the tests into a single script. This same script is now called
from both autotools and CMake. autotools loads the list of tests from
`Makefile.inc`, CMake passes it via the command-line. It's also possible
to call the script manually with a custom list of tests or individual
ones.
With this setup we're now launching a single sshd session for all tests,
instead of launching and killing it for each test. This did not improve
reliability of these test on CI machines, and it's easy to go back to
the previous behaviour if necessary.
Also:
Also keep Docker tests disabled on these platforms, they do not work:
GHA Windows:
```
no matching manifest for windows/amd64 in the manifest list entries
```
GHA macOS:
```
sh: docker: command not found
```
ARM64
```
D:/a/libssh2/libssh2/bld/tests/Release/test_ssh2.exe: cannot execute binary file:
Exec format error
```
autotools:
- `--disable-docker-tests`
- `--disable-sshd-tests`
cmake:
- `RUN_DOCKER_TESTS`
- `RUN_SSHD_TESTS`
Update automake and ci to use this new flag and delete former logic
of relying on Windows detection and `HOST_WINDOWS`. Also fix honoring
this when running `test_read_algos.test`.
Also:
- delete an unused 64-bit option for Linux (all jobs are 64-bit).
- fix to not install libgcrypt and openssl when doing mbedTLS builds.
This improves build times. It also allows to stop building our special
shared test target to test shared builds.
Follow-up to 4e2580628dd1f8dc51ac65ac747ebcf0e93fa3d1
Twice. This tests are flaky and we haven't figured out why. In the
meantime use this workaround to test and log these issues, but also
ensure that CI run aren't flagged red because of it.
Also:
- kex: add debug message when hostkey `sig_verify` fails,
to help tracking WinCNG KEX failures.
- test_ssh2: also add retry logic.
I'm not quite sure this is correct. Please let me know.
- session_fixture: bump up `src_path` slots to fit retries and show
message when hitting the limit.
- session_fixture: clear `kbd_password` static variable after use.
- session_fixture: close and deinit socket after use.
- session_fixture: deinit libssh2 after use.
Follow-up to 80175921638fa0a345237d23206a2ad1644cdd9b
Make sure these files get LF newlines on checkout. Before this patch
a checked out libssh2 Git repository may have used CRLF newlines in text
files, include test keys. Private keys with CRLF newlines could confuse
sshd on Windows:
```
# sshd version: 'OpenSSH_9.2, OpenSSL 1.1.1t 7 Feb 2023'
Unable to load host key
"/d/a/libssh2/libssh2/tests/openssh_server/ssh_host_ed25519_key": invalid format
Unable to load host key:
/d/a/libssh2/libssh2/tests/openssh_server/ssh_host_ed25519_key
```
Ref:
https://github.com/libssh2/libssh2/actions/runs/4846188677/jobs/8635575847#step:6:3
9
Also:
- fix indent
- lowercase variables names
- fix formatting in `src/global.c`
Ref:
https://github.com/curl/curl/commit/a59f04611629f0db9ad8e768b9def73b9b4d9423
- simplify to avoid:
```
src/Makefile.inc:48: warning: variable 'EXTRA_DIST_SOURCES' is defined but no
program or
src/Makefile.inc:48: library has 'DIST' as canonical name (possible typo)
```
Regression from 2c18b6fc8df060c770fa7e5da704c32cf40a5757
- `AC_TRY_LINK`/`AC_TRY_COMPILE`:
```
configure.ac:335: warning: The macro `AC_TRY_COMPILE' is obsolete.
configure.ac:335: warning: The macro `AC_TRY_LINK' is obsolete.
```
- `libtool`-related ones:
```
configure.ac:70: warning: The macro `AC_LIBTOOL_WIN32_DLL' is obsolete.
configure.ac:70: warning: AC_LIBTOOL_WIN32_DLL: Remove this warning and the
call to _LT_SET_OPTION when you
configure.ac:70: put the 'win32-dll' option into LT_INIT's first parameter.
configure.ac:71: warning: The macro `AC_PROG_LIBTOOL' is obsolete.
```
Using code copied from curl:
https://github.com/curl/curl/blob/9ce7eee07042605045dcfd02a6f5b38ad5c8a05d/m4/
xc-lt-iface.m4#L157-L163
- formatting.
Currently libssh2 cannot read huge directory listings when the package
size of `LIBSSH2_SFTP_PACKET_MAXLEN` (256KB) is hit. For example AWS
always sends a single package with all files of a directory, no matter
how big it is: https://freefilesync.org/forum/viewtopic.php?t=10020
Package size is probably around 7MB in this case!
The proposed patch, enhances the package size reading to include parsing
the full SFTP packet header. And in case a package is of type
`SSH_FXP_NAME` and matches an expected `readdir_request_id`, it does not
fail if `LIBSSH2_SFTP_PACKET_MAXLEN` is hit. The chances of accidentally
hiding data-corruption are pretty non-existent, because both SFTP
`request_id` and packet type must match. No change in behavior
otherwise.
Best, Zenju
Closes #1014
Add macOS CI jobs, both cmake and autotools for all supported crypto
backends (except BoringSSL), with debug, zlib enabled. Without running
tests. It also introduces OpenSSL 1.1 into the CI with a non-MSVC
compiler.
- openssl: fix warning when built with wolfSSL, or OpenSSL 1.1 and
earlier. CI missed it because apparently the only OpenSSL 1.1 test
we had used MSVC, which did not complain.
```
../src/openssl.c:3852:19: error: variable 'sslError' set but not used [-
Werror,-Wunused-but-set-variable]
unsigned long sslError;
^
```
Regression from 097c8f0dae558643d43051947a1c35b65e1c5761
The Homebrew wolfSSL build comes with MD5 support disabled. We can
expect this becoming the norm. FIPS also requires MD5 disabled.
A better fix would be to guard the MD5 logic with our `LIBSSH2_MD5`
macro.
```
pem.c:214:32: error: use of undeclared identifier 'MD5_DIGEST_LENGTH'; did you
mean 'SHA_DIGEST_LENGTH'?
unsigned char secret[2*MD5_DIGEST_LENGTH];
^~~~~~~~~~~~~~~~~
SHA_DIGEST_LENGTH
```
```
bcrypt_pbkdf.c:93:5: error: implicit declaration of function 'explicit_bzero'
is invalid in C99 [-Werror,-Wimplicit-function-declaration]
_libssh2_explicit_zero(ciphertext, sizeof(ciphertext));
^
../src/misc.h:50:43: note: expanded from macro '_libssh2_explicit_zero'
^
```
- cmake: fix to list our own include directory before the crypto libs',
when building tests.
```
cc -DHAVE_CONFIG_H -DLIBSSH2_LIBGCRYPT \
-I../src -I../../src -I/usr/local/include -I[...]/libssh2/include \
-g -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX13.1.sdk \
-mmacosx-version-min=12.6 -MD -MT \
tests/CMakeFiles/test_aa_warmup.dir/test_aa_warmup.c.o \
-MF CMakeFiles/test_aa_warmup.dir/test_aa_warmup.c.o.d \
-o CMakeFiles/test_aa_warmup.dir/test_aa_warmup.c.o -c \
[...]/libssh2/tests/test_aa_warmup.c
```
```
[ 62%] Building C object tests/CMakeFiles/test_aa_warmup.dir/test_aa_warmup.c.o
In file included from
/Users/runner/work/libssh2/libssh2/tests/test_aa_warmup.c:4:
In file included from /Users/runner/work/libssh2/libssh2/tests/runner.h:42:
In file included from
/Users/runner/work/libssh2/libssh2/tests/session_fixture.h:43:
/Users/runner/work/libssh2/libssh2/tests/../src/libssh2_priv.h:649:5: error:
type name requires a specifier or qualifier
LIBSSH2_AUTHAGENT_FUNC((*authagent));
^
/Users/runner/work/libssh2/libssh2/tests/../src/libssh2_priv.h:649:30: error:
type specifier missing, defaults to 'int' [-Werror,-Wimplicit-int]
LIBSSH2_AUTHAGENT_FUNC((*authagent));
^
/Users/runner/work/libssh2/libssh2/tests/../src/libssh2_priv.h:650:5: error:
type name requires a specifier or qualifier
LIBSSH2_ADD_IDENTITIES_FUNC((*addLocalIdentities));
^
/Users/runner/work/libssh2/libssh2/tests/../src/libssh2_priv.h:650:35: error:
type specifier missing, defaults to 'int' [-Werror,-Wimplicit-int]
LIBSSH2_ADD_IDENTITIES_FUNC((*addLocalIdentities));
^
/Users/runner/work/libssh2/libssh2/tests/../src/libssh2_priv.h:651:5: error:
type name requires a specifier or qualifier
LIBSSH2_AUTHAGENT_SIGN_FUNC((*agentSignCallback));
^
/Users/runner/work/libssh2/libssh2/tests/../src/libssh2_priv.h:651:35: error:
type specifier missing, defaults to 'int' [-Werror,-Wimplicit-int]
LIBSSH2_AUTHAGENT_SIGN_FUNC((*agentSignCallback));
^
6 errors generated.
```
Follow-up to a683133dfe96de126194f58f183131a84c7d36a2
curl's `macos.yml`:
https://github.com/curl/curl/blob/da2470de96e94e1c8d276b9ae6e4c97c2cf54239/.github/
workflows/macos.yml
Follow-up to a683133dfe96de126194f58f183131a84c7d36a2
Follow-up to f4a4c05dc3bcd62ecaa1b0cac5997faefe16c83f
Follow-up to 71cae949d577fdd632a271da0bec89f977dc5dd2
Closes #1013
Closes #997
Closes #1011
Closes #999
- add MSVC jobs to GitHub Actions. They are similar to the 'Build-only'
jobs we have on AppVeyor CI, though only the ARM64 Windows one is
identical. Major disadvantage is that we don't run tests here. Major
advantage is they only take a few minutes to complete, compared to
an hour on AppVeyor, so WinCNG build results now appear quicker.
- add UWP builds for both ARM64 and x64. This hasn't been CI tested
before.
Follow-up to 2addafb77b662e64248d156c71c69b91ba7b926e
Closes #1010
Closes #1009
There was no strong reason to require bash. Let's use POSIX shell
like before the recent overhaul.
Follow-up to a459a25302a31f6e2aba3c4e15b1472b83b596fc
Closes #1008
If SFTP fails to initialize, do not busy loop waiting for IO to happen (#720)
Currently SFTP's init will busy loop waiting for the channel to close,
even if the underlying transport returns EAGAIN. While this works for
sockets, it might not work out if you have a different transport that
needs to do some additional processing on the side.
Left libssh2 version number in the `.TH` header for entries without an
`AVAILABILITY` section, or where there was a different version number
there.
Due to a typo in the `HAVE_*` macro, this header was never included.
Closes #1007
Closes #1006
Unless I'm missing something, it looks like `libssh2.h` has been using
`libssh2_int64_t` unconditionally since at least 2010-04-17 when
`libssh2_scp_send64()` landed via commit
be9ee7095e2d5021985f57d88f5f889d3c2b9d8f.
For MSVC, this means `_MSC_VER` `1310` (from year 2003) is now
required. Based on the above, this was already so before this patch.
Also make sure to set `HAVE_STRTOI64` for older, non-CMake, MSVC builds
(e.g. `Makefile.mk` or `NMakefile` ones).
Closes #1002
- channel: fix an issue that would corrupt the data stream when
attempting to initialize the agent in non-blocking mode, as it is
necessary to propagate the `EAGAIN` signal upstream when the transport
returns `EAGAIN`.
- packet: the current code does not set the state machine upon reaching
this point which means that if the code is suspended due to the
transport returning an `EAGAIN`, this will re-initialize the structure
every time.
Also:
- drop unused `sys/time.h` headers.
- fix our fallback code to compile with any Windows compilers
(not just MSVC)
- delete unnecessary casts.
Closes #1001
Ref: https://cmake.org/cmake/help/latest/manual/cmake.1.html#cmdoption-cmake-E-
arg-make_directory
Noticed this when libasan started kicking out errors when sending in
MACs preferences that were not supported yet.
Follow-up to a459a25302a31f6e2aba3c4e15b1472b83b596fc
Closes #998
Fixes #608
TL;DR: Sync test builds between autotools and CMake. Sync sshd
configuration between Docker and non-Docker fixtures. Bump up
sshd_config for recent OpenSSH releases.
This also opens up the path to have non-Docker tests that use a
local sshd process. Though sshd is practically unusable on Windows
CI machines out of the box, so this will need further efforts.
Details:
- cmake: run sshd fixture test just like autotool did already.
Needed to update the loader to throw away certain lines to keep the
converted output conform CMake syntax. Using regexp might be an
alternative way of doing this, but couldn't make it work.
- cmake: allow to run the same test both under Docker and sshd fixture.
Useful for testing the sshd fixture runner, or how the same test
behaves in each fixture.
- update test fixture to read the username from `USER` envvar instead of
using the Dockfile-specific hardwired one, when running outside Docker.
Add a TAP runner for autotools and extend CMake logic. The TAP runner
loads the test list from `Makefile.am`.
- ed25519 test keys were identical for auth and host. Regenerate the
auth keypair to make them distinct.
- `test_ssh2.c`:
- use libssh2 API to set blocking mode. This makes it support all
platforms.
- adapt socket open timeout logic from `openssh_fixture.c`.
Sadly this did not help fix flakiness on GHA Windows.
Ref: cf80f2f4b5255cc85a04ee43b27a29c678c1edb1
Closes #996
Set the custom count lower than the default when running on AppVeyor.
Closes #995
This PR contains a series of patches that date back many years and I
believe were discussed on the mailing list, but never merged. We have
been using these in our local copy of libssh2 without issue since 2015,
if not earlier. I believe this is the full set of changes, as we tried
to use comments to mark where our copy of libssh2 differs from the
canonical version.
This also contains changes I made earlier this year, but which were not
discussed on the mailing list, to support certificates and FIDO2 keys
with agent forwarding.
* prefer size_t
* prefer unsigned int over u_int in public function
* add const
* docs, indent, checksrc, debug call, compiler warning fixes
We had Windows Server 2012 R2 (8.1) and Windows Server 2019 (10) before
this patch. After, we also have Windows Server 2016 (10).
The WinCNG flakey tests should have a better chance when running on the
newer OS.
Also change the test fixture to not use the `--quiet` option with the
`docker pull` commant. This option requires docker v19.03, and
AppVeyor's Visual Studio 2017 image doesn't support it. Log output did
not change without `--quiet`, so it seems safe to delete it. In case
we'd need it, another solution is to retry without `--quiet` if the
command fails. docker's exit status is 125 in that case.
Ref: https://github.com/libssh2/libssh2/issues/804#issuecomment-1515232799
Ref: https://www.appveyor.com/docs/windows-images-software/
Closes #994
Keep a single list for mac and crypt algos that we use in both CMake
and autotools. Use the same test names across build tools.
Use the TAP protocol to track individual tests run from a single shell
script.
Also:
Closes #993
Closes #992
* rebase on master
* fix checksec warnings
* fix compiler warning
* fix indent/whitespace/eol
* rebase/manual merge onto AES-GCM patch #797
* more manual merge of `libssh2_transport_send()` based
on dfandrich/shellfish
Fixes #582
Closes #655
Closes #987
* doc updates
* change `signame_len` to `size_t`
* variable scopes
* fix checksrc warnings
Closes #672
Closes #991
Follow-up to 857e431648df6edcb3e17138d877f2e65d2d769d
Closes #990
The ciphers work differently than most previous ones in two big areas:
the cipher includes its own integrated MAC, and the packet length field
in the SSH frame is left unencrypted. The code changes necessary are
gated by flags in the LIBSSH2_CRYPT_METHOD configuration structure.
These differences mean that both the first and last parts of a block
require special handling during encryption. The first part is where the
packet length field is, which must be kept out of the encryption path
but in the authenticated part (as AAD). The last part is where the
Authentication Tag is found, which is calculated and appended during
encryption or removed and validated on decryption. As encryption/
decryption is performed on each packet in a loop, one block at a time,
flags indicating when the first and last blocks are being processed are
passed down to the encryption layers.
This is still not complete and it's possible to break a build with
certain crypto backends (e.g. mbedTLS) and/or combination of options.
It's not guaranteed that all bits everywhere get disabled by these
settings. Consider this a "best effort".
Closes #986
Follow-up to 0a500b3554c29451708353279eefce750f4bca6c
Closes #985
Tested in #979
Tested in #979
Tested in #979
Tested in #979
- tests: add `FIXTURE_TRACE_ALL_CONNECT` option
Works like the `FIXTURE_TRACE_ALL` envvar, but enables full trace for
the connection phase only.
Tested in #979
Tested in #979
Closes #983
- use `gman` alias if present. This makes it work when the correct `man`
command is provided via `brew` on macOS.
- delete CMake TODO to move more test logic into CMake. This would make
it CMake-specific and require maintaining it separately for each build
tool. Just use our external script when a POSIX shell is available.
Closes #982
Closes #981
This saves detection time and also makes 3rd party builds simpler.
Also:
Follow-up to f1e80d8d8ce9570d81836da96ba02f4d4552a7b3
Follow-up to 5644eea2161b17f7c16e18f3a10465ebb217ca1f
Closes #980
Closes #978
Tested in #976
Follow-up to 78cb64a85955f2cd9700c4fbad3f02d589dd7169
- rename tests to have more succint names and a more useful natural
order.
Bringing their names in sync with other build tools, like autotools.
- move common auth test code into the fixture and simplify tests by
using that.
- move feature guards from CMake to preprocessor for auth tests.
Now it works with all build tools and it's easier to keep it in sync
with the lib itself.
- move mbedTLS blocklist for crypto tests from CMake to the test
fixture.
- add shell script to regenerate all test keys used for our tests.
- alpha-sort tests.
- rename `signed_*` keys to begin with `key` like the rest of the keys
do.
- whitespace fixes.
Closes #969
Follow-up to ec0feae7920d695ce234a5aba13014bf29824c09
Closes #977
Follow-up to 50124428509ffc2f5d08d8d3c152fa36546c9a75
Closes #975
Follow-up to 78cb64a85955f2cd9700c4fbad3f02d589dd7169
- by using #elif
- by merging two blocks
Closes #972
Follow-up to 78cb64a85955f2cd9700c4fbad3f02d589dd7169
- src: add and use `LIBSSH2_MIN/MAX` macros
Closes #974
From debian:bullseye
Closes #971
Closes #970
Closes #968
- fix indentation.
Closes #967
Closes #966
`s/([a-z0-9._>*-]+) == NULL/!\1/g`
Closes #964
Follow-up to 6dc42e9d625deb816a051d312d09e68926959e78
Closes #963
`s/sizeof ([a-z0-9._>*-]+)/sizeof(\1)/g`
Closes #962
Ref: https://github.com/stribika/stribika.github.io/issues/46
Closes #965
Follow-up to d5438f4ba9036e8028f35258dd1ab97cc2edb37c
Closes #958
Closes #506
Closes #947
Closes #952
Follow-up to 59666e03f04927e5fe3e8d8772d40729f63c570e
Closes #957
Closes #954
After recent build changes, 3rd party build that took the list of
C source to compile them as-is, stopped working as expected, due to
`blowfish.c` and crypto-backend C sources no longer expected to compile
separately but via `bcrypt_pbkdf.c` and `crypto.c`, respectively.
Also:
- add a compile-time error if none of the supported crypto backends
are enabled.
- fix `libssh2_crypto_engine()` for wolfSSL and os400qc3.
Rearrange code to avoid a hard-to-find copy of crypto-backend
selection guards.
Follow-up to 4f0f4bff5a92dce6a6cd7a5600a8ee5660402c3f
Follow-up to ff3c774e03585252b70a9ee0fcf254de7b14a767
Closes #951
Also improve readability a bit and link to SFTP specs. Delete comment
about version 6: The latest spec no longer features the mentioned
"DO NOT IMPLEMENT" notice.
Closes #946
- man: fixups
Closes #949
Ref: https://learn.microsoft.com/windows/win32/intl/code-page-identifiers
Closes #943
Mods:
- delete unrelated condition:
Ref: https://github.com/libssh2/libssh2/pull/216#discussion_r374748111
- rebase on master, whitespace updates.
Closes #216
Closes #632
Closes #945
Closes #942
- this allows dropping the various techniques to pick the correct crypto
backend sources in autotools, CMake and other build method. Including
the per-backend `Makefile.<crypto-backend>.inc` makefiles.
Ref:
https://github.com/curl/curl/blob/dfabe8bca218d2524af052bd551aa87e13b8a10b/
CMakeLists.txt#L1399-L1413
Closes #941
Closes #602
Closes #939
Disable GDI and NLS features in `windows.h`. libssh2 doesn't use these.
Closes #940
Closes #938
- libssh2.rc: fix debug flag, other cleanups
Closes #937
- add `static`.
- fix formatting/indentation.
Closes #936
Ref: https://www.gnu.org/software/autoconf/manual/autoconf-2.69/html_node/
Limitations-of-Builtins.html#Limitations-of-Builtins
Fixes #704
Closes #935
Closes #932
Overriding `main()` can cause duplicate symbols without using a lib for
the `runner` code.
Follow-up to 40ac6b230a309d35c57aa65a8f6d7ab6654aa3d8
Closes #934
Follow-up to 08354e0abbe86d4cc5088d210d53531be6d8981a
Follow-up to 29347905721d2e7fbb97dabfb0071bee51db3013
Follow-up to 5a96f494ee0b00282afb2db2e091246fc5e1774a
Follow-up to 463449fb9ee7dbe5fbe71a28494579a9a6890d6d
Follow-up to 02f2700a61157ce5a264319bdb80754c92a40a24
Follow-up to be31457f3071686b555a0f0b19e5dcf63d67fc27
Closes #933
Follow-up to c20c81ab105cdf27f5a4e2604bd13085f46e21de
Follow-up to 5a96f494ee0b00282afb2db2e091246fc5e1774a
Suppressing:
Suppressing:
`warning C4996: 'strdup': The POSIX name for this item is deprecated. Instead,
use the ISO C and C++ conformant name: _strdup.`
`warning C4996: 'write': The POSIX name for this item is deprecated. Instead,
use the ISO C and C++ conformant name: _write.`
Suppressing:
Closes #929
Follow-up to 194cfc0f84192809c87f846140e5bf06b7a864af
Closes #927
Also:
```
..\..\example\direct_tcpip.c(262): warning C4127: conditional expression is
constant
```
Happens for every `FD_SET()` macro reference.
Ref: https://ci.appveyor.com/project/libssh2org/libssh2/builds/46677835/job/
ni4hs97bh18c14ap
```
..\..\src\wincng.c(867): warning C4306: 'type cast' : conversion from 'int' to
'LPCSTR' of greater size
..\..\src\wincng.c(897): warning C4306: 'type cast' : conversion from 'int' to
'LPCSTR' of greater size
..\..\src\wincng.c(1132): warning C4306: 'type cast' : conversion from 'int' to
'LPCSTR' of greater size
```
Ref: https://ci.appveyor.com/project/libssh2org/libssh2/builds/46678071/job/
08t5ktvkcgdghp7r
Closes #925
Closes #918
Reverts 4774d500e724bc4e548f743a0cb644ab05599474
Follow-up to d245c66cc0029e480674394c23e8be1c9410f7ad
- win32/GNUmakefile: update help & exit without crypto backend [ci skip]
Closes #917
Keep the feature flag internal to `wincng.h`, and for extra safety add
the new macro `LIBSSH2_WINCNG_DISABLE_WINCRYPT` do disable it via
custom `CPPFLAGS`.
[1] https://learn.microsoft.com/en-us/windows/win32/api/wincrypt/nf-wincrypt-
cryptdecodeobjectex
Closes #916
Follow-up to 06f281921907fa077884c7020917661ca805b9d3
Follow-up to 50c9bf868e833258d23c5f55ed546d1fcd5687d0
Closes #915
Closes #914
libssh2 used this standard C89 header unconditionally before this patch.
Closes #913
- NMakefile: drop redundant variable and assignments [ci skip]
Follow-up to 68fd02fba002c8c6af3ba51a2780de46b47b3787
With 20-ish extra lines, make this Makefile support all GCC-like
toolchains.
Also change the lib directory name in the `dist` package from
`win32` to `lib`, to match other packages and build tools.
Follow-up to d245c66cc0029e480674394c23e8be1c9410f7ad
Whether to build the `x11` example or not was decided by each build
tool. CMake didn't build it even on supported platforms. GNUMakefile
used a specific blocklist for it, while autotools enabled it based on
feature-detection.
Also:
Closes #909
This also prevents mistakes where feature detection went out of sync
between `src` & `tests` (see ae90a35d15d97154ac0c8554bce99ebfb18ee825).
`tests` do compile sources from `src` directly, so these should always
be in sync.
Also fix a warning revealed after this patch made CMake correctly
enable `HAVE_GETTIMEOFDAY` for `example` programs.
Closes #906
While here, also add zlib for OpenSSL. Necessary when using OpenSSL
builds with zlib enabled.
Closes #905
Follow-up to 057522bb0f15c10c33159e12899ecc60e40aa6ef
Also:
This results in better job names (now including CPU), avoiding the
complex exception rules, and fine-tuning the order and variation of
these tests.
```
tests\openssh_fixture.c(393,17): warning C4477: 'fprintf' : format string '%d'
requires an argument of type 'int', but variadic argument 1 has type
'libssh2_socket_t'
tests\openssh_fixture.c(393,17): message : consider using '%lld' in the format
string
tests\openssh_fixture.c(393,17): message : consider using '%Id' in the format
string
tests\openssh_fixture.c(393,17): message : consider using '%I64d' in the format
string
```
Turns out, OpenSSL v1.0.2 uses the "EAY" names, but let's not re-add
those either, because CMake mis-picks those up from
`C:/OpenSSL-Win64/bin/`, even while pointing `OPENSSL_ROOT_DIR` to a
v1.1.1 installation.
Ref: https://cmake.org/cmake/help/latest/command/find_file.html
- cmake: leave two commented debug lines that will be useful next time
the DLL detection lookup goes wrong.
Ref: https://cmake.org/cmake/help/latest/variable/CMAKE_FIND_DEBUG_MODE.html
```
src/session.c:675:52: warning: implicit conversion loses integer precision:
'long' to '__darwin_suseconds_t' (aka 'int') [-Wshorten-64-to-32]
tv.tv_usec = (ms_to_next - tv.tv_sec*1000) * 1000;
~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~
```
Follow-up to 2f16d8105c9491beb2a02b3081f4f1c2a224fa62
Ref:
https://github.com/wolfSSL/wolfssl/blob/ba47562d182e10e59813da012e0ab8ef20892231/
wolfssl/openssl/hmac.h#L60-L61
/cc @wolfSSL
This allows to rename back the shared lib target name to the value used
before 4e2580628dd1f8dc51ac65ac747ebcf0e93fa3d1:
`libssh2_shared` -> `libssh2`, if necessary for compatibility. Notice:
before that patch, `libssh2` name referred to either the static or
shared lib, depending on build settings.
- [Viktor Szakats brought this change]
Also skip detecting these and `memset_s()` for Windows targets in CMake,
to save detection time. On Windows we always use `SecureZeroMemory()`.
Follow-up to b8762c1003d97e109efa587bdc760ff9873949eb
Update from:
https://github.com/curl/curl/blob/5fec927374e4d9553205d861f2dcb39ec78002cc/
scripts/checksrc.pl
On AppVeyor, with VS, it uses MSBuild under the hood where apparently
`--parallel` doesn't do much [1]. The suggested MSBuild-specific option
`/p:CL_MPcount=2` did not improve build times either.
[1] https://discourse.cmake.org/t/parallel-does-not-really-enable-parallel-
compiles-with-msbuild/964
Existing option names to toggle these were ambiguous and gave room for
misinterpretation. Some projects may have had these options enabled by
accident.
This patch aims to make it more difficult to enable them, and making
sure that existing methods require an update to stay enabled.
Best would be to delete them, though they may have some use while
developing libssh2 itself, or debugging.
- [Viktor Szakats brought this change]
This patch deletes this obsolete feature from libssh2, with no option
to enable it.
```
CMake Warning:
Manually-specified variables were not used by the project:
OPENSSL_ROOT_DIR
```
Follow-up to 0834b9bcc85b90c78afff103f909b5a909b95e45
Apply type changes to avoid casts and warnings. In most cases this
means changing to a larger type, usually `size_t` or `ssize_t`.
- simplify `_libssh2_ntohu64()`.
Ref: 4552c73cd58fccb1fc49cb0f25f86619133e560f
- formatting in `wincng.h`.
However, that macro was also recently added [1] and not present in an
official release yet, so we might as well just use the new native one
instead (`libssh2_shared_EXPORTS`), defined by CMake automatically.
This way we don't need to define the old macro manually.
CMake forms this macro from the lib's internal name as defined in
`add_library()` by appending `_EXPORTS`. That target name changed from
`libssh2` to `libssh2_shared` after introducing dual shared + static
builds in the recent update.
If we're here, add a new, stable, build-tool agnostic macro with the
same effect, for non-CMake use: `LIBSSH2_EXPORTS`
Follow-up to 4e2580628dd1f8dc51ac65ac747ebcf0e93fa3d1
[ci skip]
Follow-up to b8762c1003d97e109efa587bdc760ff9873949eb
Before this patch, cmake did a single compilation pass when we enabled
both shared and static lib targets. This saves build time (esp. with
MinGW targets and cross-compiling), but has the disadvantage that static
libs built this way must have PIC enabled (offering slightly less
performance) and `dllexport` enabled also, which means that executables
linking the static libssh2 lib export its public symbols.
To avoid these downsides, this patch separates the two passes and
creates a non-PIC, non-`dllexport` static lib, even when also building
the shared lib.
Was: v1.0.2.
Keep using v1.0.2 with the static-only test. To make sure we don't break
support.
- run static-only test before WinCNG ones. Otherwise it's often skipped
due to WinCNG failures (#804).
cmake: fix error with static lib off and example/tests on (#869)
We add an extra run to test the CMake config-path without shared builds
enabled.
This allows to add useful jobs, e.g. MSVS 2022 or ZLIB-enabled builds
for Windows, valgrind builds or other useful stuff, without stretching
CI run times further.
Ref: #863
Also modernize OpenSSL lib references to what 1.0.2 and newer versions
have been using.
Fixes #739
nw, os400, watcom: stop setting unused macros [ci skip] (#859)
```
CheckSymbolExists.c(8): warning C4054: 'type cast': from function pointer
'__int64 (__cdecl *)(const char *,char **,int)' to data pointer 'int *'
in `return ((int*)(&strtoll))[argc];`
```
Ref: https://ci.appveyor.com/project/libssh2org/libssh2/builds/46537222/job/
4vg4yg333mu2lg9b
Closes #857
One of the tests uses internal libssh2 functions, and with CMake it
compiles `src/misc.c` directly for this. `misc.c` references bcrypt /
blowfish code. This needs a workaround for build configs where libssh2
doesn't export these.
Closes #855
ctest timeout (of 450 seconds) didn't seem to make any difference.
Also:
Ref: https://github.com/libssh2/libssh2/pull/655#issuecomment-1472853493
Closes #851
GitHub (17 Mar 2023)
- [Viktor Szakats brought this change]
Ref: https://app.travis-ci.com/github/libssh2/libssh2
Ref: https://travis-ci.org/github/libssh2/libssh2/builds
x64 is the more interesting target. Most type conversion issues are
revealed here. Also more commonly used by now.
After this patch we end up starting with all Shared builds (2015, 2013,
OpenSSL, WinCNG), then continue with Static ones. Shared/Static makes
a minor if any difference in builds/tests compared to different VS
versions of TLS backends.
--
CI run times:
Fixes #802
Closes #848
As in curl:
https://github.com/curl/curl/blob/7fa6e36583b52dd8f1e639b370c9a2849be81b54/lib/
config-win32.h#L221
Closes #842
Fixes #722
Before this patch, with debug logging disabled, libssh2 code used a
variadic macro to catch `_libssh2_debug()` calls, and convert them to
no-ops. In certain conditions, it used an empty inline function instead.
The new solution uses the trick of passing the variable arg list as a
single argument and pass that down to the debug function with a regular
macro. When disabled, another regular C89-compatible macro converts it
to a no-op.
This makes inlining, C99 variadic macros and maintaining the conditions
for each unnecessary and also makes the codebase compile more
consistently, e.g. with forced C standards and/or picky warnings.
```
../src/openssl.h:130:5: warning: 'LIBRESSL_VERSION_NUMBER' is not defined,
evaluates to 0 [-Wundef]
LIBRESSL_VERSION_NUMBER >= 0x3070000fL
^
```
Ref: https://ci.appveyor.com/project/libssh2org/libssh2/builds/46460704/job/
g3t7bro6ta6n3pk6#L52
Follow-up to 505ea626b6e125b7ce15caf453b522192008a884
Follow-up to 9f217a17f6f3c2047c4a1668a5c037a75a02abfd
Ref: #817
Flakiness got continously worse these last days. It didn't seem related
to recent commits. Flakiness also picked up in GitHub CI runs, something
rarely seen before. Manual restart consistently fixed them.
I then reversed the order of the first two tests, and it turned out that
the _first_ test failed again (`test_hostkey_hash`). Also pointing to a
timeout issue.
Then I added a dummy test to "warm up" whatever needs warming up in the
layers of CI + Docker + ssh server and their interconnects. This helped,
and GitHub CI tests run without failure right for the first time.
AppVeyor CI also improved a little.
This patch adds a new first test called `test_warmup`, that creates a
new libssh2 session, and exits with success even if that attempt failed.
In some [1] cases [2] it's not the first test failing intermittently.
That's a different issue, and this patch doesn't fix it.
[1] #804
[2] https://ci.appveyor.com/project/libssh2org/libssh2/builds/46440828/job/
8rej6cq6itg7vc4w#L500
Follow-up to 4cdf785cd313c3272d04c2ef7458a35d44533d8b.
It's not clear why a C standard was explicitly set, but a side-effect
of this is that CMake-built binaries diverged from ones built with
autotools or GNU Make (using the same compiler and configuration).
Seems unlikely, but if our tests require this option, we should set it
for the CI builds only?
Fixes #824
Follow-up to 4cdf785cd313c3272d04c2ef7458a35d44533d8b.
Follow-up to 16619a8eddec35bb8582d1c334db0fc13b0817c4.
build: silence bogus C4127 warnings with MSVS 2013 and earlier (#819)
E.g.:
`channel.c(370): warning C4127: conditional expression is constant`
Ref:
https://ci.appveyor.com/project/libssh2org/libssh2/builds/46437333/job/
5rak1vcl9hue31ei#L190
cmake: use only needed socket libs when checking non-blocking sockets (#816)
Based on patch by Christian Beier.
Fixes #694
Closes #712
Add OpenSSL 3 and versionless DLL names. Also modernize warning messages
and variable names.
https://github.com/ngtcp2/ngtcp2/blob/e4d920c4b7a350d63b6978c68b216b76faa12635/
cmake/Findwolfssl.cmake
via commit:
https://github.com/ngtcp2/ngtcp2/commit/296396d3730b721ad97f9de22f525400f8524c0e
by Stefan Eissing
I mistakenly pruned some non-Windows logic, also missing the fact that
our local `check_function_exists_may_need_library()` set the `NEED_*`
variables. Oddly, only `src` imported this function, yet also `examples`
and `tests` called it indirectly. The referenced `HAVE_SOCKET` /
`HAVE_INET_ADDR` variables might be coming from an upstream CMake
project? Leaving those there also, just in case.
With llvm `lld`, detection works out of the box. With binutils `ld`,
it does not. The reason is `ld`s world-famous pickiness with lib
order.
To fix it, we pass all custom libs before and after the TLS libs.
This ugly hack makes `ld` happy and detection succeed.
Closes #811
Also extend CRYPT/MAC test error messages with the CRYPT/MAC name.
Closes #814
Closes #810
Closes #813
Before this patch, the `snprintf()` fallback logic for envs not
supporting this function (i.e. Visual Studio 2013 and older) varied
depending on build tool, and used different techniques in examples,
tests and libssh2 itself.
Also change the length type from `int` to `size_t`, and fix
formatting.
Closes #812
With the feature available, but not found by CMake, build failed with:
`openssl.c:636:21: error: incompatible integer to pointer conversion assigning
to 'EVP_CIPHER *' (aka 'struct evp_cipher_st *') from 'int' [-Wint-conversion]`
Closes #809
- fix code using `int` (or `SOCKET`) for sockets. Use libssh2's
dedicated `libssh2_socket_t` and `LIBSSH2_INVALID_SOCKET` instead.
Ref: https://learn.microsoft.com/en-us/previous-versions/windows/desktop/
legacy/aa366877(v=vs.85)
Ref: https://learn.microsoft.com/en-us/windows-hardware/drivers/ddi/wdm/nf-wdm-
rtlsecurezeromemory
Ref: curl/curl@1ca62bb
Ref: curl/curl#7765
Ref: curl/curl#7776
It controls both the newly added picky warnings for llvm/clang and
gcc, and also the pre-existing ones for MSVC.
- delete `_AMD64_` and add missing `-m64` for x64 builds under test.
- add support for `ARCH=custom`.
It disables hardcoded Intel 64-bit and Intel 32-bit options,
allowing ARM64 builds.
- add support for `LIBSSH2_RCFLAG_EXTRAS`.
To pass custom options to windres, e.g. in ARM64 builds.
- add support for `LIBSSH2_RC`. To override `windres`.
- delete support for Metrowerks C. Last released in 2004.
Timeline:
2013: c910cd382dfa07fed2adaabf688af9e4a084fa1d deleted `mswsock.h` from
`src/libssh2_priv.h`
2008: 8c43bc52b1e3de2c8fc7899a80aec0e98de4e2d8 added `winsock2.h` and
`ws2tcpip.h` to `src/libssh2_priv.h`
2005: dc4bb1af967d2c53e90349f2f37324c622e714f5 added the now deleted #includes
Ref: https://ci.appveyor.com/project/libssh2org/libssh2/builds/46354480/job/
j7d0m34qgq8rag5w
Closes #808
Disable deprecated warnings (for now) when building against OpenSSL 3 for a clean
build.
Reported:
Daniel Stenberg
Two warnings (in tests & examples) in particular would cause problems:
bad format causing invalid data output or a bad chdir due to out of
scope buffer use.
Closes #801
This performs better as an example since it shows more working code, and
in the simplest possible way. It also turns the program into an actually
useful tool out of the box, able to run an arbitrary command (with one
restriction) on a remote machine and return the response, without
needing to touch the source.
Closes #800
This make it more likely that a stronger one will be negotiated rather
than a weaker variant.
The integration tests using Docker are now built with automake as well
(with "make check"). They are not run yet since they aren't working yet
on Linux.
The previous hard-coded key file paths were not valid for normal users.
Make the paths relative to the user's home directory instead so they
can work out of the box. Add a banner showing what connection will be
attempted to make it easier for the user to see what is being attempted.
Enable trace debugging since this is designed as a test program.
This requires more work to be usable out of the box. The necessery sshd
config is (partly) embedded into `tests/openssh_server/Dockerfile`.
Fixes #768
Credit:
Michael Buckley
Notes:
Credit:
Zenju
- indent
- formatting
- cleanup
Also:
Fixes #751
Ref: https://github.com/curl/curl/pull/9768#issuecomment-1286675916
Reported-by: Daniel Stenberg
Follow up to #754
Follow up to #754
This aims to make job and therefore build failures more visible.
Notes:
Add support for [email protected] and [email protected]
key exchange for FIDO auth using the OpenSSL backend. Stub API for other backends.
Credit:
Michael Buckley
Notes:
Fix DLL import library name
https://aur.archlinux.org/packages/mingw-w64-libssh2
https://cmake.org/cmake/help/latest/prop_tgt/IMPORT_PREFIX.html
Credit:
metab0t
Y. Yang
Notes:
Added code to support RSA-SHA2 for WinCNG backend.
Credit:
skundu07
sftp: Prevent files from being skipped if the output buffer is too small (#746)
Notes:
LIBSSH2_ERROR_BUFFER_TOO_SMALL is returned if the buffer is too small
to contain a returned directory entry. On this condition we jump to the
label `end`. At this point the number of names left is decremented
despite no name being returned.
As suggested in #714, this commit moves the error label after the
decrement of `names_left`.
Fixes #714
Credit:
Co-authored-by: Gabriel Smith <[email protected]>
https://cvsweb.openbsd.org/cgi-bin/cvsweb/src/sys/lib/libsa/blowfish.c.diff?
r1=1.1&r2=1.2
https://cvsweb.openbsd.org/cgi-bin/cvsweb/src/sys/lib/libsa/blowfish.h.diff?
r1=1.1&r2=1.2
This enables using libssh2 in GPL software.
Files: CMakeLists.txt
Notes: don't use gcc arguments that don't exist in gcc versions lower than 8 if
building with older gcc.
Credit:
zhaochongliu
Credit:
Miguel de Icaza
Notes:
When setting a ServerAliveInterval using libssh2_keepalive_config() with
want_reply set to true, some servers will reply to the keep-alive requests with a
single SSH_MSG_REQUEST_FAILURE packet. This is an allowed behavior in RFC 4254,
section 4.
Credit:
Michael Buckley
Notes:
In #614 it was identified the docs do not accurately show how
libssh2_channel_flush_ex() return value is set. I have updated the doc's to
correctly show what the function is returning.
Credit:
Ryan Kelley
Credit:
Sandeep Bansal
Credit:
AyushiN
Ref: https://ftp.openbsd.org/pub/OpenBSD/LibreSSL/libressl-3.5.0-relnotes.txt
Credit:
Viktor Szakats
Addresses #695
Credit:
Michael Buckley, reported by Harry Sintonen
File: userauth.c
Notes:
This patch fixes application crashes due to heap corruption. Turns out the null
terminator is written one byte outside of the allocated area.
Credit:
Zenju
Fix build since openssl 1.1.0 when ECDSA and/or RIPEMD are disabled (#666)
File: openssl.h
Notes:
In openssl 1.1.0 and later openssl decided to change some of the defines used to
check if certain features are not compiled in the libraries. This updates the
define checks.
Credit:
Harry Sintonen
Co-authored-by: Harry Sintonen <[email protected]>
File: mbedtls.c
Notes:
* Add sha2 support for RSA key upgrading to mbedTLS backend
Credit:
gbaraldi
Closes #686
Closes #684
- CI: store and reuse OpenSSH Server docker image used for tests
Supersedes #588
Fixes #665
Closes #685
Revert "Option to build both static and shared libraries (#547)" (#675)
#547 doesn't build clean anymore with the keyboard interactive changes.
- [berney brought this change]
files: cmakelists.txt
Notes:
* Option to build both static and shared libraries when using CMake
Credit:
berney
Notes:
This refactors `SSH_MSG_USERAUTH_INFO_REQUEST` processing in
`userauth_keyboard_interactive()` in order to improve robustness, correctness and
readability or the code.
Credit:
xalopp
credit: xalopp
notes:
* Fix heap buffer overflow in _libssh2_key_sign_algorithm
Credit: tihmstar
Co-authored-by: Will Cosgrove <[email protected]>
- [Will Cosgrove brought this change]
Notes:
Part 2 of the fix for #659. This adds rsa key downgrading for agents that don't
support sha2 upgrading. It also adds better trace output for debugging/logging
around key upgrading.
Credit:
Will Cosgrove (signed off by Michael Buckley)
File: agent.c
Notes: implements rsa-sha2 flags used to tell the agent which signing algo to
use.
https://tools.ietf.org/id/draft-miller-ssh-agent-01.html#rfc.section.4.5.1
Credit:
Ian Hattendorf
Closes #610
Fix a memcmp errors in code that was changed from memmem to memcmp (#656)
Notes:
Fixed supported algo prefs list check when upgrading rsa keys
File:
version.c, HACKING-CRYPTO, libssh2.h, libssh2_crypto_engine.3, makefile.
Notes:
libssh2_crypto_engine() API to get crypto engine at runtime.
RSA SHA2 256/512 key upgrade support RFC 8332 #536 (#626)
Notes:
* Host Key RSA 256/512 support #536
* Client side key hash upgrading for RFC 8332
* Support for server-sig-algs, ext-info-c server messages
* Customizing preferred server-sig-algs via the preference
LIBSSH2_METHOD_SIGN_ALGO
fix: use userauth name length to check memory boundaries for userauth name, fixes
#653 (#654)
File: userauth.c
Notes:
Fixes `userauth_kybd_auth_name_len` length check
Reported-by: MarcoPoloPie
Fixes #649
File: hostkey.c
Notes:
Additional key length checking before calling _libssh2_ed25519_new_public()
Credit:
Will Cosgrove
file: userauth.c
note: fix error message
credit:
volund
File:
maketgz
Notes:
Fix error on macOS: sed: -e: No such file or directory
Credit:
cntrump
File:
CMakeLists.txt
Notes:
Following CMake's advice, Update the minimum required version.
Credit:
Jun Tseng
Notes:
Add CIFuzz integration to run fuzzer using the OSS-Fuzz infrastructure
at each PR.
Files: libssh2.h
Notes:
`_WINDLL` is only defined when a Visual Studio CMake generator is used,
`libssh2_EXPORTS` is used though for all CMake generator if a shared libssh2
library is being built.
Credit:
Uwe L. Korn
Notes:
- There are many pre-existing checksrc issues.
- The `sftp.c` and `channel.c` warnings may apply to other platforms as well.
Closes #628
File: openssh_fixture.c
Notes:
fixes too long of output lines building docker image
Credit:
Laurent Stacul
File: openssh_fixture.c
Notes:
Fix `portable_sleep` return type warning
Credit:
Will Cosgrove
File: ci.yml
Notes:
Update CI to use latest Ubuntu #624
Credit:
Will Cosgrove
Update .gitignore
File: Makefile.am
Credit:
Laurent Stacul
The current tests suite starts SSH server as OCI container. This commit
add the possibility to run the tests in a container provided that:
This script is hosted by myself for the time being until GitHub
provides a tighter scope to trigger the workflow_dispatch event.
Notes:
FIPS_mode() is not implemented in LibreSSL and this API is removed in OpenSSL 3.0
and was introduced in 0.9.7. Added guards around making this call.
Credit:
Will Cosgrove
To get this script to run with Autoconf 2.71 on macOS I had to remove the
undefine of the backend for loop variable. It seems scoped to the for loop and also
isn't referenced later in the script so it seems OK to remove it.
Notes:
Remove cygwin specific Win32 CFLAGS and treat the build like a posix build
Credit:
Will Cosgrove, Brian Inglis
tests: Makefile.am: Add missing tests client keys in distribution tarball (#604)
Notes:
Added missing test keys.
Credit:
Laurent Stacul
Notes:
Fix tests missing key to build the OCI image
Credit:
Laurent Stacul
Fixes #597
Closes #599
File:
packet.c
Notes:
Attempt keyboard interactive login (Azure AD 2FA login) and use more than 60
seconds to complete the login, the connection fails.
The _libssh2_packet_require function does almost the same as
_libssh2_packet_requirev but this function sets state->start = 0 before returning.
Credit:
teottin, Co-authored-by: Tor Erik Ottinsen <[email protected]>
Notes:
Support ECDSA certificate authentication
Credit:
kkoenig
Notes:
* agent: Add support for Windows OpenSSH agent
The implementation was partially taken and modified from that found in
the Portable OpenSSH port to Win32 by the PowerShell team, but mostly
based on the existing Unix OpenSSH agent support.
https://github.com/PowerShell/openssh-portable
Credit:
Co-authored-by: Gabriel Smith <[email protected]>
Credit:
Zenju
Notes:
* Make _libssh2_random return code consistent
This commit makes explicit that _libssh2_random can fail (because most of
the underlying crypto functions can indeed fail!), and it makes its result
code consistent: 0 on success, -1 on error.
Credit:
Paul Capron
Notes:
continued ci reliability work.
Credit:
Gabriel Smith
Notes:
The OpenSSH server docker image used for tests is pre-built to prevent
wasting time building it during a test, and unneeded rebuilds are
prevented by caching the image layers.
Credit:
Gabriel Smith
file: userauth.c
notes: libssh2 now supports many other key types besides RSA, if the library is
built without RSA support and a user attempts RSA auth it shouldn't be an automatic
error
credit:
Will Cosgrove
File:
openssl.c
Notes:
Avoid initing MD5 digest, which is not permitted in OpenSSL FIPS certified
cryptography mode.
Credit:
Marc
File:
openssl.c
Notes:
Fixes building with OpenSSL 3, #463.
https://github.com/openssl/openssl/commit/f7397f0d58ce7ddf4c5366cd1846f16b341fbe43
Credit:
Laurent Stacul, reported by Sergei
Credit:
Gabriel Smith
Notes:
It looks like the $default-branch macro only works in templates, not
workflows. This is not explicitly stated anywhere except the linked PR
comment.
https://github.com/actions/starter-workflows/pull/590#issuecomment-672360634
credit:
Gabriel Smith
Files: ci files
Notes:
Move Linux CI using Github Actions
Credit:
Gabriel Smith, Marc Hörsken
file: libssh2_priv.h
note: include iovec for 3DS
credit: Mary Mstrodl
file: test_public_key_auth_succeeds_with_correct_ed25519_key_from_mem.c
credit:
Laurent Stacul
File: bcrypt_pbkdf.c
Notes:
blf_enc() takes a number of 64-bit blocks to encrypt, but using
sizeof(uint64_t) in the calculation triggers a warning with
clang 10 because the actual data type is uint32_t. Pass
BCRYPT_BLOCKS / 2 for the number of blocks like libc bcrypt(3)
does.
Ref:
https://github.com/openbsd/src/commit/04a2240bd8f465bcae6b595d912af3e2965856de
Fixes #562
Credit:
Viktor Szakats
file: transport.c
notes: If the payload is invalid and there is an early return, we could leak the
payload
credit:
Will Cosgrove
file: ssh_client_fuzzer.cc
notes: the session needs blocking mode turned on to avoid EAGAIN being returned
from libssh2_session_handshake()
credit:
Will Cosgrove, reviewed by Michael Buckley
file: kex.c
notes: if haystack isn't null terminated we should use memchr() not strchar(). We
should also make sure we don't walk off the end of the buffer.
credit:
Will Cosgrove, reviewed by Michael Buckley
file: kex.c
notes:
use string_buf in ecdh_sha2_nistp() to avoid attempting to parse malformed data
File: kex.c
Notes:
Moved the macro LIBSSH2_KEX_METHOD_EC_SHA_HASH_CREATE_VERIFY outside of the
LIBSSH2_ECDSA since it's also now used by the ED25519 code.
Sha 256, 384 and 512 need to be defined for all backends now even if they aren't
used directly. I believe this is already the case, but just a heads up.
Credit:
Stefan-Ghinea
File: kex.c
Notes:
There is a small typo in src/kex.c.
Credit:
Tim Gates
File: session.c
Notes:
Seems the author intend to terminate banner_dup buffer, later, print it to the
debug console.
Author:
Tseng Jun
The old function would also zero pad too much bits in the
most significant byte. This lead to a reduction of key space
in the most significant byte according to the following listing:
- 8 bits reduced to 0 bits => eg. 2048 bits to 2040 bits DH key
- 7 bits reduced to 1 bits => eg. 2047 bits to 2041 bits DH key
- 6 bits reduced to 2 bits => eg. 2046 bits to 2042 bits DH key
- 5 bits reduced to 3 bits => eg. 2045 bits to 2043 bits DH key
This means the DH keyspace was previously reduced from 2047 bits
to 2041 bits (while the top and bottom bits are always set), so the
keyspace is actually always reduced from 2045 bits to 2039 bits.
Closes #521
Closes #518
agent.c: formatting
Files:
CMakeLists.txt
Notes:
Use CMAKE_INSTALL_LIBDIR directory
Credit: Arfrever
Files: kex.c
Notes:
Added key exchange group16-sha512 and group18-sha512. As a result did the
following:
Credit:
Will Cosgrove
agent.c: Recv and send all bytes via network in agent_transact_unix() (#510)
Files: agent.c
Notes:
Handle sending/receiving partial packet replies in agent.c API.
File:
Makefile.am
Notes:
No longer conditionally include OpenSSL specific test files, they aren't run if
we're not building against OpenSSL 1.1.x anyway.
Credit:
Daniel Stenberg
- [Max Dymond brought this change]
Files:
.travis.yml, configure.ac, ossfuzz
Notes:
This adds support for an OSS-Fuzz fuzzing target in ssh2_client_fuzzer,
which is a cut down example of ssh2.c. Future enhancements can improve
coverage.
Credit:
Max Dymond
Files:
mbedtls.c, mbedtls.h, .travis.yml
Notes:
This PR adds support for ECDSA for both key exchange and host key algorithms.
Credit:
Sebastián Katzer
Follow up to #224
Notes:
This cleans up a few things in the curve25519 implementation:
Credit:
David Benjamin
File: transport.c
Notes:
This is to fix #102, instead of continuing to attempt to read a disconnected
socket, it will now error out.
Credit:
TDi-jonesds
stale.yml
This commit makes the WinCNG backend first try to use the
new DH algorithm API with the raw secret derivation feature.
In case this feature is not available the WinCNG backend
will fallback to the classic approach of using RSA-encrypt
to perform the required modular exponentiation of BigNums.
Follow up to #397
Closes #484
Follow up to #397
* https://stackoverflow.com/a/56378698/149111
*
https://github.com/wbenny/mini-tor/blob/5d39011e632be8e2b6b1819ee7295e8bd9b7a769/
mini/crypto/cng/dh.inl#L355
Refs: https://github.com/alexcrichton/ssh2-rs/issues/122
Fixes: https://github.com/libssh2/libssh2/issues/388
Closes: https://github.com/libssh2/libssh2/pull/397
File: comp.c
Notes:
* Fix name clash with ZLIB macro "compress".
Credit:
Zenju
Notes:
The buildconf script is currently required, because we need to copy a
header around, because it is used both from the library and the examples
sources.
And then it means we no longer need to generate the same header twice,
so we remove the second one from configure.ac.
Now, we can just call "autoreconf -fi" to generate the autotools files,
instead of relying on the canned sequence in "buildconf", since
autoreconf has now long known what to do at the correct moment (future
versions of autotools, automake, autopoint, autoheader etc... may
require an other ordering, or other intermediate steps, etc...).
Credit:
Signed-off-by: "Yann E. MORIN" <[email protected]>
Cc: Sam Voss <[email protected]>
File: libssh2.h
Notes:
Update the min, preferred and max DH group values based on RFC 8270.
Credit:
Will Cosgrove, noted from email list by Mitchell Holland
Follow up to 2764bc8e06d51876b6796d6080c6ac51e20f3332
- tests: add support for ports published via Docker for Windows
File: INSTALL_CMAKE.md
Notes:
Although the original text would be immediately clear to seasoned users of CMAKE
and/or Unix shell, the lack of newlines may cause some confusion for newcomers.
Hence, wrapping the texts in a md code-block such that the newlines appear as
intended.
credit:
suryakalpo
Make sure all include guards exist and follow the same format.
file: transport.c
notes:
moving total_num zero length check from #476 up to the prior bounds check which
already includes a total_num check. Makes it slightly more readable.
credit:
Will Cosgrove
file:transport.c
notes:
return error if malloc(0)
credit:
lutianxiong
File:
libssh2_sftp.h
Notes:
Error constants `LIBSSH2_FX_*` are only returned by `libssh2_sftp_last_error()`
which returns `unsigned long`.
Therefore these constants should be defined as unsigned long literals, instead of
int literals.
Credit:
Dr. Koutheir Attouchi
Notes:
Fixes building on OS400. #426
Credit:
Reported-by: hjindra on github, dev by Monnerat
HACKING.CRYPTO: keep up to date with new crypto definitions from code. (#466)
File: HACKING.CRYPTO
Notes:
This commit updates the HACKING.CRYPTO documentation file in an attempt to make
it in sync with current code.
New documented features are:
SHA384
SHA512
ECDSA
ED25519
Credit:
monnerat
File: kex.c
file: os400qc3.h
notes: fixes for building libssh2 1.9.x
- [Will Cosgrove brought this change]
File: os400qc3.h
Notes: define missing EC types which prevents building
Credit: hjindra
File: hostkey.c
Notes:
These types are the same size so most compilers are fine with it, but CodeWarrior
(on classic MacOS) throws an ‘illegal implicit conversion’ error
file: Makefile.am
Notes:
The POSIX comparison operator for test(1) is =; bash supports == but not even
test from GNU coreutils does.
Credit:
Thomas Klausner
File: openssl.c
Notes:
minor changes of coding style and align preprocessor conditional for #439
Credit:
Tseng Jun
File:
Openssl.c
Notes:
* Fix for use of uninitialized aes_ctr_cipher.key_len when using
HAVE_OPAQUE_STRUCTS, regression from #439
Credit:
Hans Meirer, Tseng Jun
- [Zenju brought this change]
File: agent.c
Notes:
Fixes unicode builds for Windows in Visual Studio 16.3.2.
Credit:
Zenju
openssl.c: Fix use-after-free crash in openssl backend without memory leak (#439)
Files: openssl.c
Notes:
Fixes memory leaks and use after free AES EVP_CIPHER contexts when using OpenSSL
1.0.x.
Credit:
Hans Meier
Session.c: Fix undefined warning when mixing with LTO-enabled libcurl. (#449)
File: Session.c
Notes:
With gcc 9, libssh2, libcurl and LTO enabled for all binaries I see this
warning (error with -Werror):
Credit:
Romain-Geissler-1A
Files: transport.c
Notes:
Fixes crash with delayed compression option using Bitvise server.
Contributor:
Zenju
include/libssh2.h: fix comment: the known host key uses 4 bits (#438)
Files: openssl.c/h
Author: Zenju
Notes:
Adds support for PKIX key reading by fixing:
File: .travis.yml
Notes:
* Fix Chrome installing by using Travis build in directive
* Update to use libgcrypt20-dev package to fix 32 bit builds based on comments
found here:
https://launchpad.net/ubuntu/xenial/i386/libgcrypt11-dev
Use new API to parse data in packet_x11_open() for better bounds checking.
knownhost.c: Double the static buffer size when reading and writing known hosts
(#409)
Notes:
We had a user who was being repeatedly prompted to accept a server key
repeatedly. It turns out the base64-encoded key was larger than the static buffers
allocated to read and write known hosts. I doubled the size of these buffers.
Credit:
Michael Buckley
file: packet.c
notes:
improved parsing packet in packet_queue_listener
file: packet.c
notes:
Use _libssh2_get_string API in SSH_MSG_DEBUG/SSH_MSG_DISCONNECT. Additional
uint32 bounds check in SSH_MSG_GLOBAL_REQUEST.
Note, the builds pass, Travis is having some issues with Docker images.
file: kex.c
notes:
use _libssh2_get_string instead of kex_string_pair which does additional checks
Will Cosgrove (23 Aug 2019)
- [Fabrice Fontaine brought this change]
Notes:
This is useful for static builds so that the Libs.private field in
libssh2.pc contains correct info for the benefit of pkg-config users.
Static link with libssh2 requires this information.
Credit:
Fabrice Fontaine
files: CMakeLists.txt
credit:
jethrogb
notes:
* Adding SSH agent forwarding.
* Fix agent forwarding message, updated example.
Added integration test code and cmake target. Added example to cmake list.
credit:
pkittenis
Update EditorConfig
Added max_line_length = 80
Credit: seba30
File: misc.c
Notes: Added support for all OS' that implement EWOULDBLOCK, not only VMS
Credit: hlefebvre
userauth.c: fix off by one error when loading public keys with no id (#386)
File: userauth.c
Credit:
Etienne Samson
Notes:
Caught by ASAN:
=================================================================
==73797==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x60700001bcf0
at pc 0x00010026198d bp 0x7ffeefbfed30 sp 0x7ffeefbfe4d8
READ of size 69 at 0x60700001bcf0 thread T0
2019-07-04 08:35:30.292502+0200 atos[73890:2639175] examining
/Users/USER/*/libssh2_clar [73797]
#0 0x10026198c in wrap_memchr
(libclang_rt.asan_osx_dynamic.dylib:x86_64h+0x1f98c)
#1 0x1000f8e66 in file_read_publickey userauth.c:633
#2 0x1000f2dc9 in userauth_publickey_fromfile userauth.c:1513
#3 0x1000f2948 in libssh2_userauth_publickey_fromfile_ex userauth.c:1590
#4 0x10000e254 in test_userauth_publickey__ed25519_auth_ok publickey.c:69
#5 0x1000090c3 in clar_run_test clar.c:260
#6 0x1000038f3 in clar_run_suite clar.c:343
#7 0x100003272 in clar_test_run clar.c:522
#8 0x10000c3cc in main runner.c:60
#9 0x7fff5b43b3d4 in start (libdyld.dylib:x86_64+0x163d4)
file : openssl.c
notes :
libssh2's openssl backend has a use-after-free condition if HAVE_OPAQUE_STRUCTS
is defined and you call libssh2_init() again after prior
initialisation/deinitialisation of libssh2
File : openssl.h
Notes :
LIBSSH2_ECDSA and LIBSSH2_ED25519 are always defined so the #ifdef
checks would never be false.
Change-Id: I0a2f07c2d80178314dcb7d505d1295d19cf15afd
Credit : axjowa
Files : agent.c
Notes :
Currently the error details as returned by agent_transact_pageant() are
overwritten by a generic "agent list id failed" message by int
agent_list_identities(LIBSSH2_AGENT* agent).
Credit :
Zenju
File : Channel.c
Notes :
if _libssh2_channel_open() fails, set the error code.
Credit :
mark-i-m
File : Kex.c
Notes :
Removed call to strlen
Credit :
Orgad Shaneh
Files :
libssh2.h, libssh2_sftp.h, bcrypt_pbkdf.c, mbedtls.c, sftp.c, ssh2.c
Notes :
* Fixed misspellings
Credit :
Pedro Monreal
Issue : #383
Notes :
* Fix potential typecast error for `_libssh2_ecdsa_key_get_curve_type`
* Rename _libssh2_ecdsa_key_get_curve_type to _libssh2_ecdsa_get_curve_type
Credit :
Sebastián Katzer
1.9 Formatting
File: libgcrypt.c
Credit :
Reporter : beckmi
PR by: Alexander Curtiss
File : libssh2_priv.h
Notes :
musl prints `redirecting incorrect #include <sys/poll.h> to <poll.h>`
http://git.musl-libc.org/cgit/musl/commit/include/sys/poll.h?
id=54446d730cfb17c5f7bcf57f139458678f5066cc
poll is defined by POSIX to be in poll.h:
http://pubs.opengroup.org/onlinepubs/7908799/xsh/poll.html
Notes :
Fixed possible out of bounds memory access when reading malformed data in
diffie_hellman_sha1() and diffie_hellman_sha256().
file : transport.c
notes : move local `total_num` variable inside of if block to prevent scope
access issues which caused #360.
Files : transport.c
Issue : #360
Notes :
'p->total_num' instead of local value total_num when doing bounds check.
Credit : Doublex
Simple start to an editor config file when editing source files to make sure they
are configured correctly.
Notes :
* updated _libssh2_get_bignum_bytes and _libssh2_get_string. Now pass in length
as an argument instead of returning it to keep signedness correct. Now returns -1
for failure, 0 for success.
File : mbedtls.c
Credit: doublex
Session.c : banner_receive() from leaking when accessing non ssh ports (#356)
File : session.c
Formatting in agent.c
Removed whitespace.
file : sftp.c
notes : when sftp_packet_read() encounters an sftp packet which exceeds SFTP max
packet size it now resets the reading state so it can continue reading.
File : agent.c
Notes :
Libssh2 uses the SSH_AUTH_SOCK env variable to read the system agent location.
However, when using a custom agent path you have to set this value using setenv
which is not thread-safe. The new functions allow for a way to set a custom agent
socket path in a thread safe manor.
* Simplified _libssh2_check_length
misc.c : _libssh2_check_length()
Misc.c : _libssh2_check_length()
Ensure the requested length is less than the total length before doing the
additional bounds check
It isn't necessary.
Closes #343
Closes #342
Closes #339
Closes #334
The stale bot will automatically mark stale issues (inactive for 90
days) and if still untouched after 21 more days, close them.
See https://probot.github.io/apps/stale/
Closes #331
Closes #324
- code style: unify code style
Indent-level: 4
Max columns: 79
No spaces after if/for/while
Unified brace positions
Unified white spaces
When checking `userauth_kybd_num_prompts > 100` we don't care if it's also above
zero.
Spell OpenSS_H_ right when talking about their specific private key (#321)
When checking `userauth_kybd_num_prompts > 100` we don't care if it's also above
zero.
Spell OpenSS_H_ right when talking about their specific private key (#321)
Closes #320
Closes #323
Detected by scan-build.
Closes #310
* Bounds checks
Fixes for CVEs
https://www.libssh2.org/CVE-2019-3863.html
https://www.libssh2.org/CVE-2019-3856.html
CVE
https://www.libssh2.org/CVE-2019-3855.html
CVE
https://www.libssh2.org/CVE-2019-3859.html
* Bounds check
CVE
https://www.libssh2.org/CVE-2019-3857.html
* Bounds checking
CVE
https://www.libssh2.org/CVE-2019-3859.html
* Bounds checking
CVE
https://www.libssh2.org/CVE-2019-3859.html
Ref:
https://github.com/libssh2/libssh2/commit/8b870ad771cbd9cd29edbb3dbb0878e950f868ab
Closes https://github.com/libssh2/libssh2/pull/266
No longer used.
This commit fixes linking against an OpenSSL library that was compiled with
`no-engine` support by bypassing the initialization routines as they won't be
available anyway.