Debian Codegraph @

NEWS

raw
1 Changelog for the libssh2 project. Generated with git2news.pl
2
3 Daniel Stenberg (16 Oct 2024)
4 - RELEASE-NOTES: 1.11.1
5
6 Viktor Szakats (8 Oct 2024)
7 - RELEASE-NOTES: sync [ci skip]
8
9 - [Anders Borum brought this change]
10
11 session: support server banners up to 8192 bytes (was: 256)
12
13 If server had banner exceeding 256 bytes there wasn't enough room in
14 `_LIBSSH2_SESSION.banner_TxRx_banner`. Only the first 256 bytes would be
15 read making the first packet read fail but also dooming key exchange as
16 `session->remote.banner` didn't include everything.
17
18 This change bumps the banner buffer to 8KB to match OpenSSH.
19
20 Fixes #1442
21 Closes #1443
22
23 - RELEASE-NOTES: sync [ci skip]
24
25 - cmake: sync and improve Find modules, add `pkg-config` native detection
26
27 - sync code between Find modules.
28 - wolfssl: replace `pkg-config` hints with native detection.
29 - libgcrypt, mbedtls: add `pkg-config`-based native detection.
30 - libgcrypt: add version detection.
31 - limit `pkg-config` use for `UNIX`, vcpkg, and non-cross MinGW builds,
32 and builds with no manual customization via `*_INCLUDE_DIR` or
33 `*_LIBRARY`.
34 - replace and sync Find module header comments.
35 - ci: delete manual mbedTLS config that's now redundant.
36
37 Based on similar work done in curl.
38
39 Second attempt at #1420
40 Closes #1445
41
42 - cmake: initialize `LIBSSH2_LIBDIRS` [ci skip]
43
44 Follow-up to c87f12963037b22e6b60411c9c2d6513c06e2f03 #1466
45
46 - ci/appveyor: fix and bump OpenSSL 3 path, add path check
47
48 Follow-up to b5e68bdc37c6afa0dc777794dda8307167919d04 #1461
49 Closes #1468
50
51 - cmake: link to OpenSSL::Crypto, not OpenSSL::SSL
52
53 Follow-up to 82b09f9b3aae97f641fbcc2d746d2a6383abe857 #1322
54 Follow-up to c84745e34e53f863ffba997ceeee7d43d1c63a4b #1128
55 Cherry-picked from #1445
56 Closes #1467
57
58 - cmake: generate `LIBSSH2_PC_LIBS_PRIVATE` dynamically
59
60 Generate `LIBSSH2_PC_LIBS_PRIVATE` from `LIBSSH2_LIBS`.
61
62 Also add extra libdirs (`-L`) to `Libs` and `Libs.private`.
63
64 Logic copied from curl.
65
66 Closes #1466
67
68 - cmake: initialize `LIBSSH2_PC_REQUIRES_PRIVATE` [ci skip]
69
70 Follow-up to 0fce9dcc2909ffff5f4a1a1bc3d359fc7f409299 #1464
71
72 - cmake: add comment about `ibssh2.pc.in` variables [ci skip]
73
74 - cmake: support absolute `CMAKE_INSTALL_INCLUDEDIR`/`CMAKE_INSTALL_LIBDIR`
75
76 in `libssh2.pc`.
77
78 Also use `${exec_prefix}` (instead of `${prefix}`) as a base for `libdir`.
79
80 Closes #1465
81
82 - cmake: rename two variables and initialize them
83
84 - `LIBRARIES` -> `LIBSSH2_LIBS`
85 - `SOCKET_LIBRARIES` -> `LIBSSH2_LIBS_SOCKET`
86
87 Also initialize them before use.
88
89 Cherry-picked from #1445
90 Closes #1464
91
92 - ci/appveyor: reduce test runs (workaround for infrastructure permafails)
93
94 Jobs consistently fail to connect to the test server (run in GHA) since
95 2024-Aug-29:
96 https://ci.appveyor.com/project/libssh2org/libssh2/builds/50498393
97
98 There was an earlier phase of failures one month before that, that got
99 fixed by increasing the wait for the server in
100 bf3af90b3f1bb14cf452df7a8eb55cc9088f3e7f.
101
102 Thus, skip running tests in AppVeyor CI jobs, except: After some
103 experiments, it seems that running tests with the last OpenSSL job and
104 the last WinCrypt job _work_, which still leaves some coverage.
105 It remains to be seen how stable this is.
106
107 This is meant as a temporary fix till there is a solution to make all
108 jobs run tests reliable like up until a few months ago.
109
110 Closes #1461
111
112 - [Patrick Monnerat brought this change]
113
114 os400: drop vsprintf() use
115
116 Follow-up to discussion in #1457
117
118 Plus e-mail address update.
119
120 Closes #1462
121
122 - RELEASE-NOTES: sync [ci skip]
123
124 Daniel Stenberg (30 Sep 2024)
125 - openssl: free allocated resources when using openssl3
126
127 Reproduces consistently with curl test case 638
128
129 Closes #1459
130
131 Viktor Szakats (28 Sep 2024)
132 - checksrc: update, check all sources, fix fallouts
133
134 update from curl:
135 https://github.com/curl/curl/blob/cff75acfeca65738da8297aee0b30427b004b240/scripts/checksrc.pl
136
137 Closes #1457
138
139 - cmake: prefer `find_dependency()` in `libssh2-config.cmake`
140
141 CMake manual suggest using `find_dependency()` (over `find_package()`)
142 in `config.cmake` scripts.
143
144 Ref: https://cmake.org/cmake/help/latest/module/CMakeFindDependencyMacro.html
145
146 Closes #1460
147
148 - ci: use Ninja with cmake
149
150 Closes #1458
151
152 GitHub (27 Sep 2024)
153 - [dksslq brought this change]
154
155 Fix memory leaks in _libssh2_ecdsa_curve_name_with_octal_new and _libssh2_ecdsa_verify (#1449)
156
157 Better error handling in`_libssh2_ecdsa_curve_name_with_octal_new` and `_libssh2_ecdsa_verify` to prevent leaks.
158
159 Credit: dksslq <[email protected]>
160
161 - [rolag brought this change]
162
163 Fix unstable connections over nonblocking sockets (#1454)
164
165 The `send_existing()` function allows partially sent packets to be sent
166 fully before any further packets are sent. Originally this returned
167 `LIBSSH2_ERROR_BAD_USE` when a different caller or thread tried to send
168 an existing packet created by a different caller or thread causing the
169 connection to disconnect. Commit 33dddd2f8ac3bc81 removed the return
170 allowing any caller to continue sending another caller's packet. This
171 caused connection instability as discussed in #1397 and confused the
172 client and server causing occasional duplicate packets to be sent and
173 giving the error `rcvd too much data` as discussed in #1431. We return
174 `LIBSSH2_ERROR_EAGAIN` instead to allow existing callers to finish
175 sending their own packets.
176
177 Fixes #1397
178 Fixes #1431
179 Related #720
180
181 Credit: klux21, rolag
182
183 - [Will Cosgrove brought this change]
184
185 Prevent possible double free of hostkey (#1452)
186
187 NULL server hostkey based on fuzzer failure case.
188
189 Viktor Szakats (7 Sep 2024)
190 - cmake: tidy up syntax, minor improvements
191
192 - make internal variables underscore-lowercase.
193 - unfold lines.
194 - fold lines setting header directories.
195 - fix indent.
196 - drop interim variable `EXAMPLES`.
197 - initialize some variables before populating them.
198 - clear a variable after use.
199 - add `libssh2_dumpvars()` function for debugging.
200 - allow to override default `CMAKE_UNITY_BUILD_BATCH_SIZE`.
201 - bump up default `CMAKE_UNITY_BUILD_BATCH_SIZE` to 0 (was 32).
202 - tidy up option descriptions.
203
204 Closes #1446
205
206 - cmake: rename mbedTLS and wolfSSL Find modules
207
208 To match the curl ones.
209
210 Cherry-picked from #1445
211
212 - RELEASE-NOTES: sync [ci skip]
213
214 - cmake: fixup version detection in mbedTLS find module
215
216 - avoid warning with 2.x versions about missing header file while
217 extracting the version number.
218
219 - clear temp variables.
220
221 Closes #1444
222
223 - buildconf: drop
224
225 Use `autoreconf -fi` instead.
226
227 Follow-up to fc5d77881eb6bb179f831e626d15f4f29179aad5
228 Closes #1441
229
230 - [Michael Buckley brought this change]
231
232 Implement [email protected]
233
234 Probably the biggest and potentially most controversial change we have
235 to upstream.
236
237 Because earlier versions of OpenSSL implemented the algorithm before
238 standardization, using an older version of OpenSSL can cause problems
239 connecting to OpenSSH servers. Because of this, we use the public domain
240 reference implementation instead of the crypto backends, just like
241 OpenSSH does.
242
243 We've been holding this one for a few years. We were about to upstream
244 it around the same time as aes128gcm landed upstream, and the two
245 changes were completely incompatible. Honestly, it took me weeks to
246 reconcile these two implementations, and it could be much better.
247
248 Our original implementation changed every crypt method to decrypt the
249 entire message at once. the AESGCM implementation instead went with this
250 firstlast design, where a firstlast paramater indicates whether this is
251 the first or last call to the crypt method for each message. That added
252 a lot of bookkeeping overhead, and wasn't compatible with the chacha
253 public domain implementation.
254
255 As far as I could tell, OpenSSH uses the technique of decrypting the
256 entire message in one go, and doesn't have anything like firstlast.
257 However, I could not get out aes128gcm implementation to work that way,
258 nor could I get the chacha implementation to work with firstlast, so I
259 split it down the middle and let each implementation work differently.
260 It's kind of a mess, and probably should be cleaned up, but I don't have
261 the time to spend on it anymore, and it's probably better to have
262 everything upstream.
263
264 Fixes #584
265 Closes #1426
266
267 - tidy-up: do/while formatting
268
269 Also fix an indentation and delete empty lines.
270
271 Closes #1440
272
273 - wolfssl: drop header path hack
274
275 The wolfSSL OpenSSL headers reside in `wolfssl/openssl/*.h`.
276
277 Before this patch the wolfSSL OpenSSL compatibilty header includes were
278 shared with the native OpenSSL codepath, and used `openssl/*h`. For
279 wolfSSL builds this required a hack to append the
280 `<wolfssl-prefix>/wolfssl` directory to the header search path, to find
281 the headers.
282
283 This patch changes the source to use the correct header references,
284 allowing to drop the header path hack.
285
286 Also fix to use the correct variable to set up the header path in CMake:
287 `WOLFSSL_INCLUDE_DIRS` (was: `WOLFSSL_INCLUDE_DIR`, without the `S`)
288
289 Closes #1439
290
291 - cmake: mbedTLS detection tidy-ups
292
293 - set and use `MBEDTLS_INCLUDE_DIRS`.
294 - stop marking `MBEDTLS_LIBRARIES` as advanced.
295
296 Closes #1438
297
298 - cmake: add quotes, delete ending dirseps
299
300 Follow-up to 3fa5282d6284efba62dc591697e6a687152bdcb1 #1166
301 Closes #1437
302
303 - CI/appveyor: increase wait for SSH server on GHA [ci skip]
304
305 Blind attempt to make AppVeyor CI tests work again.
306
307 - disable DSA by default
308
309 Also:
310 - add `LIBSSH2_DSA_ENABLE` to enable it explicitly.
311 - test the above option in CI.
312 - say 'deprecated' in docs and public header.
313 - disable DSA in the CI server config.
314 (OpenSSH 9.8 no longer builds with it by default)
315 https://www.openssh.com/txt/release-9.8
316 Patch-by: Jose Quaresma
317 - disable more DSA code when not enabled.
318
319 Fixes #1433
320 Closes #1435
321
322 GitHub (30 Jul 2024)
323 - [Viktor Szakats brought this change]
324
325 tidy-up: link updates (#1434)
326
327 Marc Hoersken (27 Jul 2024)
328 - ci/GHA: revert concurrency and improve permissions
329
330 Statuses are per AppVeyor event and commit, not pull-request.
331 Also align permissions approach with curl, least priviledge.
332
333 Partially reverts b08cfbc99fa4df3459db4e1ccf4263fd260e9b15.
334
335 GitHub (23 Jul 2024)
336 - [Will Cosgrove brought this change]
337
338 Always init mbedtls_pk_context (#1430)
339
340 In the failure case, mbedtls_pk_context could be free'd without first being initialized.
341
342 - [Viktor Szakats brought this change]
343
344 mbedtls: tidy-up (#1429)
345
346 - [Will Cosgrove brought this change]
347
348 Correctly initialize values (#1428)
349
350 Fix regression with commit from #1421
351
352 Viktor Szakats (14 Jul 2024)
353 - RELEASE-NOTES: sync [ci skip]
354
355 - [Seo Suchan brought this change]
356
357 mbedtls: expose `mbedtls_pk_load_file()` for our use
358
359 While it's moved to pk_internal, it won't removed in mbedTLS 3.6 LTS
360 so it's safe to redeclare it on our side to find it.
361
362 This is implementing emergency fix suggested from
363 https://github.com/libssh2/libssh2/commit/2e4c5ec4627b3ecf4b6da16f365c011dec9a31b4#commitcomment-141379351
364
365 Follow-up to e973493f992313b3be73f51d3f7ca6d52e288558 #1393
366 Follow-up to 2e4c5ec4627b3ecf4b6da16f365c011dec9a31b4 #1349
367 Closes #1421
368
369 GitHub (13 Jul 2024)
370 - [Viktor Szakats brought this change]
371
372 ci/GHA: simplify mbedTLS build hack for autotools (#1425)
373
374 Follow-up to e973493f992313b3be73f51d3f7ca6d52e288558 #1393
375
376 - [Michael Buckley brought this change]
377
378 Always check for null pointers before calling _libssh2_bn_set_word (#1423)
379
380 - [Viktor Szakats brought this change]
381
382 ci/GHA: FreeBSD 14.1, actions bump (#1424)
383
384 - [Michael Buckley brought this change]
385
386 Increase SFTP_HANDLE_MAXLEN back to 4092 (#1422)
387
388 Match OpenSSH for compatibility.
389
390 Viktor Szakats (10 Jul 2024)
391 - ci/GHA: tidy up casing [ci skip]
392
393 - REUSE: fix typo in comment
394
395 - REUSE: shorten and improve
396
397 Follow-up to 70b8bf314cf4566a7529c5d6eae63097a926abb0 #1419
398
399 - REUSE: upgrade to `REUSE.toml`
400
401 Closes #1419
402
403 - build: stop detecting `sys/param.h` header
404
405 This header is no longer used.
406
407 Follow-up to 12427f4fb8e789adcee4a6e30974932883915e88 #1415
408 Closes #1418
409
410 - [Nicolas Mora brought this change]
411
412 tests: avoid using `MAXPATHLEN`, for portability
413
414 `MAXPATHLEN` is not present in some systems, e.g. GNU Hurd.
415
416 Co-authored-by: Viktor Szakats
417 Ref: 54bef4c5dad868a9d45fdbfca9729b191c0abab5 #198
418 Fixes #1414
419 Closes #1415
420
421 - cmake: sync formatting in `cmake/Find*` modules
422
423 - [Michael Buckley brought this change]
424
425 sftp: implement [email protected]
426
427 Add a new function `libssh2_sftp_posix_rename_ex()` and
428 `libssh2_sftp_posix_rename()`, which implement
429 the [email protected] extension.
430
431 If the server does not support this extension, the function returns
432 `LIBSSH2_FX_OP_UNSUPPORTED` and it's up to the user to recover, possibly
433 by calling `libssh2_sftp_rename()`.
434
435 Co-authored-by: Viktor Szakats (bump to size_t)
436 Closes #1386
437
438 - src: use `UINT32_MAX`
439
440 Needs to be defined for platforms missing it, e.g. VS2008.
441
442 Closes #1413
443
444 GitHub (25 Jun 2024)
445 - [Michael Buckley brought this change]
446
447 Fix a memory leak in key exchange. (#1412)
448
449 Original fix submitted as a patch by Trzik.
450
451 Co-authored-by: Michael Buckley <[email protected]>
452
453 Viktor Szakats (25 Jun 2024)
454 - RELEASE-NOTES: sync [ci skip]
455
456 - wolfssl: fix `EVP_Cipher()` use with v5.6.0 and older
457
458 Add workaround for the wolfSSL `EVP_Cipher(*p, NULL, NULL, 0)` bug to
459 make libssh2 work with wolfSSL v5.6.0 and older.
460
461 wolfSSL fixed this issue in v5.7.0:
462 https://github.com/wolfSSL/wolfssl/pull/7143
463 https://github.com/wolfSSL/wolfssl/commit/b0de0a1c95119786cf5651dd76dd7d7bdfac5a04
464
465 Without our local workaround:
466
467 - v5.3.0 and older fail most tests:
468 Ref: https://github.com/libssh2/libssh2/actions/runs/9646827522/job/26604211476#step:17:1263
469
470 - v5.4.0, v5.5.x, v5.6.0 fail these:
471 ```
472 29 - test_read-aes128-cbc (Failed)
473 30 - test_read-aes128-ctr (Failed)
474 32 - test_read-aes192-cbc (Failed)
475 33 - test_read-aes192-ctr (Failed)
476 34 - test_read-aes256-cbc (Failed)
477 35 - test_read-aes256-ctr (Failed)
478 ```
479 Ref: https://github.com/libssh2/libssh2/actions/runs/9646827522/job/26604233819#step:17:978
480
481 Oddly enough the workaround breaks OpenSSL tests, so only enable it for
482 the affected wolfSSL versions.
483
484 Also add new build-from-source wolfSSL CI job to test the new codepath.
485
486 wolfSSL has a build bug where `wolfssl/options.h` and
487 `wolfssl/version.h` are not copied to the `install` destination with
488 autotools. With CMake it has a different bug where `wolfcrypt/sp_int.h`
489 is not copied (with v5.4.0). And another with CMake where `FIPS_mode()`
490 remains missing (with v5.6.0 and earlier.)
491
492 Therefore use CMake with v5.5.4 and a workaround for `FIPS_mode()`.
493 Another option is autotools with v5.4.0 and a workaround for `install`,
494 but CMake builds quicker.
495
496 Regression-from 3c953c05d67eb1ebcfd3316f279f12c4b1d600b4 #797
497 Fixes #1020
498 Fixes #1299
499 Assisted-by: Michael Buckley via #1394
500 Closes #1394 (another attempt to fix the mentioned wolfSSL bug)
501 Closes #1407
502
503 - wolfssl: bump version in upstream issue comment [ci skip]
504
505 - wolfssl: require v5.4.0 for AES-GCM
506
507 Earlier versions crash while running tests.
508
509 This patch is part of a series of fixes to make wolfSSL AES-GCM support
510 work together with libssh2.
511
512 Possibly related is this wolfSSL bugfix patch, released in v5.4.0:
513 https://github.com/wolfSSL/wolfssl/pull/5205
514 https://github.com/wolfSSL/wolfssl/commit/fb3c611275dfe454c331baa0818445a0406c208a
515 "Fix another AES-GCM EVP control command issue"
516
517 Ref: #1020
518 Ref: #1299
519 Cherry-picked from #1407
520 Closes #1411
521
522 - tests: fix excluding AES-GCM tests
523
524 Replace hard-coded crypto backends and rely on `LIBSSH2_GCM` macro
525 to decide whether to run AES-GCM tests.
526
527 Without this, build attempted to run AES-GCM tests (and failed)
528 for crypto backends that have conditional support for this feature, e.g.
529 wolfSSL without the necessary features built-in
530 (as in before Homewbrew wolfssl 5.7.0_1, or OpenSSL v1.1.0 and older).
531
532 This patch is part of a series of fixes to make wolfSSL AES-GCM support
533 work together with libssh2.
534
535 Cherry-picked from #1407
536 Closes #1410
537
538 - ci/GHA: fix wolfSSL-from-source AES-GCM tests
539
540 Turns out these tests:
541 ```
542 31 - [email protected] (Failed)
543 36 - [email protected] (Failed)
544 ```
545 were failing because AES-GCM wasn't enabled in libssh2. This in turn
546 happened because the `WOLFSSL_AESGCM_STREAM` macro wasn't enabled while
547 building wolfSSL. Which happened because this macro isn't enabled by
548 any CMake-level wolfSSL option. Passing it as `CPPFLAGS` fixes it.
549
550 This allows enabling tests with wolfSSL 5.7.0.
551
552 Follow-up to d4cea53f53c78febad14b4caa600e25d1aaf92fd #1408
553 Closes #1409
554
555 - ci/GHA: add Linux job with latest wolfSSL built from source
556
557 After this patch it's possible to run tests with wolfSSL 5.7.0.
558
559 wolfSSL 5.7.0 fixes this bug that affects open issues #1020 and #1299:
560 https://github.com/wolfSSL/wolfssl/pull/7143
561
562 `-DWOLFSSL_OPENSSLALL=ON` is necessary for `wolfSSL_FIPS_mode()`
563
564 Closes #1408
565
566 - ci/GHA: tidy up build-from-source steps [ci skip]
567
568 - make curl downloads less verbose.
569
570 - fix cmake warning:
571 ```
572 CMake Warning:
573 No source or binary directory provided. Both will be assumed to be the
574 same as the current working directory, but note that this warning will
575 become a fatal error in future CMake releases.
576 ```
577 Ref: https://github.com/libssh2/libssh2/actions/runs/9509866494/job/26213472410#step:5:32
578
579 - [Adam brought this change]
580
581 src: fix type warning in `libssh2_sftp_unlink` macro
582
583 The `libssh2_sftp_unlink` macro was implicitly casting the `size_t`
584 returned by `strlen` to the `unsigned int` type expected by
585 `libssh2_sftp_unlink_ex`.
586
587 This fix adds an explicit cast to match similar macro definitions in
588 the same file (e.g. `libssh2_sftp_rename`, `libssh2_sftp_mkdir`).
589
590 Closes #1406
591
592 - libssh2.pc: reference mbedcrypto pkgconfig
593
594 mbedtls 3.6.0 got pkgconfig support:
595 https://github.com/Mbed-TLS/mbedtls/commit/a4d17b34f354557838e05d2cb47200e8dcaaf59b
596
597 Reference it from `libssh2.pc`.
598
599 Closes #1405
600
601 - tidy-up: typo in comment [ci skip]
602
603 - RELEASE-NOTES: sync [ci skip]
604
605 Also bump planned deprecation dates.
606
607 - ci/GHA: show configure logs on failure and other tidy-ups
608
609 - dump cmake error log on configure failure. (for cmake 3.26 and newer)
610 - dump `config.log` on autotools configure failure.
611 - convert specs filename to Windows format before passing to CMake.
612 - add missing quotes.
613
614 Closes #1403
615
616 - ci/GHA: bump parallel jobs to nproc+1
617
618 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
619
620 Closes #1402
621
622 - ci/GHA: show test logs on failure
623
624 Closes #1401
625
626 - ci/GHA: fix `Dockerfile` failing after Ubuntu package update
627
628 Likely due an upstream Ubuntu package update (requiring an apt-get
629 install call beforehand), tests run via autotools started failing with
630 no change in the libssh2 repo:
631 ```
632 FAIL: test_aa_warmup
633 ====================
634
635 Error running command 'docker build --quiet -t libssh2/openssh_server %s' (exit 256): Dockerfile:10
636 --------------------
637 8 | && apt-get clean \
638 9 | && rm -rf /var/lib/apt/lists/*
639 10 | >>> RUN mkdir /var/run/sshd
640 11 |
641 12 | # Chmodding because, when building on Windows, files are copied in with
642 --------------------
643 ERROR: failed to solve: process "/bin/sh -c mkdir /var/run/sshd" did not complete successfully: exit code: 1
644
645 Failed to build docker image
646 Cannot stop session - none started
647 Cannot stop container - none started
648 Command: docker build --quiet -t libssh2/openssh_server ../../tests/openssh_server
649 FAIL test_aa_warmup (exit status: 1)
650 ```
651 Ref: https://github.com/libssh2/libssh2/actions/runs/9322194756/job/25662748095#step:11:390
652
653 Fix it by skipping `mkdir` if `/var/run/sshd` already exists.
654
655 (Why cmake-based jobs aren't affected, I don't know.)
656
657 Ref: https://github.com/libssh2/libssh2/commit/50143d5867d35df76a6cf589ca8a13b22105aa64#commitcomment-142560875
658 Closes #1400
659
660 - ci/GHA: use ubuntu-latest with OmniOS job
661
662 It's the same as ubuntu-22.04.
663
664 Also update OmniOS package search link.
665
666 - ci: disable dependency tracking in autotools builds
667
668 For better build performance. Dependency tracking causes a build
669 overhead while compiling to help a subsequent build, but in CI there is
670 never one and the extra work is discarded.
671
672 Closes #1396
673
674 - mbedtls: fail to compile with v3.6.0 outside CI
675
676 A compile-time failure is preferred over an unexpected one at
677 runtime.
678
679 The problem is silenced with a macro in CI and this macro will have
680 to be added to more platforms when mbedTLS v3.6.0 reaches them.
681
682 Follow-up to 2e4c5ec4627b3ecf4b6da16f365c011dec9a31b4 #1349
683 Closes #1393
684
685 - tests: drop default cygpath option `-u`
686
687 - tidy-up: fix typo found by codespell
688
689 Ref: https://github.com/libssh2/libssh2/actions/runs/9224795055/job/25380857082?pr=1393#step:4:5
690
691 - ci/GHA: shell syntax tidy-up
692
693 Closes #1390
694
695 - RELEASE-NOTES: sync [ci skip]
696
697 - ci/GHA: bump NetBSD/OpenBSD, add NetBSD arm64 job
698
699 OpenBSD arm64 jobs were very slow, so skipped that.
700
701 Closes #1388
702
703 - autotools: fix to update `LDFLAGS` for each detected dependency
704
705 autotools lib detection routine failed to extend LDFLAGS for each
706 detection. This could cause successful detection of a dependency, but
707 later failing to use it. This did not cause an issue as long as all
708 dependencies lived under the same prefix, but started breaking on macOS
709 ARM + Homebrew where this was no longer true for mbedTLS and zlib in
710 particular.
711
712 Follow-up to 844115393bffb4e92c6569204cbe4cd8e553480d #1381
713 Follow-up to ae2770de25949bc7c74e60b4cc6a011bbe1d3d7c #1377
714 Closes #1384
715
716 GitHub (8 May 2024)
717 - [Michael Buckley brought this change]
718
719 OpenSSL 3: Fix calculating DSA public key (#1380)
720
721 Viktor Szakats (8 May 2024)
722 - ci/GHA: tidy-up wolfSSL autotools config on macOS
723
724 Closes #1383
725
726 - ci/GHA: shorter mbedTLS autotools workaround
727
728 Follow-up to 844115393bffb4e92c6569204cbe4cd8e553480d #1381
729 Closes #1382
730
731 GitHub (8 May 2024)
732 - [Michael Buckley brought this change]
733
734 ci: fix mbedtls runners on macOS (#1381)
735
736 Sets LDFLAGS while configuring the autoconf mbedTLS build for macOS.
737
738 Viktor Szakats (29 Apr 2024)
739 - RELEASE-NOTES: sync [ci skip]
740
741 - [binary1248 brought this change]
742
743 wincng: fix `DH_GEX_MAXGROUP` set higher than supported
744
745 In 1c3a03ebc3166cf69735111aba2b8cee57cdba51 #493,
746 `LIBSSH2_DH_GEX_MAXGROUP` was introduced to specify
747 crypto-backend-specific modulus sizes. Unfortunately, the max size for
748 the wincng DH modulus was defined to 8192, probably because this is the
749 value most other backends support.
750
751 According to Microsoft documentation [1], `BCryptGenerateKeyPair`
752 currently only supports up to 4096-bit keys when the selected algorithm
753 is `BCRYPT_DH_ALGORITHM`. Requesting larger keys when calling
754 `BCryptGenerateKeyPair` in `_libssh2_dh_key_pair` always results in
755 `STATUS_INVALID_PARAMETER` being returned and ultimately key exchange
756 failing.
757
758 When attempting to connect to any server that offers 8192 bit DH, this
759 causes key exchange to always fail when using the wincng backend.
760 Reducing `LIBSSH2_DH_GEX_MAXGROUP` to 4096 fixes the issue.
761
762 [1] https://learn.microsoft.com/en-us/windows/win32/api/bcrypt/nf-bcrypt-bcryptgeneratekeypair
763
764 Closes #1372
765
766 - build: silence warnings inside `FD_SET()`/`FD_ISSET()` macros
767
768 Use an ugly workaround to silence `-Wsign-conversion` warnings triggered
769 by the internals of `FD_SET()`/`FD_ISSET()` macros. They've been showing
770 up in OmniOS CI builds when compiling `example` programs. They also have
771 been seen with older Cygwin and other envs and configurations.
772
773 Also scope two related variables in examples.
774
775 E.g.:
776 ```
777 ../../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]
778 251 | FD_SET(forwardsock, &fds);
779 | ^~~~~~
780 ../../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]
781 ../../example/direct_tcpip.c:251:9: warning: conversion to 'long unsigned int' from 'long int' may change the sign of the result [-Wsign-conversion]
782 ../../example/direct_tcpip.c:251:9: warning: conversion to 'long int' from 'long unsigned int' may change the sign of the result [-Wsign-conversion]
783 ../../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]
784 259 | if(rc && FD_ISSET(forwardsock, &fds)) {
785 | ^~~~~~~~
786 ../../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]
787 ../../example/direct_tcpip.c:259:18: warning: conversion to 'long unsigned int' from 'long int' may change the sign of the result [-Wsign-conversion]
788 ```
789 Ref: https://github.com/libssh2/libssh2/actions/runs/8854199687/job/24316762831#step:3:2020
790
791 Closes #1379
792
793 - autotools: use `AM_CFLAGS`
794
795 Use `AM_CFLAGS` to pass custom, per-target C flags. This replaces using
796 `CFLAGS` which triggered this warning when running `autoreconf -fi`:
797 ```
798 tests/Makefile.am:8: warning: 'CFLAGS' is a user variable, you should not override it;
799 tests/Makefile.am:8: use 'AM_CFLAGS' instead
800 ```
801 (Only for `tests`, even though `example` and `src` also used this
802 method. The warning is also missing from curl, that also uses
803 `CFLAGS`.)
804
805 Follow-up to 3ec53f3ea26f61cbf2e0fbbeccb852fca7f9b156 #1286
806 Closes #1378
807
808 GitHub (25 Apr 2024)
809 - [Viktor Szakats brought this change]
810
811 ci/GHA: fix gcrypt with autotools/macOS/Homebrew/ARM64 (#1377)
812
813 mbedtls configure fails to detect anything due to this:
814 ```
815 configure:23101: gcc -o conftest -g -O2 -I/opt/homebrew/include conftest.c -lmbedcrypto -lz >&5
816 ld: library 'mbedcrypto' not found
817 clang: error: linker command failed with exit code 1 (use -v to see invocation)
818 ```
819
820 Viktor Szakats (25 Apr 2024)
821 - autotools: delete bogus square bracket from help text [ci skip]
822
823 Follow-up to 3f98bfb0900b5e68445a339cfebc60b307a24650 #1368
824
825 GitHub (25 Apr 2024)
826 - [Viktor Szakats brought this change]
827
828 ci/GHA: fix verbose option for autotools jobs (#1376)
829
830 Also enable verbose for macOS `make` step.
831
832 - [Viktor Szakats brought this change]
833
834 ci/GHA: dump `config.log` on failure for macOS autotools jobs (#1375)
835
836 - [Viktor Szakats brought this change]
837
838 ci/GHA: fix `autoreconf` failure on macOS/Homebrew (#1374)
839
840 By manually installing `libtool`.
841
842 ```
843 autoreconf -fi
844 shell: /bin/bash -e {0}
845 configure.ac:75: error: possibly undefined macro: AC_LIBTOOL_WIN32_DLL
846 If this token and others are legitimate, please use m4_pattern_allow.
847 See the Autoconf documentation.
848 configure.ac:76: error: possibly undefined macro: AC_PROG_LIBTOOL
849 autoreconf: error: /opt/homebrew/Cellar/autoconf/2.72/bin/autoconf failed with exit status: 1
850 ```
851 Ref: https://github.com/libssh2/libssh2/actions/runs/8833608758/job/24253334557#step:4:1
852
853 - [Viktor Szakats brought this change]
854
855 ci/GHA: fixup Homebrew location (for ARM runners) (#1373)
856
857 GHA macOS runners became ARM64 machines. Make the Homebrew prefix
858 dynamic to adapt to these installations.
859
860 Viktor Szakats (14 Apr 2024)
861 - RELEASE-NOTES: sync [ci skip]
862
863 - [Patrick Monnerat brought this change]
864
865 os400: Add two recent files to the distribution
866
867 Closes #1364
868
869 - wincng: add to ci/GHA, add `./configure` option `--enable-ecdsa-wincng`
870
871 - add `./configure` option `--enable-ecdsa-wincng`
872
873 - add WinCNG autotools jobs to GHA.
874
875 - enable WinCNG ECDSA in some GHA jobs (both CMake and autotools).
876
877 Follow-up to 3e72343737e5b17ac98236c03d5591d429b119ae #1315
878 Closes #1368
879
880 GitHub (14 Apr 2024)
881 - [Johannes Passing brought this change]
882
883 wincng: add ECDSA support for host and user authentication (#1315)
884
885 The WinCNG backend currently only supports DSA and RSA. This PR
886 adds ECDSA support for host and user authentication.
887
888 * Disable WinCNG ECDSA support by default to maintain backward
889 compatibility for projects that target versions below Windows 10.
890
891 * Add cmake option `ENABLE_ECDSA_WINCNG` to guard ECDSA support.
892
893 * Update AppVeyor job matrix to only enable ECDSA on Server 2016+
894
895 Viktor Szakats (14 Apr 2024)
896 - ci: enable Unity mode for most CMake builds
897
898 Ref: 7129ea9ca8cca86dac80a6bac2d63937987efe9d #1034
899 Closes #1367
900
901 - os400: fix shellcheck warnings in scripts (fixups)
902
903 - Build scripts must be executed by the os/400 shell (sh), not bash which
904 is a PASE program: The `-ot` non-POSIX test extension works in os/400 as
905 well. Ref: https://github.com/libssh2/libssh2/pull/1364#issue-2241646754
906
907 - Drop/fixup mods trying to make some syntax highlighters happier.
908
909 Follow-up to c6625707b94d9093f38f1a0a4d89c11b64f12ba8 #1358
910 Assisted-by: Patrick Monnerat
911 Closes #1364
912 Closes #1366
913
914 - cmake: style tidy-up (more)
915
916 Follow-up to 3fa5282d6284efba62dc591697e6a687152bdcb1 #1166
917 Closes #1365
918
919 - RELEASE-NOTES: sync [ci skip]
920
921 - os400: fix shellcheck warnings in scripts
922
923 - use `$()` instead of backticks, and re-arrange double-quotes inside.
924 - add missing `|| exit 1` to `cd` calls. (could be dropped by using `set -eu`.)
925 - add `-n` to a few `if`s.
926 - shorten redirections by using `{} >` (as shellcheck recommended).
927 - silence warnings where variables were detected as unused (SC2034).
928 - a couple misc updates to silence warnings.
929 - switch to bash shebang for `-ot` feature.
930 - split two lines to unbreak syntax highlighting in my editor. (`$(expr \`, `$(dirname \`)
931
932 Also enable CI checks for OS/400 shell scripts.
933
934 Ref: d88b9bcdafe9d19aad2fb120d0a0acb3edab64f7
935 Closes #1358
936
937 - RELEASE-NOTES: sync [ci skip]
938
939 - ci: add shellcheck job and script
940
941 Add FIXME for OS/400 scripts.
942
943 Cherry-picked from #1358
944
945 - tests: fix shellcheck issues in `test_sshd.test`
946
947 Cherry-picked from #1358
948
949 - RELEASE-NOTES: sync [ci skip]
950
951 GitHub (9 Apr 2024)
952 - [Viktor Szakats brought this change]
953
954 ci/appveyor: re-enable OpenSSL 3, also bump to 3.2.1 (#1363)
955
956 Ref: 104744f4a523de574ce3767c50948d9b8385be4c #1348
957
958 Viktor Szakats (9 Apr 2024)
959 - ci: use a better test timestamp [ci skip]
960
961 Mar 27 2024 08:00:00 GMT+0000
962
963 Follow-up to 2d765e454d98b794a5e5bbc497b1fcba4a9b8c4b #1360
964
965 GitHub (9 Apr 2024)
966 - [Viktor Szakats brought this change]
967
968 ci: verify build and install from tarball (#1362)
969
970 Install verification based on:
971 https://github.com/curl/curl/blob/28c5ddf13ac311d10bc4e8f9fc4ce0858a19b888/scripts/installcheck.sh
972
973 Viktor Szakats (9 Apr 2024)
974 - tidy-up: dir names, command-line [ci skip]
975
976 Follow-up to 2d765e454d98b794a5e5bbc497b1fcba4a9b8c4b #1360
977
978 - cmake: tidy up function name casing in `CopyRuntimeDependencies.cmake`
979
980 Use lowercase to match callers.
981
982 GitHub (9 Apr 2024)
983 - [Viktor Szakats brought this change]
984
985 ci: add reproducibility test for `maketgz` (#1360)
986
987 Viktor Szakats (9 Apr 2024)
988 - maketgz: add reproducible dir entries to tarballs
989
990 In the initial implementation of reproducible tarballs, they were
991 missing directory entries, while .zip archives had them. It meant
992 that on extracting the tarball, on-disk directory entries got the
993 current timestamp.
994
995 This patch fixes this by including directory entries in the tarball,
996 with reproducible timestamps. It also moves sorting inside tar,
997 to ensure reproducible directory entry timestamps on extract
998 (without the need of `--delay-directory-restore` option, when
999 extracting with GNU tar. BSD tar got that right by default.)
1000
1001 GNU tar 1.28 (2014-07-28) introduced `--sort=`.
1002
1003 Follow-up to d52fe1b4358fab891037d86b5c73c098079567db #1357
1004 Closes #1359
1005
1006 - ci/GHA: improve version number in `maketgz` test
1007
1008 Follow-up to cba7f97506c1b8e5ff131bbbc57b5796ac634c56 #1353
1009
1010 GitHub (8 Apr 2024)
1011 - [Michael Buckley brought this change]
1012
1013 src: check the return value from `_libssh2_bn_*()` functions (#1354)
1014
1015 Found by oss-fuzz. In `diffie_hellman_sha_algo()`, we were calling
1016 `_libssh2_bn_from_bin()` with data recieved by the server without
1017 checking whether that data was zero-length or ridiculously long.
1018 In the OpenSSL backend, this would cause `_libssh2_bn_from_bin()`
1019 to fail an allocation, which would eventually lead to a NULL
1020 dereference when the bignum was used.
1021
1022 Add the same check for `_libssh2_bn_set_word()` and
1023 `_libssh2_bn_to_bin()`.
1024
1025 Viktor Szakats (8 Apr 2024)
1026 - maketgz: reproducible tarballs/zip, display tarball hashes
1027
1028 - support `SOURCE_DATE_EPOCH` for reproducibility.
1029 - make tarballs reproducible.
1030 - make file timestamps in tarball/zip reproducible.
1031 - make directory timestamps in zip reproducible.
1032 - make timestamps of tarballs/zip reproducible.
1033 - make file order in tarball/zip reproducible.
1034 - use POSIX ustar tarball format to avoid supply chain vulnerability: https://seclists.org/oss-sec/2021/q4/0
1035 - make uid/gid in tarball reproducible.
1036 - omit owner user/group names from tarball for reproducibility and privacy.
1037 - omit current timestamp from .gz header for reproducibility.
1038 - display SHA-256 hashes of produced tarballs/zip. (Requires `sha256sum`)
1039 - re-sync formatting with curl's `maketgz`.
1040
1041 Closes #1357
1042
1043 - maketgz: `set -eu`, reproducibility, improve zip, add CI test
1044
1045 - set bash `-eu`.
1046 - fix bash `-eu` issues.
1047 - apply `TZ=UTC` and `LC_ALL=C` for reproducibility.
1048 - sort `.zip` entries for reproducibility.
1049 - zip with `--no-extra` for reproducibliity.
1050 - use maximum zip compression.
1051 - add the gpg sign command-line. Copied from curl.
1052 - add CI test for `maketgz`.
1053
1054 Closes #1353
1055
1056 - RELEASE-NOTES: sync and cleanups [ci skip]
1057
1058 GitHub (3 Apr 2024)
1059 - [Tejaswikandula brought this change]
1060
1061 Support RSA SHA2 cert-based authentication (rsa-sha2-512_cert and rsa-sha2-256_cert) (#1314)
1062
1063 Replicating OpenSSH's behavior to handle RSA certificate authentication
1064 differently based on the remote server version.
1065
1066 1. For OpenSSH versions >= 7.8, ascertain server's support for RSA Cert
1067 types by checking if the certificate's signature type is present in
1068 the `server-sig-algs`.
1069
1070 2. For OpenSSH versions < 7.8, Set the "SSH_BUG_SIGTYPE" flag when the
1071 RSA key in question is a certificate to ignore `server-sig-algs` and
1072 only offer ssh-rsa signature algorithm for RSA certs.
1073
1074 This arises from the fact that OpenSSH versions up to 7.7 accept
1075 RSA-SHA2 keys but not RSA-SHA2 certificate types. Although OpenSSH <=7.7
1076 includes RSA-SHA2 keys in the `server-sig-algs`, versions <=7.7 do not
1077 actually support RSA certs. Therefore, server sending RSA-SHA2 keys in
1078 `server-sig-algs` should not be interpreted as indicating support for
1079 RSA-SHA2 certs. So, `server-sig-algs` are ignored when the RSA key in
1080 question is a cert, and the remote server version is 7.7 or below.
1081
1082 Relevant sections of the OpenSSH source code:
1083
1084 <https://github.com/openssh/openssh-portable/blob/V_8_9_P1/sshconnect2.c#L1191-L1197>
1085 <https://github.com/openssh/openssh-portable/blob/master/compat.c#L43>
1086
1087 Assisted-by: Will Cosgrove
1088 Reviewed-by: Viktor Szakats
1089
1090 Viktor Szakats (3 Apr 2024)
1091 - RELEASE-NOTES: sync [ci skip]
1092
1093 Also fix to include 3-digit issue/PR references.
1094
1095 - mbedtls: add workaround + FIXME to build with 3.6.0
1096
1097 This is just a stub to make `_libssh2_mbedtls_ecdsa_new_private`
1098 compile.
1099
1100 mbedtls 3.6.0 silently deleted its public API `mbedtls_pk_load_file`,
1101 which this function relies on.
1102
1103 Closes #1349
1104
1105 GitHub (3 Apr 2024)
1106 - [Viktor Szakats brought this change]
1107
1108 ci/appveyor: OpenSSL 3 no longer found by CMake, revert to 1.1.1 (#1348)
1109
1110 Ref: https://github.com/appveyor/build-images/commit/702e8cdca01f28f6a40687783f493c786cebbe2c
1111 Ref: https://github.com/appveyor/build-images/pull/149
1112
1113 Viktor Szakats (3 Apr 2024)
1114 - docs: improve `libssh2_userauth_publickey_from*` manpages
1115
1116 Reported-by: Lyndon Brown
1117 Assisted-by: Ryan Kelley
1118 Fixes #652
1119 Closes #1308
1120 Closes #xxxx
1121
1122 - RELEASE-NOTES: sync [ci skip]
1123
1124 GitHub (2 Apr 2024)
1125 - [Viktor Szakats brought this change]
1126
1127 test debian:testing-slim post xz backdoor removal (#1346)
1128
1129 The unexplained CI fallouts are gone with the latest debian:testing (20240330).
1130
1131 Ref #1328 #1329 #1338.
1132 Closes #1346
1133
1134 Viktor Szakats (30 Mar 2024)
1135 - ci: use Linux runner for BSDs, add arm64 FreeBSD 14 job
1136
1137 - bump cross-platform-actions to 0.23.0.
1138 Ref: https://github.com/cross-platform-actions/action/releases/tag/v0.23.0
1139
1140 - switch to Linux runners (from macOS) for cross-platform-actions.
1141 It's significantly faster.
1142
1143 - switch back FreeBSD 14 job to cross-platform-actions.
1144 Also switch back to default shell.
1145
1146 - add FreeBSD 14 arm64 job.
1147
1148 Closes #1343
1149
1150 - ci: use single quotes in yaml [ci skip]
1151
1152 - ci: tidy-up job order [ci skip]
1153
1154 - build: drop `-Wformat-nonliteral` warning suppressions
1155
1156 Also markup a vararg function as such.
1157
1158 In functions marked up as vararg functions, there is no need to suppress
1159 `-Wformat-nonliteral` warnings. It's done automatically by the compiler.
1160
1161 Closes #1342
1162
1163 - ci: delete flaky FreeBSD 13.2 job
1164
1165 Keep FreeBSD 14.
1166
1167 - RELEASE-NOTES: sync [ci skip]
1168
1169 - example: restore `sys/time.h` for AIX
1170
1171 In AIX, `time.h` header file doesn't have definitions like
1172 `fd_set`, `struct timeval`, which are found in `sys/time.h`.
1173
1174 Add `sys/time.h` to files affected when available.
1175
1176 Regression from e53aae0e16dbf53ddd1a4fcfc50e365a15fcb8b9 #1001.
1177
1178 Reported-by: shubhamhii on GitHub
1179 Assisted-by: shubhamhii on GitHub
1180 Fixes #1334
1181 Fixes #1335
1182 Closes #1340
1183
1184 - userauth: avoid oob with huge interactive kbd response
1185
1186 - If the length of a response is `UINT_MAX - 3` or larger, an unsigned
1187 integer overflow occurs on 64-bit systems. Avoid such truncation to
1188 always allocate enough memory to avoid subsequent out of boundary
1189 writes.
1190
1191 Patch-by: Tobias Stoeckmann
1192
1193 - also add FIXME to bump up length field to `size_t` (ABI break)
1194
1195 Closes #1337
1196
1197 GitHub (28 Mar 2024)
1198 - [Josef Cejka brought this change]
1199
1200 transport: check ETM on remote end when receiving (#1332)
1201
1202 We should check if encrypt-then-MAC feature is enabled in remote end's
1203 configuration.
1204
1205 Fixes #1331
1206
1207 - [Josef Cejka brought this change]
1208
1209 kex: always add extension indicators to kex_algorithms (#1327)
1210
1211 KEX pseudo-methods "ext-info-c" and "[email protected]"
1212 are in default kex method list but they were lost after configuring
1213 custom kex method list in libssh2_session_method_pref().
1214
1215 Fixes #1326
1216
1217 - [Jiwoo Park brought this change]
1218
1219 cmake: use the imported target of FindOpenSSL module (#1322)
1220
1221 * Use the imported target of FindOpenSSL module
1222 * Build libssh2 before test runner
1223 * Use find_package() in the CMake config file
1224 * Use find_dependency() rather than find_package()
1225 * Install CMake module files and use them in the config file
1226 * Use elseif() to choose the crypto backend
1227
1228 - [Andrei Augustin brought this change]
1229
1230 docs: update INSTALL_AUTOTOOLS (#1316)
1231
1232 corrected --with-libmbedtls-prefix to current option --with-libmbedcrypto-prefix
1233
1234 Viktor Szakats (28 Mar 2024)
1235 - ci: don't parallelize `distcheck` job
1236
1237 A while ago the `distcheck` CI job became flaky. This continued after
1238 switching to Debian stable (from testing). Try stabilzing it by running
1239 it single-threaded.
1240
1241 Closes #1339
1242
1243 - Dockerfile: switch to Debian stable (from testing)
1244
1245 This fixes flakiness experienced recently with two OpenSSL jobs and one
1246 libgcrypt job, and/or intermittently causing all Docker-based tests to
1247 fail.
1248
1249 Reported-by: András Fekete
1250 Fixes #1328
1251 Fixes #1329
1252 Closes #1338
1253
1254 GitHub (22 Feb 2024)
1255 - [Michael Buckley brought this change]
1256
1257 Supply empty hash functions for mac_method_hmac_aesgcm to avoid a crash when e.g. setting LIBSSH2_METHOD_CRYPT_CS (#1321)
1258
1259 - [Michael Buckley brought this change]
1260
1261 gen_publickey_from_dsa: Initialize BIGNUMs to NULL for OpenSSL 3 (#1320)
1262
1263 Viktor Szakats (23 Jan 2024)
1264 - RELEASE-NOTES: add algo deprecation notices [ci skip]
1265
1266 Closes #1307
1267
1268 - RELEASE-NOTES: sync [ci skip]
1269
1270 GitHub (22 Jan 2024)
1271 - [Juliusz Sosinowicz brought this change]
1272
1273 wolfssl: enable debug logging in wolfSSL when compiled in (#1310)
1274
1275 Co-authored-by: Viktor Szakats
1276
1277 - [monnerat brought this change]
1278
1279 os400: maintain up to date (#1309)
1280
1281 - Handle MD5 conditionals in os400qc3.
1282 - Check for errors in os400qc3 pbkdf1.
1283 - Implement an optional build options override file.
1284 - Sync ILE/RPG copy files with current C header files.
1285 - Allow a null session within a string conversion cache.
1286 - Add an ILE/RPG example.
1287 - Adjust outdated copyrights in changed files.
1288
1289 Viktor Szakats (18 Jan 2024)
1290 - RELEASE-NOTES: sync
1291
1292 - src: check hash update/final success
1293
1294 Also:
1295 - delete unused internal macro `libssh2_md5()` where defined.
1296 - prefix `libssh2_os400qc3_hash*()` function names with underscore.
1297 These are public/visible, but internal.
1298 - add FIXMEs to OS/400 code to verify update/final calls; some OS API,
1299 some internal.
1300
1301 Ref: https://github.com/libssh2/libssh2/pull/1301#discussion_r1446861650
1302 Reviewed-by: Michael Buckley
1303 Reviewed-by: Patrick Monnerat
1304 Closes #1303
1305
1306 - RELEASE-NOTES: sync [ci skip]
1307
1308 GitHub (18 Jan 2024)
1309 - [Ryan Kelley brought this change]
1310
1311 openssl: fix cppcheck found NULL dereferences (#1304)
1312
1313 * Fix NULL dereference in gen_publickey_from_rsa_evp and
1314 gen_publickey_from_dsa_evp.
1315 * Add checks for en_publickey_from_ec_evp and en_publickey_from_ed_evp
1316
1317 Viktor Szakats (12 Jan 2024)
1318 - openssl: delete internal `read_openssh_private_key_from_memory()`
1319
1320 It was wrapping another internal function with no added logic.
1321
1322 Closes #1306
1323
1324 - openssl: formatting/whitespace
1325
1326 Also use `NULL` instead of `0` for pointers.
1327
1328 Closes #1305
1329
1330 - HACKING-CRYPTO: more fixups [ci skip]
1331
1332 Follow-up to f64885b6ab9bbdae2da9ebd70f4dd5cea56e838a #1297
1333
1334 - HACKING-CRYPTO: fixups [ci skip]
1335
1336 Follow-up to f64885b6ab9bbdae2da9ebd70f4dd5cea56e838a #1297
1337
1338 - RELEASE-NOTES: sync [ci skip]
1339
1340 - src: check hash init success
1341
1342 Before this patch, SHA2 and SHA1 init function results were cast to
1343 `void`. This patch makes sure to verify these values.
1344
1345 Also:
1346 - exclude an `assert(0)` from release builds in `_libssh2_sha_algo_ctx_init()`.
1347 (return error instead)
1348 - fix indentation / whitespace
1349
1350 Reviewed-by: Michael Buckley
1351 Closes #1301
1352
1353 - mac: handle low-level errors
1354
1355 - update low-level hmac functions from macros to functions.
1356 - libgcrypt: propagate low-level hmac errors.
1357 - libgcrypt: add error checks for hmac calls.
1358 - os400qc3: add error checks, propagate them.
1359 Assisted-by: Patrick Monnerat
1360 - mbedtls: fix propagating low-level hmac errors.
1361 - wincng: fix propagating low-level hmac errors.
1362 - mac: verify success of low-level hmac functions.
1363 - knownhost: verify success of low-level hmac functions.
1364 - transport: verify success of MAC hash call.
1365 - minor type cleanup in wincng.
1366 - delete unused ripemd wrapper in wincng.
1367 - delete unused SHA384 wrapper in mbedtls.
1368
1369 Reported-by: Paul Howarth
1370 Reviewed-by: Michael Buckley
1371 Closes #1297
1372
1373 GitHub (8 Jan 2024)
1374 - [Michael Buckley brought this change]
1375
1376 Fix an out-of-bounds read in _libssh2_kex_agree_instr when searching for a KEX not in the server list (#1302)
1377
1378 Viktor Szakats (21 Dec 2023)
1379 - RELEASE-NOTES: sync [ci skip]
1380
1381 - ci/appveyor: re-enable parallel mode
1382
1383 The comment cited earlier is no longer true with recent CMake versions.
1384 This options does actually enable parallel builds with MSVC since CMake
1385 v3.26.0: https://gitlab.kitware.com/cmake/cmake/-/issues/20564
1386
1387 The effect isn't much for libssh2, because it spends most time in tests,
1388 but let's enable it anyway for efficiency.
1389
1390 Ref: 0d08974633cfc02641e6593db8d569ddb3644255 #884
1391 Ref: 7a039d9a7a2945c10b4622f38eeed21ba6b4ec55 #867
1392
1393 Closes #1294
1394
1395 - ci/gha: review/fixup auto-cancel settings
1396
1397 - use the group expression from `reuse.yml` (via curl).
1398 - add auto-cancel for `ci` and `cifuzz`.
1399 - add auto-cancel to `appveyor_docker`. I'm just guessing here.
1400 The hope is that it fixes AppVeyor CI runs when re-pushing a PR.
1401 This frequently caused the freshly pushed session to fail waiting for
1402 a connection.
1403 - sync group expression in `appveyor_status` with `reuse`.
1404
1405 Closes #1292
1406
1407 - RELEASE-NOTES: fix casing in GitHub names [ci skip]
1408
1409 - RELEASE-NOTES: synced [ci skip]
1410
1411 Closes #1279
1412
1413 - [Michael Buckley brought this change]
1414
1415 src: add 'strict KEX' to fix CVE-2023-48795 "Terrapin Attack"
1416
1417 Refs:
1418 https://terrapin-attack.com/
1419 https://seclists.org/oss-sec/2023/q4/292
1420 https://osv.dev/list?ecosystem=&q=CVE-2023-48795
1421 https://github.com/advisories/GHSA-45x7-px36-x8w8
1422 https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2023-48795
1423
1424 Fixes #1290
1425 Closes #1291
1426
1427 - session: add `libssh2_session_callback_set2()`
1428
1429 Add new `libssh2_session_callback_set2()` API that deprecates
1430 `libssh2_session_callback_set()`.
1431
1432 The new implementation offers the same functionality, but accepts and
1433 returns a generic function pointer (of type `libssh2_cb_generic *`), as
1434 opposed to the old function that used data pointers (`void *`). The new
1435 solution thus avoids data to function (and vice versa) pointer
1436 conversions, which has undefined behaviour in standard C.
1437
1438 About the name: It seems the `*2` suffix was used in the past for
1439 replacement functions for deprecated ones. Let's stick with that.
1440 `*_ex` was preferred for new functions that extend existing ones with
1441 new features.
1442
1443 Closes #1285
1444
1445 - build: enable `-pedantic-errors`
1446
1447 According to the manual, this isn't the same as `-Werror -pedantic`.
1448 Enable it together with `-Werror`.
1449
1450 https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#index-pedantic-errors-1
1451
1452 This option results in autotools feature detection going into crazies.
1453 To avoid this, we add it to `CFLAGS` late. Idea copied from curl.
1454
1455 This option has an effect only with gcc 5.0 and newer as of this commit.
1456 Let's enable it for clang and older versions too for simplicity. Ref:
1457 https://github.com/curl/curl/commit/d5c0351055d5709da8f3e16c91348092fdb481aa
1458 https://github.com/curl/curl/pull/2747
1459
1460 Closes #1286
1461
1462 - build: add mingw-w64 support to `LIBSSH2_PRINTF()` attribute
1463
1464 And fix the warning it detected.
1465
1466 Closes #1287
1467
1468 - libssh2.h: add deprecated function warnings
1469
1470 With deprecated-at versions and suggested replacement function.
1471
1472 It's possible to silence them by defining `LIBSSH2_DISABLE_DEPRECATION`.
1473
1474 Also add depcreated-at versions to documentation, and unify wording.
1475
1476 Ref: https://github.com/libssh2/libssh2/pull/1260#issuecomment-1837017987
1477 Closes #1289
1478
1479 - ci/spellcheck: delete redundant option [ci skip]
1480
1481 `--check-hidden` not necessary when passing filenames explicitly.
1482
1483 Follow-up to a79218d3a058a333bb9de14079548a3511679a04
1484
1485 - tidy-up: add empty line for clarity [ci skip]
1486
1487 - build: FIXME `-Wsign-conversion` to be errors [ci skip]
1488
1489 - src: disable `-Wsign-conversion` warnings, add option to re-enable
1490
1491 To avoid the log noise till we fix those ~360 compiler warnings.
1492
1493 Also add macro `LIBSSH2_WARN_SIGN_CONVERSION` to re-enable them.
1494
1495 Follow-up to afa6b865604019ab27ec033294edfe3ded9ae0c0 #1257
1496
1497 Closes #1284
1498
1499 - cmake: fix indentation [ci skip]
1500
1501 - example, tests: call `WSACleanup()` for each `WSAStartup()`
1502
1503 On Windows.
1504
1505 Closes #1283
1506
1507 - RELEASE-NOTES: update credits [ci skip]
1508
1509 Ref: https://github.com/libssh2/libssh2/pull/1241#issuecomment-1830118584
1510
1511 - RELEASE-NOTES: avoid splitting names, fix typo, refine order [ci skip]
1512
1513 - RELEASE-NOTES: synced [ci skip]
1514
1515 - add portable `LIBSSH2_SOCKET_CLOSE()` macro
1516
1517 Add `LIBSSH2_SOCKET_CLOSE()` to the public `libssh2.h` header, for user
1518 code. It translates to `closesocket()` on Windows and `close()` on other
1519 platforms.
1520
1521 Use it in example code.
1522
1523 It makes them more readable by reducing the number of `_WIN32` guards.
1524
1525 Closes #1278
1526
1527 - ci: add FreeBSD 14 job, fix issues
1528
1529 - install bash to fix error when running tests:
1530 ```
1531 ERROR: test_sshd.test - missing test plan
1532 ERROR: test_sshd.test - exited with status 127 (command not found?)
1533 =====================================
1534 [...]
1535 # TOTAL: 4
1536 # PASS: 2
1537 # SKIP: 0
1538 # XFAIL: 0
1539 # FAIL: 0
1540 # XPASS: 0
1541 # ERROR: 2
1542 [...]
1543 env: bash: No such file or directory
1544 ```
1545 Ref: https://github.com/libssh2/libssh2/actions/runs/7133852508/job/19427420687#step:3:3998
1546
1547 - fix sshd issue when running tests:
1548 ```
1549 # sshd log:
1550 # Server listening on :: port 4711.
1551 # Server listening on 0.0.0.0 port 4711.
1552 # Authentication refused: bad ownership or modes for file /home/runner/work/libssh2/libssh2/tests/key_rsa.pub
1553 # Authentication refused: bad ownership or modes for file /home/runner/work/libssh2/libssh2/tests/openssh_server/authorized_keys
1554 ```
1555 Ref: https://github.com/libssh2/libssh2/actions/runs/7134629175/job/19429828342#step:3:4059
1556
1557 Cherry-picked from #1277
1558 Closes #1277
1559
1560 - ci: add OmniOS job, fix issues
1561
1562 - use GNU Make, to avoid errors:
1563 ```
1564 make: Fatal error in reader: Makefile, line 983: Badly formed macro assignment
1565 ```
1566 Ref: https://github.com/libssh2/libssh2/actions/runs/7134629175/job/19429838379#step:3:1956
1567
1568 Caused by `?=` in `Makefile.am`. Fix it just in case.
1569
1570 ```
1571 make: Fatal error in reader: Makefile, line 438: Unexpected end of line seen
1572 ```
1573 Ref: https://github.com/libssh2/libssh2/actions/runs/7135524843/job/19432451767#step:3:1966
1574
1575 It's around line 43 in `Makefile.am`, reason undiscovered.
1576
1577 - fix error:
1578 ```
1579 ../../src/hostkey.c:1227:44: error: pointer targets in passing argument 5 of '_libssh2_ed25519_sign' differ in signedness [-Werror=pointer-sign]
1580 1227 | datavec[0].iov_base, datavec[0].iov_len);
1581 | ~~~~~~~~~~^~~~~~~~~
1582 | |
1583 | caddr_t {aka char *}
1584 ```
1585 Ref: https://github.com/libssh2/libssh2/actions/runs/7135102832/job/19431233967#step:3:2225
1586
1587 https://docs.oracle.com/cd/E36784_01/html/E36887/iovec-9s.html
1588
1589 - FIXME: new `-Wsign-conversion` warnings appeared in examples:
1590 ```
1591 ../../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]
1592 251 | FD_SET(forwardsock, &fds);
1593 | ^~~~~~
1594 ../../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]
1595 ../../example/direct_tcpip.c:251:9: warning: conversion to 'long unsigned int' from 'long int' may change the sign of the result [-Wsign-conversion]
1596 ../../example/direct_tcpip.c:251:9: warning: conversion to 'long int' from 'long unsigned int' may change the sign of the result [-Wsign-conversion]
1597 ../../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]
1598 259 | if(rc && FD_ISSET(forwardsock, &fds)) {
1599 | ^~~~~~~~
1600 ../../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]
1601 ../../example/direct_tcpip.c:259:18: warning: conversion to 'long unsigned int' from 'long int' may change the sign of the result [-Wsign-conversion]
1602 [...]
1603 ```
1604 Ref: https://github.com/libssh2/libssh2/actions/runs/7136086865/job/19433997429#step:3:3450
1605
1606 Cherry-picked from #1277
1607
1608 - example: use `libssh2_socket_t` in X11 example
1609
1610 Cherry-picked from #1277
1611
1612 - [Aaron Stone brought this change]
1613
1614 Handle EINTR from send/recv/poll/select to try again as the error is not fatal
1615
1616 Integration-patches-by: Viktor Szakats
1617 Fixes #955
1618 Closes #1058
1619
1620 - appveyor: delete UWP job broken since Visual Studio upgrade
1621
1622 Few days ago UWP job started permafailing.
1623
1624 fail: https://ci.appveyor.com/project/libssh2org/libssh2/builds/48678129/job/yb8n2pox8mfjwv6m
1625 good: https://ci.appveyor.com/project/libssh2org/libssh2/builds/48673013
1626
1627 Other projects also affected:
1628 https://ci.appveyor.com/project/c-ares/c-ares/builds/48687390/job/l0fo4b0sijvqkw9r
1629
1630 No related local update. Same CMake version. Same CI image.
1631
1632 This seems to be the culprit, which could mean that this update broke
1633 CMake detection, needs a different CMake configuration on our end, or
1634 that this MSVC update pulled support for UWP apps:
1635
1636 fail: -- The C compiler identification is MSVC 19.38.33130.0 (~ Visual Studio 2022 v17.8)
1637 good: -- The C compiler identification is MSVC 19.37.32825.0 (~ Visual Studio 2022 v17.7)
1638
1639 If this is v17.8, release notes don't readily suggest a feature removal:
1640 https://learn.microsoft.com/en-us/visualstudio/releases/2022/release-notes-v17.8
1641
1642 So it might just be UWP accidentally broken in this release.
1643
1644 Closes #1275
1645
1646 - checksrc: sync with curl
1647
1648 Closes #1272
1649
1650 - autotools: delete `--disable-tests` option, fix CI tests
1651
1652 Originally added to improve build performance by skipping building
1653 tests. But, there seems to be no point in this, because autotools
1654 doesn't build tests by default, unless explicitly invoking
1655 `make check`.
1656
1657 Delete this option from Cygwin and FreeBSD CI tests, where it caused
1658 `make check` to do nothing. Tests are built now, and runtime tests are
1659 too, where supported.
1660
1661 Also disable Docker-based tests for these, and add a missing `make -j3`
1662 for FreeBSD.
1663
1664 Reverts 7483edfada1f7e17cf8f9ac1c87ffa3d814c987e #715
1665
1666 Closes #1271
1667
1668 GitHub (6 Dec 2023)
1669 - [ren mingshuai brought this change]
1670
1671 build: add `LIBSSH2_NO_DEPRECATED` option (#1266)
1672
1673 The following APIs have been deprecated for over 10 years and
1674 use `LIBSSH2_NO_DEPRECATED` to mark them as deprecated:
1675
1676 libssh2_session_startup()
1677 libssh2_banner_set()
1678 libssh2_channel_receive_window_adjust()
1679 libssh2_channel_handle_extended_data()
1680 libssh2_scp_recv()
1681
1682 Add these options to disable them:
1683 - autotools: `--disable-deprecated`
1684 - cmake: `-DLIBSSH2_NO_DEPRECATED=ON`
1685 - `CPPFLAGS`: `-DLIBSSH2_NO_DEPRECATED`
1686
1687 Fixes #1259
1688 Replaces #1260
1689 Co-authored-by: Viktor Szakats
1690 Closes #1267
1691
1692 Viktor Szakats (5 Dec 2023)
1693 - autotools: show the default for `hidden-symbols` option
1694
1695 Closes #1269
1696
1697 - tidy-up: bump casts from int to long for large C99 types in printfs
1698
1699 Cast large integer types to avoid dealing with printf masks for
1700 `size_t` and other C99 types. Some of existing code used `int`
1701 for this, bump them to `long`.
1702
1703 Ref: afa6b865604019ab27ec033294edfe3ded9ae0c0 #1257
1704
1705 Closes #1264
1706
1707 - build: enable missing OpenSSF-recommended warnings, with fixes
1708
1709 Ref:
1710 https://best.openssf.org/Compiler-Hardening-Guides/Compiler-Options-Hardening-Guide-for-C-and-C++.html
1711 (2023-11-29)
1712
1713 Enable new warnings:
1714
1715 - replace `-Wno-sign-conversion` with `-Wsign-conversion`.
1716
1717 Fix them in example, tests and wincng. There remain about 360 of these
1718 warnings in `src`. Add a TODO item for those and disable `-Werror` for
1719 this particular warning.
1720
1721 - enable `-Wformat=2` for clang (in both cmake and autotools).
1722
1723 - enable `__attribute__((format))` for `_libssh2_debug()`,
1724 `_libssh2_snprintf()` and in tests for `run_command()`.
1725
1726 `LIBSSH2_PRINTF()` copied from `CURL_TEMP_PRINTF()` in curl.
1727
1728 - enable `-Wimplicit-fallthrough`.
1729
1730 - enable `-Wtrampolines`.
1731
1732 Fix them:
1733
1734 - src: replace obsolete fall-through-comments with
1735 `__attribute__((fallthrough))`.
1736
1737 - wincng: fix `-Wsign-conversion` warnings.
1738
1739 - tests: fix `-Wsign-conversion` warnings.
1740
1741 - example: fix `-Wsign-conversion` warnings.
1742
1743 - src: fix `-Wformat` issues in trace calls.
1744
1745 Also, where necessary fix `int` and `unsigned char` casts to
1746 `unsigned int` and adjust printf format strings. These were not
1747 causing compiler warnings.
1748
1749 Cast large types to `long` to avoid dealing with printf masks for
1750 `size_t` and other C99 types. Existing code often used `int` for this.
1751 I'll update them to `long` in an upcoming commit.
1752
1753 - tests: fix `-Wformat` warning.
1754
1755 - silence `-Wformat-nonliteral` warnings.
1756
1757 - mbedtls: silence `-Wsign-conversion`/`-Warith-conversion`
1758 in external header.
1759
1760 Closes #1257
1761
1762 - packet: whitespace fix
1763
1764 Tested via #1257
1765
1766 - tidy-up: unsigned -> unsigned int
1767
1768 In the `interval` argument of public `libssh2_keepalive_config()`.
1769
1770 Tested via #1257
1771
1772 - tests: sync port number type with the rest of codebase
1773
1774 Tested via #1257
1775
1776 - autotools: enable `-Wunused-macros` with gcc
1777
1778 It works with gcc without the libtool warnings seen with clang
1779 on Windows in 96682bd5e14c20828e18bf10ed5b4b5c7543924a #1227.
1780
1781 Sync usage of of this macro with CMake and
1782 autotools + clang + non-Windows. Making it enabled everywhere except
1783 autotools + clang + Windows due to the libtool stub issue.
1784
1785 Follow-up to 7ecc309cd10454c54814b478c4f85d0041da6721 #1224
1786
1787 Closes #1262
1788
1789 - TODO: disable or drop weak algos [ci skip]
1790
1791 Closes #1261
1792
1793 - example, tests: fix/silence `-Wformat-truncation=2` gcc warnings
1794
1795 Then sync this warning option with curl.
1796
1797 Seems like a false positive and/or couldn't figure how to fix it, so silence:
1798 ```
1799 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=]
1800 227 | snprintf(fn1, fn1sz, "%s/%s", h, pubkey);
1801 | ^~
1802 example/ssh2.c:227:34: note: assuming directive output of 1 byte
1803 227 | snprintf(fn1, fn1sz, "%s/%s", h, pubkey);
1804 | ^~~~~~~
1805 example/ssh2.c:227:13: note: 'snprintf' output 3 or more bytes (assuming 4) into a destination of size 2
1806 227 | snprintf(fn1, fn1sz, "%s/%s", h, pubkey);
1807 | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1808 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=]
1809 228 | snprintf(fn2, fn2sz, "%s/%s", h, privkey);
1810 | ^~
1811 example/ssh2.c:228:34: note: assuming directive output of 1 byte
1812 228 | snprintf(fn2, fn2sz, "%s/%s", h, privkey);
1813 | ^~~~~~~
1814 example/ssh2.c:228:13: note: 'snprintf' output 3 or more bytes (assuming 4) into a destination of size 2
1815 228 | snprintf(fn2, fn2sz, "%s/%s", h, privkey);
1816 | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1817 ```
1818 Ref: https://github.com/libssh2/libssh2/actions/runs/7055480458/job/19205970397#step:10:98
1819
1820 Fix:
1821 ```
1822 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=]
1823 tests/openssh_fixture.c:116:11: note: 'snprintf' output between 6 and 1029 bytes into a destination of size 1024
1824 ```
1825 Ref: https://github.com/libssh2/libssh2/actions/runs/7055480458/job/19205969221#step:10:51
1826
1827 Tested via #1257
1828
1829 - example: fix indentation follow-up
1830
1831 Fix long line and fix more indentations.
1832
1833 Follow-up to 9e896e1b80911a53d6aabb322e034e6ca51b6898
1834
1835 - example: fix indentation
1836
1837 Tested via #1257
1838
1839 - autotools: fix missed `-pedantic` and `-Wall` options for gcc
1840
1841 Follow-up to 5996fefe2bad80cfba85b2569ce6ab6ef575142c #1223
1842
1843 Tested via #1257
1844
1845 - ci: show compiler in cross/cygwin job names
1846
1847 Tested via #1257
1848
1849 - mbedtls: further improve disabling `-Wredundant-decls`
1850
1851 Move warning option suppression to `src/mbedtls.h` to surround the actual
1852 external header #includes that need it.
1853
1854 Follow-up to ecec68a2c13a9c63fe8c2dc457ae785a513e157c #1226
1855 Follow-up to 7ecc309cd10454c54814b478c4f85d0041da6721 #1224
1856
1857 Tested via #1257
1858
1859 GitHub (1 Dec 2023)
1860 - [ren mingshuai brought this change]
1861
1862 example: replace remaining libssh2_scp_recv with libssh2_scp_recv2 in output messages (#1258)
1863
1864 libssh2_scp_recv is deprecated and has been replaced by libssh2_scp_recv2
1865 in prior commit.
1866
1867 Follow-up to 6c84a426beb494980579e5c1d244ea54d3fc1a3f
1868
1869 Viktor Szakats (27 Nov 2023)
1870 - openssl: use OpenSSL 3 HMAC API, add `no-deprecated` CI job
1871
1872 - use OpenSSL 3 API when available for HMAC.
1873 This fixes building with OpenSSL 3 `no-deprecated` builds.
1874
1875 - ensure we support pure OpenSSL 3 API by adding a CI job using
1876 OpenSSL 3 custom-built with `no-deprecated`.
1877
1878 Follow-up to b0ab005fe79260e6e9fe08f8d73b58dd4856943d #1207
1879
1880 Fixes #1235
1881 Closes #1243
1882
1883 - ci: restore lost comment for FreeBSD [ci skip]
1884
1885 Follow-up to eee4e8055ab375c9f9061d4feb39086737f41a9c
1886
1887 - ci: add OpenBSD (v7.4) job + fix build error in example
1888
1889 - Use CMake, LibreSSL and clang from the base install.
1890
1891 - This uncovered a build error in `example/subsystem_netconf.c`, caused
1892 by using the `%n` printf mask. This is a security risk and some
1893 systems (notably OpenBSD) disable this feature.
1894
1895 Fix it by applying this patch from OpenBSD ports (from 2021-09-11):
1896 https://cvsweb.openbsd.org/ports/security/libssh2/patches/patch-example_subsystem_netconf_c?rev=1.1&content-type=text/x-cvsweb-markup
1897 https://github.com/openbsd/ports/commit/2c5b2f3e94381914a3e8ade960ce8c997ca9d6d7
1898 "The old code is also broken, as it passes a pointer to a variable
1899 of a different size (on LP64). There is no check for truncation,
1900 but buf[] is 1MB in size."
1901 Patch-by: naddy
1902
1903 ```
1904 /home/runner/work/libssh2/libssh2/example/subsystem_netconf.c:252:17: error: '%n' format specifier support is deactivated and will call abort(3) [-Werror]
1905 "]]>]]>\n%n", (int *)&len);
1906 ~^
1907 /home/runner/work/libssh2/libssh2/example/subsystem_netconf.c:270:17: error: '%n' format specifier support is deactivated and will call abort(3) [-Werror]
1908 "]]>]]>\n%n", (int *)&len);
1909 ~^
1910 2 errors generated.
1911 ```
1912 Ref: https://github.com/libssh2/libssh2/actions/runs/6991449778/job/19022024280#step:3:420
1913
1914 Also made tests with arm64, but it takes consistently almost 14m to
1915 finish the job, vs. 2-3m for the native amd64:
1916 https://github.com/libssh2/libssh2/actions/runs/6991648984/job/19022440525
1917 https://github.com/libssh2/libssh2/actions/runs/6991551220/job/19022233651
1918
1919 Cherry-picked from #1250
1920 Closes #1250
1921
1922 - ci: add NetBSD (v9.3) job
1923
1924 Use CMake, OpenSSL (v1.1) and clang from the base install.
1925
1926 Cherry-picked from #1250
1927
1928 - ci: update and speed up FreeBSD job
1929
1930 - switch to an alternate GitHub action. This one seems (more) actively
1931 maintained, and runs faster:
1932 https://github.com/cross-platform-actions/action
1933
1934 - use clang instead of gcc. clang is already present in the base
1935 install, saving install time and bandwidth.
1936
1937 - stop installing `openssl-quictls` and use the OpenSSL (v1.1) from
1938 the base system.
1939 (I'm suspecting that quictls before this patch wasn't detected by
1940 the build.)
1941 https://wiki.freebsd.org/OpenSSL
1942
1943 Cherry-picked from #1250
1944
1945 - stop using leading underscores in macro names
1946
1947 Underscored macros are reserved for the compiler / standard lib / etc.
1948 Stop using them in user code.
1949
1950 We used them as header guards in `src` and in `__FILESIZE` in `example`.
1951
1952 Closes #1248
1953
1954 - ci: use absolute path in `CMAKE_INSTALL_PREFIX`
1955
1956 To make the installed locations unambiguous in the build logs.
1957
1958 Closes #1247
1959
1960 - openssl: make a function static, add `#ifdef` comments
1961
1962 Follow-up to 03092292597ac601c3f9f0c267ecb145dda75e4e #248
1963 where the function was added.
1964
1965 Also add comments to make `#ifdef` branches easier to follow in
1966 `openssl.h`.
1967
1968 Closes #1246
1969
1970 - ci: boost mbedTLS build speed
1971
1972 Build times down to 4 seconds (from 18-20).
1973
1974 Closes #1245
1975
1976 - openssl: fix DSA code to use OpenSSL 3 API
1977
1978 - fix missing `DSA` type when building for OpenSSL 3 `no-deprecated`.
1979 - fix fallouts after fixing the above by switching away from `DSA`
1980 with OpenSSL 3.
1981
1982 Follow-up to b0ab005fe79260e6e9fe08f8d73b58dd4856943d #1207
1983
1984 Closes #1244
1985
1986 - openssl: formatting (delete empty lines) [ci skip]
1987
1988 - tests: fall back to `$LOGNAME` for username
1989
1990 If the `$USER` variable is empty, fall back to using `$LOGNAME` to
1991 retrieve the logged-in username.
1992
1993 In POSIX, `$LOGNAME` is a mandatory variable, while `$USER` isn't, and
1994 on some systems it may not be set. Without this value, tests were unable
1995 to provide the correct username when logging into the SSH server running
1996 under the active user's session.
1997
1998 Reported-by: Nicolas Mora
1999 Suggested-by: Nicolas Mora
2000 Ref: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1056348
2001 Fixes #1240
2002 Closes #1241
2003
2004 - libssh2.h: use `_WIN32` for Windows detection instead of rolling our own
2005
2006 Sync up `libssh2.h` Windows detection with the libssh2 source code.
2007
2008 `libssh2.h` was using `WIN32` and `LIBSSH2_WIN32` for Windows detection,
2009 next to the official `_WIN32`. After this patch it only uses `_WIN32`
2010 for this. Also, make it stop defining `LIBSSH2_WIN32`.
2011
2012 There is a slight chance these break compatibility with Windows
2013 compilers that fail to define `_WIN32`. I'm not aware of any obsolete
2014 or modern compiler affected, but in case there is one, one possible
2015 solution is to define this macro manually.
2016
2017 Closes #1238
2018
2019 - openssl: fix `EC_KEY` reference with OpenSSL 3 `no-deprecated` build
2020
2021 Fixes:
2022 ```
2023 src/openssl.c:650:5: error: use of undeclared identifier 'EC_KEY'
2024 EC_KEY *ec_key = EC_KEY_new_by_curve_name(curve);
2025 ^
2026 src/openssl.c:650:13: error: use of undeclared identifier 'ec_key'
2027 EC_KEY *ec_key = EC_KEY_new_by_curve_name(curve);
2028 ^
2029 src/openssl.c:650:22: error: implicit declaration of function 'EC_KEY_new_by_curve_name' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
2030 EC_KEY *ec_key = EC_KEY_new_by_curve_name(curve);
2031 ^
2032 src/openssl.c:650:22: note: did you mean 'EC_GROUP_new_by_curve_name'?
2033 ./quictls/_a64-mac-sys/usr/include/openssl/ec.h:483:11: note: 'EC_GROUP_new_by_curve_name' declared here
2034 EC_GROUP *EC_GROUP_new_by_curve_name(int nid);
2035 ^
2036 In file included from ./_a64-mac-sys-bld/src/CMakeFiles/libssh2_static.dir/Unity/unity_0_c.c:19:
2037 In file included from src/crypto.c:10:
2038 src/openssl.c:652:8: error: use of undeclared identifier 'ec_key'
2039 if(ec_key) {
2040 ^
2041 ```
2042 Ref: https://github.com/curl/curl-for-win/actions/runs/6950001225/job/18909297867#step:3:4341
2043
2044 Follow-up to b0ab005fe79260e6e9fe08f8d73b58dd4856943d #1207
2045
2046 Bug #1235
2047 Closes #1236
2048
2049 - openssl: formatting
2050
2051 Sync up these lines with the other two similar occurrences in the code.
2052
2053 Cherry-picked from #1236
2054
2055 GitHub (21 Nov 2023)
2056 - [Michael Buckley brought this change]
2057
2058 openssl: use non-deprecated APIs with OpenSSL 3.x (#1207)
2059
2060 Assisted-by: Viktor Szakats
2061
2062 Viktor Szakats (21 Nov 2023)
2063 - ci: add BoringSSL job (cmake, gcc, amd64)
2064
2065 Closes #1233
2066
2067 - autotools: fix dotless gcc and Apple clang version detections
2068
2069 - fix parsing dotless (major-only) gcc versions.
2070 Follow-up to 00a3b88c51cdb407fbbb347a2e38c5c7d89875ad #1187
2071
2072 - sync gcc detection variable names with curl.
2073
2074 - fix Apple clang version detection for releases between
2075 'Apple LLVM version 7.3.0' and 'Apple LLVM version 10.0.1' where the
2076 version was under-detected as 3.7 llvm/clang equivalent.
2077
2078 - fix Apple clang version detection for 'Apple clang version 11.0.0'
2079 and newer where the Apple clang version was detected, instead of its
2080 llvm/clang equivalent.
2081
2082 - revert to show `clang` instead of `Apple clang`, because we follow it
2083 with an llvm/clang version number. (Apple-ness still visible in raw
2084 version.)
2085
2086 Used this collection for Apple clang / llvm/clang translation and test
2087 inputs: https://gist.github.com/yamaya/2924292
2088
2089 Closes #1232
2090
2091 - acinclude.m4: revert accidental edit [ci skip]
2092
2093 Follow-up to 8c320a93a48775b74f40415e46f84bf68b4d5ae8
2094
2095 - autotools: show more clang/gcc version details
2096
2097 Also:
2098 - show if we detected Apple clang.
2099 - delete duplicate version detection for clang.
2100
2101 Closes #1230
2102
2103 - acinclude.m4: re-sync with curl [ci skip]
2104
2105 - autotools: avoid warnings in libtool stub code
2106
2107 Seen on Windows with clang64, in libtool-generated stub code for
2108 examples and tests.
2109
2110 The error didn't break the CI job for some reason.
2111
2112 msys2 (autotools, clang64, clang-x86_64:
2113 ```
2114 [...]
2115 2023-11-17T20:14:17.8639574Z ./.libs/lt-test_read.c:91:10: error: macro is not used [-Werror,-Wunused-macros]
2116 [...]
2117 2023-11-17T20:14:39.8729255Z ./.libs/lt-sftp_write_nonblock.c:91:10: error: macro is not used [-Werror,-Wunused-macros]
2118 [...]
2119 ```
2120 Ref: https://github.com/libssh2/libssh2/actions/runs/6908585056/job/18798193405?pr=1226#step:8:474
2121
2122 Follow-up to 7ecc309cd10454c54814b478c4f85d0041da6721 #1224
2123
2124 Closes #1227
2125
2126 - mbedtls: improve disabling `-Wredundant-decls`
2127
2128 Disable these warnings specifically for the mbedTLS public headers
2129 and leave it on for the the rest of the code. This also fixes this
2130 issue for autotools. Previous solution was globally disabling this
2131 warning for the whole code when using mbedTLS and only with CMake.
2132
2133 Follow-up to 7ecc309cd10454c54814b478c4f85d0041da6721 #1224
2134
2135 Closes #1226
2136
2137 - cmake: rename picky warnings script
2138
2139 To match the camel-case style used in other CMake scripts and also
2140 to match the name used in curl.
2141
2142 Closes #1225
2143
2144 - build: enable more compiler warnings and fix them
2145
2146 Enable more picky compiler warnings. I've found these options in the
2147 nghttp3 project when implementing the CMake quick picky warning
2148 functionality for it.
2149
2150 Fix issues found along the way:
2151
2152 - wincng, mbedtls: delete duplicate function declarations.
2153 Most of this was due to re-#defining crypto functions to
2154 crypto-backend specific implementations These redefines also remapped
2155 the declarations in `crypto.h`, making the backend-specific
2156 declarations duplicates.
2157 This patch deletes the backend-specific declarations.
2158
2159 - wincng mapped two crypto functions to the same local function.
2160 Also causing double declarations.
2161 Fix this by adding two disctinct wrappers and moving
2162 the common function to a static one.
2163
2164 - delete unreachable `break;` statements.
2165
2166 - kex: disable macros when unused.
2167
2168 - agent: disable unused constants.
2169
2170 - mbedtls: disable double declaration warnings because public mbedTLS
2171 headers trigger it. (with function `psa_set_key_domain_parameters`)
2172
2173 - crypto.h: formatting.
2174
2175 Ref: https://github.com/ngtcp2/nghttp3/blob/a70edb08e954d690e8fb2c1df999b5a056f8bf9f/cmake/PickyWarningsC.cmake
2176
2177 Closes #1224
2178
2179 - autotools: sync warning enabler code with curl
2180
2181 Tiny changes and minor updates to bring this code closer
2182 to curl's `m4/curl-compilers.m4`.
2183
2184 Closes #1223
2185
2186 - acinclude.m4: fix indentation [ci skip]
2187
2188 Also match indentation of curl's `m4/curl-compilers.m4` for
2189 easier syncing.
2190
2191 - autotool: rename variable
2192
2193 `WARN` -> `tmp_CFLAGS`
2194
2195 To match curl and make syncing this code easier.
2196
2197 Ref: https://github.com/curl/curl/blob/d1820768cce0e797d1f072343868ce1902170e93/m4/curl-compilers.m4#L479
2198
2199 Closes #1222
2200
2201 - autotools: picky warning options tidy-up
2202
2203 - sync clang warning version limits with CMake.
2204 - make `WARN=` vs. `CURL_ADD_COMPILER_WARNINGS()` consistent with curl
2205 and between clang and gcc (`WARN=` is for `no-` options in general).
2206
2207 Closes #1221
2208
2209 - build: picky warning updates
2210
2211 - cmake, autotools: sync picky gcc warnings with curl.
2212 - cmake, autotools: add `-Wold-style-definition` for clang too.
2213 - cmake, autotools: add comment for `-Wformat-truncation=1`.
2214 - cmake: more precise version info for old clang options.
2215
2216 Closes #1219
2217
2218 - ci: fixup FreeBSD version, bump mbedtls
2219
2220 We haven't been using the FreeBSD version. Also it turns out,
2221 the single version supported is 13.2 at the moment:
2222 https://github.com/vmactions/freebsd-vm/tree/main/conf
2223
2224 Stop trying to set the version and instead rely on the action
2225 providing the latest supported one automatically.
2226
2227 Follow-up to a7d2a573be26238cc2b55e5ff6649bbe620cb8d9
2228
2229 Also:
2230 - add more details to the FreeBSD job description.
2231 - bump mbedtls version while here.
2232
2233 Closes #1217
2234
2235 - cmake: fix multiple include of libssh2 package
2236
2237 Also extend our integration test double inclusion. It will still not
2238 catch this case, because that requires
2239 `cmake_minimum_required(VERSION 3.18)` or higher.
2240
2241 Fixes:
2242 ```
2243 CMake Error at .../lib/cmake/libssh2/libssh2-config.cmake:8 (add_library):
2244 add_library cannot create ALIAS target "libssh2::libssh2" because another
2245 target with the same name already exists.
2246 Call Stack (most recent call first):
2247 CMakeLists.txt:24 (find_package)
2248
2249 CMake Error at .../lib/cmake/libssh2/libssh2-config.cmake:13 (add_library):
2250 add_library cannot create ALIAS target "Libssh2::libssh2" because another
2251 target with the same name already exists.
2252 Call Stack (most recent call first):
2253 CMakeLists.txt:24 (find_package)
2254 ```
2255
2256 Test to reproduce:
2257 ```cmake
2258 cmake_minimum_required(VERSION 3.18) # must be 3.18 or higher
2259
2260 project(test)
2261
2262 find_package(libssh2 CONFIG)
2263 find_package(libssh2 CONFIG) # fails
2264
2265 add_executable(test main.c)
2266 target_link_libraries(test libssh2::libssh2)
2267 ```
2268
2269 Ref: https://cmake.org/cmake/help/latest/release/3.18.html#other-changes
2270 Ref: https://cmake.org/cmake/help/v3.18/policy/CMP0107.html
2271
2272 Assisted-by: Kai Pastor
2273 Assisted-by: Harry Mallon
2274 Ref: https://github.com/curl/curl/pull/11913
2275
2276 Closes #1216
2277
2278 - ci: add FreeBSD 13.2 job
2279
2280 It runs over Linux via qemu. First two runs were (very) slow, then it
2281 became (much) more performant at just 2x slower than a native Linux
2282 build. Then got slow again, then fast again. Still seems acceptable
2283 for the value this adds.
2284
2285 The build uses autotools and quictls.
2286
2287 Successful builds:
2288 1. https://github.com/libssh2/libssh2/actions/runs/6802676786/job/18496286419 (13m59s, -j3)
2289 2. https://github.com/libssh2/libssh2/actions/runs/6802976375/job/18497243225 (11m5s, -j2)
2290 3. https://github.com/libssh2/libssh2/actions/runs/6803142201/job/18497785049 (3m6s, -j1)
2291 4. https://github.com/libssh2/libssh2/actions/runs/6803194839/job/18497962766 (3m10s, -j2)
2292 5. https://github.com/libssh2/libssh2/actions/runs/6803267201/job/18498208501 (3m13s)
2293 6. https://github.com/libssh2/libssh2/actions/runs/6803510333/job/18498993698 (15m25s)
2294 7. https://github.com/libssh2/libssh2/actions/runs/6813602863/job/18528571057 (3m13s)
2295
2296 Similar solution exists for Solaris (over macOS via VirtualBox), but it
2297 hangs forever at `Waiting for text: solaris console login`:
2298 https://github.com/libssh2/libssh2/actions/runs/6802388128/job/18495391869#step:4:185
2299
2300 Idea taken from LibreSSL.
2301
2302 FIXME: Unrelated, the `distcheck` job became flaky in recent days:
2303 https://github.com/libssh2/libssh2/actions/runs/6802976375/job/18497256437#step:10:536
2304 ```
2305 FAIL: test_auth_pubkey_ok_rsa_aes256gcm
2306 ```
2307 https://github.com/libssh2/libssh2/actions/runs/6813602863/job/18528588933#step:10:533
2308 ```
2309 FAIL: test_read
2310 ```
2311
2312 Closes #1215
2313
2314 - reuse: fix duplicate copyright warning
2315
2316 ```
2317 PendingDeprecationWarning:
2318 Copyright and licensing information for 'tests/openssh_server/Dockerfile'
2319 has been found in both 'tests/openssh_server/Dockerfile' and in the DEP5
2320 file located at '.reuse/dep5'. The information for these two sources has
2321 been aggregated. In the future this behaviour will change, and you will
2322 need to explicitly enable aggregation. [...]
2323 ```
2324 Ref: https://github.com/libssh2/libssh2/actions/runs/6789274955/job/18456085964#step:4:4
2325
2326 - Makefile.mk: delete Windows-focused raw GNU Make build
2327
2328 We recommend using CMake instead. Especially in unity mode, it's faster
2329 and probably more familiar for most. It's also easily portable.
2330
2331 (`Makefile.mk` was also portable, but in practice only usable for
2332 Windows. Other platforms required a manual config header.)
2333
2334 Also:
2335 - migrate `LIBSSH2_NO_*` option CI tests to CMake.
2336 - make MSYS2 CMake builds verbose to show compilation options.
2337
2338 Closes #1204
2339
2340 - tidy-up: around `stdint.h`
2341
2342 - os400: delete unused `HAVE_STDINT_H`.
2343
2344 - fuzz: delete redundant `stdint.h` use.
2345 `inttypes.h` is already included via `testinput.h`.
2346
2347 - docs/TODO: adjust type in planned function.
2348
2349 Closes #1212
2350
2351 - cmake: show crypto backend in feature summary
2352
2353 This was visible as an enabled package before this patch, but it missed
2354 to show WinCNG.
2355
2356 Closes #1211
2357
2358 - man: fix double spaces and dash escaping
2359
2360 - `- ` -> `- `
2361 - `. ` -> `. `
2362 - `\- ` -> `- `
2363 - `-1` -> `\-1`
2364 - fold long lines along the way
2365
2366 This makes the minus sign come out as a Unicode minus sign
2367 (0x2212), and title separator dashes as Unicode hyphen (0x2010),
2368 with `groff -Tutf8` v1.23.0.
2369
2370 Ref: https://lwn.net/Articles/947941/
2371
2372 Closes #1210
2373
2374 - src: fix gcc 13 `-Wconversion` warning on Darwin
2375
2376 ```
2377 src/session.c: In function 'libssh2_poll':
2378 src/session.c:1776:22: warning: conversion from 'long int' to '__darwin_suseconds_t' {aka 'int'} may change value [-Wconversion]
2379 1776 | tv.tv_usec = (timeout_remaining % 1000) * 1000;
2380 | ^
2381 ```
2382 Ref: https://github.com/curl/curl-for-win/actions/runs/6711735060/job/18239768548#step:3:4368
2383
2384 Follow-up to 08354e0abbe86d4cc5088d210d53531be6d8981a
2385
2386 Closes #1209
2387
2388 - openssl: silence `-Wunused-value` warnings
2389
2390 Seen with gcc 12.
2391
2392 Manual: https://www.openssl.org/docs/man3.1/man3/BIO_reset.html
2393
2394 ```
2395 ./quictls/linux-a64-musl/usr/include/openssl/bio.h:555:34: warning: value computed is not used [-Wunused-value]
2396 555 | # define BIO_reset(b) (int)BIO_ctrl(b,BIO_CTRL_RESET,0,NULL)
2397 | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2398 ./libssh2/src/openssl.c:3518:5: note: in expansion of macro 'BIO_reset'
2399 ./libssh2/src/openssl.c:3884:5: note: in expansion of macro 'BIO_reset'
2400 ./libssh2/src/openssl.c:3995:5: note: in expansion of macro 'BIO_reset'
2401 ```
2402 Ref: https://github.com/curl/curl-for-win/actions/runs/6696392318/job/18194032712#step:3:5060
2403
2404 Closes #1205
2405
2406 - Makefile.am: fix `cp` to preserve attributes and timestamp
2407
2408 - cmake: simplify showing CMake version
2409
2410 Move it to `CMakeLists.txt`. Drop `cmake --version` commands.
2411
2412 Credit to the `zlib-ng` project for the idea:
2413 https://github.com/zlib-ng/zlib-ng/blob/61e181c8ae93dbf56040336179c9954078bd1399/CMakeLists.txt#L7
2414
2415 Closes #1203
2416
2417 - ci: mbedtls 3.5.0
2418
2419 v3.5.0 needs extra compiler option for i386 to avoid:
2420 ```
2421 #error "Must use `-mpclmul -msse2 -maes` for MBEDTLS_AESNI_C"
2422 ```
2423
2424 Closes #1202
2425
2426 - tests: show cmake version used in integration tests
2427
2428 Closes #1201
2429
2430 - readme.vms: fix typo [ci skip]
2431
2432 Detected by codespell 2.2.6
2433
2434 - appveyor: YAML/PowerShell formatting, shorten variable name
2435
2436 - use single-quotes in yaml and PowerShell.
2437
2438 - shorten a variable name.
2439
2440 - use indentation 2 for scripts.
2441
2442 - use C else-style in PowerShell.
2443
2444 Closes #1200
2445
2446 - ci: update actions, use shallow clones with appveyor
2447
2448 - update GitHub Actions to their latest versions.
2449
2450 - use shallow git clones in AppVeyor CI to save data over the wire.
2451
2452 Closes #1199
2453
2454 - appveyor: move to pure PowerShell
2455
2456 - replace batch commands with PowerShell.
2457
2458 - merge separate command entries into single PowerShell blocks.
2459
2460 Closes #1197
2461
2462 - windows: use built-in `_WIN32` macro to detect Windows
2463
2464 Instead of `WIN32`.
2465
2466 The compiler defines `_WIN32`. Windows SDK headers or build env defines
2467 `WIN32`, or we have to take care of it. The agreement seems to be that
2468 `_WIN32` is the preferred practice here.
2469
2470 Minor downside is that CMake uses `WIN32` and we also adopted it in
2471 `Makefile.mk`.
2472
2473 In public libssh2 headers we stick with accepting either `_WIN32` or
2474 `WIN32` and define our own namespaced `LIBSSH2_WIN32` based on them.
2475
2476 grepping for `WIN32` remains useful to detect Windows-specific code.
2477
2478 Closes #1195
2479
2480 - cmake: cleanup mbedTLS version detection more
2481
2482 - lowercase, underscored local variables.
2483 - fix `find_library()` to use the multiple names passed.
2484 - rely more on `find_package_handle_standard_args()`.
2485 Logic based on our `Findwolfssl.cmake`.
2486 - delete ignored/unused `MBEDTLS_LIBRARY_DIR`.
2487 - revert CI configuration to use `MBEDCRTYPO_LIBRARY`.
2488 - clarify inputs/outputs in comment header.
2489 - use variable for regex.
2490 - formatting.
2491
2492 Follow-up to 41594675072c578294674230d4cf5f47fa828778 #1192
2493
2494 Closes #1196
2495
2496 - cmake: delete duplicate `include()`
2497
2498 - cmake: improve/fix mbedTLS detection
2499
2500 - libssh2 needs the crypto lib only, stop dealing with the rest.
2501
2502 - simplify logic.
2503
2504 - drop hard-wired toolchain specific options that broke with e.g. MSVC.
2505
2506 Reported by: AR Visions
2507 Fixes #1191
2508
2509 - add mbedTLS version detection for recent releases.
2510
2511 - merge custom detection results display into a single line.
2512
2513 - shorten mbedTLS configuration in macOS CI job.
2514
2515 Used the curl mbedTLS detection logic for ideas:
2516 https://github.com/curl/curl/blob/a8c773845f4fdbfb09b08a6ec4b656c812568995/CMake/FindMbedTLS.cmake
2517
2518 Closes #1192
2519
2520 GitHub (24 Sep 2023)
2521 - [concussious brought this change]
2522
2523 libssh2_session_get_blocking.3: Add description (#1185)
2524
2525 Viktor Szakats (21 Sep 2023)
2526 - autotools: fix selecting wincng in cross-builds (and more)
2527
2528 - Fix explicitly selecting WinCNG in autotools cross-builds by moving
2529 `windows.h` header check before the WinCNG availability check.
2530 Follow-up to d43b8d9b0b9cd62668459fe5d582ed83aabf77e7
2531
2532 Reported-by: Jack L
2533 Fixes #1186
2534
2535 - Add Linux -> mingw-w64 cross-builds for autotools and CMake. This
2536 doesn't detect #1186, because that happened when explicitly specifying
2537 WinCNG via `--with-crypto=wincng`, but not when falling back to WinCNG
2538 by default.
2539
2540 - autotools: fix to strip suffix from gcc version
2541
2542 Before this patch we expected `n.n` `-dumpversion` output, but Ubuntu
2543 may return `n-win32` (also with `-dumpfullversion`). Causing these
2544 errors and failing to enable picky warnings:
2545 ```
2546 ../configure: line 23845: test: : integer expression expected
2547 ```
2548 Ref: https://github.com/libssh2/libssh2/actions/runs/6263453828/job/17007893718#step:5:143
2549
2550 Fix that by stripping any dash-suffix.
2551
2552 gcc version detection is still half broken because we translate '10'
2553 to '10.10' because `cut -d. -f2` returns the first word if the
2554 delimiter missing.
2555
2556 More possible `-dumpversion` output: `10-posix`, `10-win32`,
2557 `9.3-posix`, `9.3-win32`, `6`, `9.3.0`, `11`, `11.2`, `11.2.0`
2558 Ref: https://github.com/mamedev/mame/pull/9767
2559
2560 Closes #1187
2561
2562 GitHub (28 Aug 2023)
2563 - [Michael Buckley brought this change]
2564
2565 Properly bounds check packet_authagent_open() (#1179)
2566
2567 * Properly bounds check packet_authagent_open
2568 * packet.c: use strlen instead of sizeof for strings
2569 * Make LIBSSH_CHANNEL's channel_type_len a size_t
2570 * packet_authagent_open: use size_t for offset
2571
2572 Credit:
2573 Michael Buckley, signed off by Will Cosgrove
2574
2575 Viktor Szakats (28 Aug 2023)
2576 - os400qc3: move FIXME comment [ci skip]
2577
2578 Follow-up to eb9f9de2c19ec67d12a444cce34bdd059fd26ddc
2579
2580 - md5: allow disabling old-style encrypted private keys at build-time
2581
2582 Before this patch, this happened at runtime when using an old (pre-3.0),
2583 FIPS-enabled OpenSSL backend.
2584
2585 This patch makes it possible to disable this via the build-time option
2586 `LIBSSH2_NO_MD5_PEM`.
2587
2588 Also:
2589 - make sure to exclude all MD5 internal APIs when both the above and
2590 `LIBSSH2_NO_MD5` are enabled.
2591 - fix tests to support build with`LIBSSH2_NO_MD5`, `LIBSSH2_NO_MD5_PEM`
2592 and `LIBSSH2_NO_3DES`.
2593 - add FIXME to apply this change to `os400qc3.*`.
2594
2595 Old-style encrypted private keys require MD5 and they look like this:
2596 ```
2597 -----BEGIN RSA PRIVATE KEY-----
2598 Proc-Type: 4,ENCRYPTED
2599 DEK-Info: AES-128-CBC,<MD5-hex>
2600
2601 <base64>
2602 -----END RSA PRIVATE KEY-----
2603 ```
2604
2605 E.g.: `tests/key_rsa_encrypted`
2606
2607 Ref: https://github.com/libssh2/www/issues/20
2608 Closes #1181
2609
2610 - cmake: tidy-up `foreach()` syntax
2611
2612 Use `IN LISTS` and `IN ITEMS`. This appears to be the preferred way
2613 within CMake's own source code and possibly improves readability.
2614
2615 Fixup a side-effect of `IN LISTS`, where it retains empty values at
2616 the end of the list, as opposed to the syntax used before, which
2617 dropped it. In our case this happened with lines read from a text
2618 file via `file(READ)`.
2619
2620 https://cmake.org/cmake/help/v3.7/command/foreach.html
2621
2622 Closes #1180
2623
2624 - ci: replace `mv` + `chmod` with `install` in `Dockerfile`
2625
2626 Cherry-picked from #1175
2627 Closes #1175
2628
2629 - ci: set file mode early in `appveyor_docker.yml`
2630
2631 Also:
2632 - replace tab with spaces in generated config file
2633 - formatting
2634
2635 Cherry-picked from #1175
2636
2637 - ci: add spellcheck (codespell)
2638
2639 Also rename a variable in `src/os400qc3.c` to avoid a false positive.
2640
2641 Cherry-picked from #1175
2642
2643 - cmake: also test for `libssh2_VERSION`
2644
2645 Cherry-picked from #1175
2646
2647 - cmake: show cmake versions in ci
2648
2649 Cherry-picked from #1175
2650
2651 - tests: formatting and tidy-ups
2652
2653 - Dockerfile: use standard sep with `sed`
2654 - Dockerfile: use single quotes in shell command
2655 - appveyor.yml: use long-form option with `choco`
2656 - tests/cmake: add language to test project
2657 - reuse.yml: fix indentation
2658 ```
2659 $ yamllint reuse.yml
2660 reuse.yml
2661 [...]
2662 11:5 error wrong indentation: expected 6 but found 4 (indentation)
2663 15:5 error wrong indentation: expected 6 but found 4 (indentation)
2664 [...]
2665 27:5 error wrong indentation: expected 6 but found 4 (indentation)
2666 ```
2667
2668 Cherry-picked from #1175
2669
2670 - openssl.c: whitespace fixes
2671
2672 Cherry-picked from #1175
2673
2674 - checksrc: fix spelling in comment [ci skip]
2675
2676 - cmake: quote more strings
2677
2678 Follow-up to 3fa5282d6284efba62dc591697e6a687152bdcb1
2679
2680 Closes #1173
2681
2682 - drop `www.` from `www.libssh2.org`
2683
2684 <https://www.libssh2.org/*> is now a 301 permanent redirect to
2685 <https://libssh2.org/*>.
2686
2687 Update all references to point directly to the new destination.
2688
2689 Ref: https://github.com/libssh2/www/commit/ccf4a7de7f702a8ee17e2c697bcbef47fcf485ed
2690
2691 Closes #1172
2692
2693 - cmake: add `ExternalProject` integration test
2694
2695 - via `ExternalProject_Add()`:
2696 https://cmake.org/cmake/help/latest/module/ExternalProject.html
2697 (as documented in `docs/INSTALL_CMAKE.md`)
2698
2699 - also make `FetchContent` fetch from local repo instead of live master.
2700
2701 Closes #1171
2702
2703 - cmake: add integration tests
2704
2705 Add a small project to test dependent/downstream CMake build using
2706 libssh2. Also added to the GHA CI, and you can also run it locally with
2707 `tests/cmake/test.sh`.
2708
2709 Test three methods of integrating libssh2 into a project:
2710 - via `find_package()`:
2711 https://cmake.org/cmake/help/latest/command/find_package.html
2712 - via `add_subdirectory()`:
2713 https://cmake.org/cmake/help/latest/command/add_subdirectory.html
2714 - via `FetchContent`:
2715 https://cmake.org/cmake/help/latest/module/FetchContent.html
2716
2717 Closes #1170
2718
2719 - cmake: (re-)add aliases for `add_subdirectory()` builds
2720
2721 Add internal libssh2 library aliases to make these available for
2722 downstream/dependent projects building libssh2 via `add_subdirectory()`:
2723
2724 - `libssh2:libssh2_static`
2725 - `libssh2:libssh2_shared`
2726 - `libssh2:libssh2` (shared, or static when not building shared)
2727 - `libssh2` (shared, or static when not building shared)
2728
2729 Of these, `libssh2` was present in v1.10.0 and earlier releases, but
2730 missing from v1.11.0.
2731
2732 Closes #1169
2733
2734 - cmake: delete empty line [ci skip]
2735
2736 Follow-up to 3fa5282d6284efba62dc591697e6a687152bdcb1
2737
2738 - cmake: reflect minimum version in docs [ci skip]
2739
2740 Follow-up to 9cd18f4578baa41dfca197f60557063cad12cd59
2741
2742 - cmake: style tidy up
2743
2744 - quote text literals to improve readability.
2745 (exceptions: `FILES` items, `add_subdirectory` names, `find_package`
2746 names, literal target names, version numbers, 0/1, built-in CMake
2747 values and CMake keywords, list items in `cmake/max_warnings.cmake`)
2748 - quote standalone variables that could break syntax on empty values.
2749 - replace `libssh2_SOURCE_DIR` with `PROJECT_SOURCE_DIR`.
2750 - add missing mode to `message()` call.
2751 - `TRUE`/`FALSE` → `ON`/`OFF`.
2752 - add missing default value `OFF` to `option()` for clarity.
2753 - unfold some lines.
2754 - `INSTALL_CMAKE.md` fixes and updates. Show defaults.
2755
2756 Closes #1166
2757
2758 - wincng: prefer `ULONG`/`DWORD` over `unsigned long`
2759
2760 To match with the types used by the `Crypt*()` (uses `DWORD`) and
2761 `BCrypt*()` (uses `ULONG`) Windows APIs.
2762
2763 This patch doesn't change data width or signedness.
2764
2765 Closes #1165
2766
2767 - wincng: tidy-ups
2768
2769 - make `_libssh2_wincng_key_sha_verify` static.
2770
2771 - prefer `unsigned long` over `size_t` in two static functions.
2772
2773 - prefer `ULONG` over `DWORD` to match `BCryptImportKeyPair()`
2774 and `BCryptGenerateKeyPair()`.
2775
2776 - add a newline.
2777
2778 Closes #1164
2779
2780 - ci: add MSYS builds (autotools and cmake)
2781
2782 Use existing MSYS2 section and extend it with builds for the MSYS
2783 environment with both autotools and cmake.
2784
2785 MSYS builds resemble Cygwin ones: The env is Unixy, where Windows
2786 headers are all available but we don't use them.
2787
2788 Also:
2789
2790 - extend existing autotools logic for Cygwin to skip detecting
2791 `windows.h` for MSYS targets too.
2792
2793 - require `windows.h` for the WinCNG backend in autotools. Before this
2794 patch, autotools allowed selecting WinCNG on the Cygwin and MSYS
2795 platforms, but the builds then fell apart due to the resulting mixed
2796 Unixy + Windowsy environment. The general expectation for Cygwin/MSYS
2797 builds is not to use the Windows API directly in them.
2798
2799 - stop manually selecting the `MSYS Makefiles` CMake generator for
2800 MSYS2-based GHA CI builds. mingw-w64 builds work fine without it, but
2801 it broke MSYS build which use `Unix Makefiles`. Deleting this setting
2802 fixes all build flavours.
2803
2804 Closes #1162
2805
2806 - ci: cygwin job tidy-ups
2807
2808 `CMAKE_C_COMPILER=gcc` not necessary, delete it.
2809
2810 Follow-up to f1e96e733fefb495bc31b07f5c2a5845ff877c9c
2811
2812 Cherry-picked from #1163
2813 Closes #1163
2814
2815 - ci: add Cygwin builds (autotools and cmake)
2816
2817 To avoid builds picking up non-Cygwin components coming by default with
2818 the CI machine, I used the solution recommended by Cygwin [1] and set
2819 `PATH` manually. To avoid repeating this for each step, I merged steps
2820 into a single one. Let us know if there is a more elegant way.
2821
2822 Cygwin's Github Action uses cleartext HTTP. We upgrade this to HTTPS.
2823
2824 autotools build seemed to take slightly longer than other jobs. To save
2825 turnaround time I disabled building tests.
2826
2827 Cygwin package search: https://cygwin.com/cgi-bin2/package-grep.cgi
2828
2829 [1] https://github.com/cygwin/cygwin-install-action/tree/v4#path
2830
2831 Closes #1161
2832
2833 - cmake: add `LIB_NAME` variable
2834
2835 It holds the name `libssh2`. Mainly to document its uses, and also
2836 syncing up with the same variable in libcurl.
2837
2838 Closes #1159
2839
2840 - cmake: add one missed `PROJECT_NAME` variable
2841
2842 Follow-up to 72fd25958a7dc6f8e68f2b2d5d72839a2da98f9c
2843
2844 Closes #1158
2845
2846 - cmake: tidy-up concatenation in `CMAKE_MODULE_PATH`
2847
2848 Former solution was appending an empty element to the array if
2849 `CMAKE_MODULE_PATH` was originally empty. The new syntax doesn't have
2850 this side-effect.
2851
2852 There is no known issue caused by this. Fixing it for good measure.
2853
2854 Closes #1157
2855
2856 - ci: add mingw-w64 UWP build
2857
2858 Add a CI test for Windows UWP builds using mingw-w64. Before this patch
2859 we had UWP builds tested with MSVC only.
2860
2861 Alike existing UWP jobs, it's not possible to run the binaries due to
2862 the missing UWP runtime DLL:
2863 https://github.com/libssh2/libssh2/actions/runs/5821297010/job/15783475118#step:11:42
2864
2865 We could install `winstorecompat-git` in the setup-msys2 step, but opted
2866 to do it manually to avoid the overhead for every matrix job.
2867
2868 All this would work smoother with llvm-mingw, which features an UWP
2869 toolchain prefix and provides all necessary implibs by default.
2870
2871 This also hit a CMake bug (with v3.26.4), where CMake gets confused and
2872 sets up `windres.exe` to use the MSVC rc.exe-style command-line:
2873 https://github.com/libssh2/libssh2/actions/runs/5819232677/job/15777236773#step:9:126
2874
2875 Notice that MS "sunset" UWP in 2021:
2876 https://github.com/microsoft/WindowsAppSDK/discussions/1615
2877
2878 If this particular CI job turns out to be not worth the maintenance
2879 burden or CPU time, or too much of a hack, feel free to delete it.
2880
2881 Ref: https://github.com/libssh2/libssh2/pull/1147#issuecomment-1670850890
2882 Closes #1155
2883
2884 - cmake: replace `libssh2` literals with `PROJECT_NAME` variable
2885
2886 Where applicable.
2887
2888 This also makes it more obvious which `libssh2` uses were referring
2889 to the project itself.
2890
2891 Closes #1152
2892
2893 - cmake: fix `STREQUAL` check in error branch
2894
2895 This caused a CMake error instead of our custom error when manually
2896 selecting the `WinCNG` crypto-backend for a non-Windows target.
2897
2898 Also cleanup `STREQUAL` checks to use variable name without `${}` on
2899 the left side and quoted string literals on the right.
2900
2901 Closes #1151
2902
2903 - misc: flatten `_libssh2_explicit_zero` if tree
2904
2905 Closes #1149
2906
2907 - src: drop a redundant `#include`
2908
2909 We include `misc.h` via `libssh2_priv.h` already.
2910
2911 Closes #1153
2912
2913 - openssl: use automatic initialization with LibreSSL 2.7.0+
2914
2915 Stop calling `OpenSSL_add_all_*()` for LibreSSL 2.7.0 and later.
2916
2917 LibreSSL 2.7.0 (2018-03-21) introduced automatic initialization and
2918 deprecated these functions. Stop calling these functions manually for
2919 LibreSSL version that no longer need them.
2920
2921 Ref: https://ftp.openbsd.org/pub/OpenBSD/LibreSSL/libressl-2.7.0-relnotes.txt
2922 Ref: https://github.com/libressl/openbsd/commit/46f29f11977800547519ee65e2d1850f2483720b
2923 Ref: https://github.com/libssh2/libssh2/issues/302
2924
2925 Also stop calling `ENGINE_*()` functions when initialization is
2926 automatic with LibreSSL 2.7.0+ and OpenSSL 1.1.0+. Engines are also
2927 initializated automatically with these.
2928
2929 Closes #1146
2930
2931 - gha: restore curly braces in `if`
2932
2933 Without curly braces it was less obvious which string is a GHA expression.
2934
2935 Also fix an `if` expression that always missed its curly braces.
2936
2937 Reverts cab3db588769d6deed97ba89ca9221fd7503405e
2938
2939 Closes #1145
2940
2941 - ci: bump mbedtls
2942
2943 - [renmingshuai brought this change]
2944
2945 Add a new structure to separate memory read and file read.
2946 We use different APIs when we read one private key from memory,
2947 so it is improper to store the private key information in the
2948 structure that stores the private key file information.
2949
2950 Fixes https://github.com/libssh2/libssh2/issues/773
2951 Reported-by: mike-jumper
2952
2953 - tests: replace FIXME with comments
2954
2955 `key_dsa_wrong` is the same kind of (valid) key as `key_dsa`, both with
2956 an empty passphrase. Named "wrong" because it's intentionally not added
2957 to our `openssh_server/authorized_keys` file.
2958
2959 - tidy-up: delete duplicate word from comment
2960
2961 - cmake: cache more config values on Windows
2962
2963 Set two cases of non-detection to save the time dynamically detecting
2964 these on each build init. Affects old MSVC versions.
2965
2966 Before:
2967 https://ci.appveyor.com/project/libssh2org/libssh2/builds/47668870/job/i17e0e9yx8rgpv4i
2968
2969 After:
2970 https://ci.appveyor.com/project/libssh2org/libssh2/builds/47674950/job/ysa1jq0pxtyhui3f
2971
2972 Closes #1142
2973
2974 - revert: build: respect autotools `DLL_EXPORT` in `libssh2.h`
2975
2976 Revert fb1195cf88268a11e2709b9912ab9dca8c23739c #917
2977
2978 On a second look this change did not improve anything with autotools
2979 builds. autotools seems to handle the dll export matter without it.
2980
2981 This patch also broke (e.g.) curl-for-win autotools builds, where the
2982 curl build defines `DLL_EXPORT` while building libcurl DLL. `libssh2.h`
2983 picks it up, resulting in unresolved symbols while trying to link a
2984 static libssh2 on Windows. The best fix seems to be to revert this,
2985 instead of adding extra tweaks to dependents.
2986
2987 Fixes:
2988 https://ci.appveyor.com/project/curlorg/curl-for-win/builds/47667412#L11035
2989 ```
2990 ld.lld-15: error: undefined symbol: __declspec(dllimport) libssh2_session_block_directions
2991 >>> referenced by vssh/.libs/libcurl_la-libssh2.o:(ssh_do)
2992 >>> referenced by vssh/.libs/libcurl_la-libssh2.o:(ssh_connect)
2993 >>> referenced by vssh/.libs/libcurl_la-libssh2.o:(ssh_multi_statemach)
2994 >>> referenced 8 more times
2995
2996 ld.lld-15: error: undefined symbol: __declspec(dllimport) libssh2_session_init_ex
2997 >>> referenced by vssh/.libs/libcurl_la-libssh2.o:(ssh_connect)
2998
2999 ld.lld-15: error: undefined symbol: __declspec(dllimport) libssh2_session_set_read_timeout
3000 [...]
3001 ```
3002
3003 Closes #1141
3004
3005 - gha: simplify `if` strings
3006
3007 Closes #1140
3008
3009 - test_read: make it run without Docker
3010
3011 Apply an existing fix to `test_read`, so that it falls back to use
3012 the current username instead of the hardcoded `libssh2` when run
3013 outside Docker.
3014
3015 This allows to run algo tests with this command:
3016 ```shell
3017 cd tests
3018 ./test_sshd.test ./test_read_algos.test
3019 ```
3020
3021 Closes #1139
3022
3023 - cmake: streamline invocation
3024
3025 Stop specifiying the current directory.
3026 Simplify build instructions.
3027
3028 Closes #1138
3029
3030 - NMakefile: delete
3031
3032 This make file was for long time unmaintained (last updated in 2014).
3033 Despite best efforts to keep it working in the recent round of major
3034 overhauls, it appears to be broken now. There is also no way to test it
3035 without an actual MSVC env and it's also missing from our CI. Based on
3036 our Issue tracker, it's also not widely used.
3037
3038 Since its addition in 2005, libssh2 got support for CMake in 2014.
3039 CMake should be able to generate NMake makefiles with the option
3040 `-G "NMake Makefiles"`. (I haven't tested this.)
3041
3042 Ref: https://github.com/libssh2/libssh2/discussions/1129
3043 Closes #1134
3044
3045 - tests: add aes256-gcm encrypted key test
3046
3047 Follow-up to #1133
3048
3049 Also update `tests/gen_keys.sh` to set `aes256-ctr` encryption method
3050 for `key_ed25519_encrypted' explicitly.
3051
3052 Closes #1135
3053
3054 GitHub (26 Jul 2023)
3055 - [Jakob Egger brought this change]
3056
3057 Fix private keys encrypted with aes-gcm methods (#1133)
3058
3059 libssh2 1.11.0 fails to decrypt private keys encrypted with
3060 [email protected] and [email protected] ciphers.
3061
3062 To reproduce the issue, you can create a test key with a command like
3063 the following:
3064
3065 ```bash
3066 ssh-keygen -Z [email protected] -f id_aes256-gcm
3067 ```
3068
3069 If you attempt to use this key for authentication, libssh2 returns the
3070 not-so-helpful error message "Wrong passphrase or invalid/unrecognized
3071 private key file format".
3072
3073 The problem is that OpenSSH encrypts keys differently than packets. It
3074 does not include the length as AAD, and the 16 byte authentication tag
3075 is appended after the encrypted key. The length of the authentication
3076 tag is not included in the encrypted key length.
3077
3078 I have not found any documentation for this behaviour -- I discovered it
3079 by looking at the OpenSSH source. See the `private2_decrypt` function in
3080 <https://github.com/openssh/openssh-portable/blob/master/sshkey.c>.
3081
3082 This patch fixes the code for reading OpenSSH private keys encrypted
3083 with AES-GCM methods.
3084
3085 Viktor Szakats (26 Jul 2023)
3086 - ci: add missing timeout to 'autotools distcheck' step
3087
3088 - cmake: merge `set_target_properties()` calls
3089
3090 Also rename variable `LIBSSH2_VERSION` to `LIBSSH2_LIBVERSION` in
3091 context of lib versioning to avoid collision with another use.
3092
3093 Closes #1132
3094
3095 - cmake: formatting [ci skip]
3096
3097 - cmake: (re-)add zlib to `Libs.private` in `libssh2.pc`
3098
3099 We mistakently added transitive zlib to `Requires.private` before, then
3100 removed it. This patch re-adds zlib, but this time to `Libs.private`,
3101 which is listing raw libs and should include transitive libs as well.
3102
3103 Also add zlib when used as a direct dependency when zlib compression
3104 support is enabled.
3105
3106 Follow-up to ef538069a661a43134fe7b848b1fe66b2b43bdac
3107
3108 Closes #1131
3109
3110 - cmake: formatting [ci skip]
3111
3112 - cmake: use `wolfssl/options.h` for detection, like autotools
3113
3114 Closes #1130
3115
3116 - build: stop requiring libssl from openssl
3117
3118 libssh2 does not use or need the TLS/SSL library of OpenSSL.
3119 It only needs libcrypto.
3120
3121 Closes #1128
3122
3123 - cmake: add openssl libs to `Libs.private` in `libssh2.pc`
3124
3125 Also to sync up with autotools-generated `libssh2.pc`, that
3126 already added them.
3127
3128 Closes #1127
3129
3130 - Makefile.mk: stop linking unused mbedtls libs
3131
3132 Stop linking libmbedtls and libmbedx509 (similarly to autotools).
3133 Only libmbedcrypto is necessary for libssh2.
3134
3135 - cmake: bump minimum CMake version to v3.7.0
3136
3137 Fixes the warning below, which appeared in CMake v3.27.0:
3138 ```
3139 CMake Deprecation Warning at CMakeLists.txt:39 (cmake_minimum_required):
3140 Compatibility with CMake < 3.5 will be removed from a future version of
3141 CMake.
3142
3143 Update the VERSION argument <min> value or use a ...<max> suffix to tell
3144 CMake that the project does not need compatibility with older versions.
3145 ```
3146
3147 Bump straight up to v3.7.0 to sync up with the curl project:
3148 https://github.com/curl/curl/blob/2900c29218d2d24ab519853589da84caa850e8c7/CMakeLists.txt#L64
3149
3150 CMake release dates:
3151 v3.7.0 2016-11-11
3152 v3.5.0 2016-03-08
3153 v3.1.0 2014-12-17
3154
3155 Closes #1126
3156
3157 - build: tidy-up `libssh2.pc.in` variable names
3158
3159 - prefix with `LIBSSH2_PC_`
3160
3161 - match with the names of `pkg-config` values.
3162
3163 - use the same names in autotools and CMake scripts.
3164
3165 - use `LIBSSH2_VERSION` for the version number in autotools scripts,
3166 to match the name used in CMake.
3167
3168 Closes #1125
3169
3170 - libssh2.pc: re-add & extend support for static-only libssh2 builds
3171
3172 Adapted for libssh2 from the curl commit message by James Le Cuirot:
3173
3174 "A project built entirely statically will call `pkg-config` with
3175 `--static`, which utilises the `Libs.private:` field. Conversely it will
3176 not use `--static` when not being built entirely statically, even if
3177 there is only a static build of libssh2 available. This will most
3178 likely cause the build to fail due to underlinking unless we merge the
3179 `Libs:` fields.
3180
3181 Consider that this is what the Meson build system does when it generates
3182 `pkg-config` files."
3183
3184 This patch extends the above to `Requires:`, to mirror `Libs:` with
3185 `pkg-config` package names.
3186
3187 Follow-up to 1209c16d93cba3c5e0f68c12fa4a5049f49c00d8 #1114
3188
3189 Ref: https://github.com/libssh2/libssh2/pull/1114#issuecomment-1634334809
3190 Ref: https://github.com/curl/curl/commit/98e5904165859679cd78825bcccb52306ee3bb66
3191 Ref: https://github.com/curl/curl/pull/5373
3192 Closes #1119
3193
3194 GitHub (14 Jul 2023)
3195 - [Nursan Valeyev brought this change]
3196
3197 cmake: CMAKE_SOURCE_DIR -> PROJECT_SOURCE_DIR (#1121)
3198
3199 Fixes compiling as dependency with FetchContent
3200
3201 Co-authored-by: Viktor Szakats
3202
3203 Viktor Szakats (14 Jul 2023)
3204 - autotools: use comma separator in `Requires.private` of `libssh2.pc`
3205
3206 In `Requires*:`, the documented name separator is comma. We already used
3207 it in the CMake-generated `libssh2.pc`. Adjust the autotools-generated
3208 one to use it too, instead of spaces.
3209
3210 Ref: https://linux.die.net/man/1/pkg-config
3211 Ref: https://gitlab.freedesktop.org/pkg-config/pkg-config/-/blob/d97db4fae4c1cd099b506970b285dc2afd818ea2/pkg-config.1
3212
3213 Closes #1124
3214
3215 - build: add/fix `Requires.private` packages in `libssh2.pc`
3216
3217 - autotools was using `libwolfssl`. CMake left it empty. wolfSSL
3218 provides `wolfssl.pc`. This patch sets `Requires.private: wolfssl`
3219 with both build tools.
3220
3221 - add `libgcrypt` to `Requires.private` with both autotools and CMake.
3222 Ref:
3223 https://github.com/gpg/libgcrypt/blob/e76e88eef7811ada4c6e1d57520ba8c439139782/src/libgcrypt.pc.in
3224 Present since 2005-04-22:
3225 https://github.com/gpg/libgcrypt/commit/32bf3f13e8b45497322177645bebf0b5d0c9cb8e
3226 Released in v1.3.0 2007-05-04:
3227 https://github.com/gpg/libgcrypt/releases/tag/libgcrypt-1.3.0
3228
3229 - also stop adding transitive `zlib` deps to `Requires.private`.
3230 The referenced crypto package is adding it as nedded.
3231 This makes deduplication of the list redundant, so stop doing it.
3232 Follow-up to 2fc367900701e6149efc42bd674c4b69127756dd
3233
3234 (`libssh2.pc` not tested as a project dependency.)
3235
3236 Closes #1123
3237
3238 - cmake: tidy-ups
3239
3240 - dedupe `Requires.private` in `libssh2.pc`.
3241 `zlib` could appear on the list twice:
3242 ```
3243 Requires.private: libssl,libcrypto,zlib,zlib
3244 ```
3245 According to CMake docs `list(REMOVE_DUPLICATES ...)`, is supported by
3246 our minimum required CMake version (and by earlier ones even):
3247 https://cmake.org/cmake/help/v3.1/command/list.html#remove-duplicates
3248
3249 - move `cmake_minimum_required()` to the top.
3250
3251 - move `set(CMAKE_MODULE_PATH)` to the top.
3252
3253 - delete duplicate `set(CMAKE_MODULE_PATH)`.
3254
3255 - replace `CMAKE_CURRENT_SOURCE_DIR` with `PROJECT_SOURCE_DIR` in root
3256 `CMakeLists.txt` for robustness.
3257
3258 - replace `gcovr` option with long-form for readability/consistency.
3259
3260 - rename `GCOV_OPTIONS` to `GCOV_CFLAGS`. These are C options we enable
3261 when using gcov, not gcov tooling options.
3262
3263 Closes #1122
3264
3265 - openssl: add missing check for `LIBRESSL_VERSION_NUMBER` before use
3266
3267 Fixes:
3268 ```
3269 openssl.h:101:5: warning: "LIBRESSL_VERSION_NUMBER" is not defined [-Wundef]
3270 LIBRESSL_VERSION_NUMBER >= 0x3050000fL
3271 ^
3272 ```
3273
3274 Ref: https://github.com/libssh2/libssh2/issues/1115#issuecomment-1631845640
3275 Closes #1117
3276
3277 - [Harmen Stoppels brought this change]
3278
3279 Don't put `@LIBS@` in pc file
3280
3281 - misc: delete redundant NULL check and assignment
3282
3283 Follow-up to 724effcb47ebb713d3ef1776684b8f6407b4b6a5 #1109
3284
3285 Ref: https://github.com/libssh2/libssh2/pull/1109#discussion_r1246613274
3286 Closes #1111
3287
3288 - [renmingshuai brought this change]
3289
3290 We should check whether *key_method is a NULL pointer instead of key_method
3291
3292 Signed-off-by: renmingshuai <[email protected]>
3293
3294 GitHub (30 Jun 2023)
3295 - [ren mingshuai brought this change]
3296
3297 Add NULL pointer check for outlen before use (#1109)
3298
3299 Before assigning a value to the outlen, we need to check whether it is NULL.
3300
3301 Credit: Ren Mingshuai <[email protected]>
3302
3303 Viktor Szakats (25 Jun 2023)
3304 - cmake: re-add `Libssh2:libssh2` for compatibiliy + lowercase namespace
3305
3306 - add `libssh2:libssh2` target that selects the shared lib if built,
3307 otherwise the static one.
3308
3309 - re-add `Libssh2:libssh2` target for compatibility with v1.10.0 and
3310 earlier. This is an alias for `libssh2:libssh2`.
3311
3312 - keep `libssh2:libssh2_shared` and `libssh2_libssh2_static` targets.
3313
3314 - allow using `find_package(libssh2)` in dependents as an alternative
3315 to `find_package(Libssh2)`.
3316
3317 Co-authored-by: Radek Brich
3318 Suggested-by: Haowei Hsu
3319
3320 Fixes #1103
3321 Fixes #731
3322 Closes #1104
3323
3324 - example: fix regression in `ssh2_exec.c`
3325
3326 Regression from b13936bd6a89993cd3bf4a18317ca5bd84bb08d7 #861 #846.
3327 Update a variable name missed above.
3328
3329 Reported-by: PewPewPew
3330 Fixes #1105
3331 Closes #1106
3332
3333 - docs: replace SHA1 with SHA256 in CMake example
3334
3335 - checksrc: modernise perl file open
3336
3337 Use regular variables and separate file open modes from filenames.
3338
3339 Suggested by perlcritic
3340
3341 Copied from https://github.com/curl/curl/commit/7f669aa0f1d40ef5d64543981f22bdc5af1272f5
3342 Copied from https://github.com/curl/trurl/commit/f2784a9240f47ee28a845
3343
3344 - reuse: comply with 3.1 spec and 2.0.0 checker
3345
3346 The checker tool was upgraded upstream to 2.0.0 and the REUSE
3347 Specification to version 3.1 (from 3.0), causing these new errors:
3348 ```
3349 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.
3350 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.
3351
3352 The following files have no licensing information:
3353 * docs/INSTALL_AUTOTOOLS
3354 * tests/openssh_server/Dockerfile
3355 ```
3356 Via: https://github.com/libssh2/libssh2/actions/runs/5333572682/jobs/9664211341?pr=1098#step:4:4
3357
3358 Ref: https://github.com/fsfe/reuse-tool/releases/tag/v2.0.0
3359 Ref: https://git.fsfe.org/reuse/docs/src/branch/stable/CHANGELOG.md#3-1-2023-06-21
3360
3361 Original discovery: https://github.com/libssh2/libssh2/pull/1098#issuecomment-1600719575
3362
3363 Fixes #1101
3364 Closes #1102
3365
3366 - tests: trap signals in scripts
3367
3368 Closes #1098
3369
3370 - test_sshd.test: fixup to distcheck failure
3371
3372 Fixes:
3373 ```
3374 ERROR: test_sshd.test - missing test plan
3375 ERROR: test_sshd.test - exited with status 1
3376 ```
3377 Ref: https://github.com/libssh2/libssh2/actions/runs/5322354271/jobs/9638694218#step:10:532
3378
3379 Caused by trying to create the log file in a read-only directory.
3380
3381 Follow-up to 299c2040625830d06ad757d687807a166b57d6de
3382 Closes #1099
3383
3384 GitHub (21 Jun 2023)
3385 - [Viktor Szakats brought this change]
3386
3387 test_sshd.test: show sshd and test connect logs on harness failure (#1097)
3388
3389 - [Joel Depooter brought this change]
3390
3391 Fix incorrect byte offset in debug message (#1096)
3392
3393 Fixes debug log message
3394
3395 Credit:
3396 Joel Depooter
3397
3398 Viktor Szakats (16 Jun 2023)
3399 - tidy-up: delete whitespace at EOL [ci skip]
3400
3401 - mbedtls: include `version.h` for `MBEDTLS_VERSION_NUMBER`
3402
3403 Older (2021 or earlier?) mbedTLS releases require this.
3404
3405 Reported-by: rahmanih on Github
3406 Fixes #1094
3407 Closes #1095
3408
3409 - hostkey: do not advertise ssh-rsa when SHA1 is disabled
3410
3411 Before this patch OpenSSL, mbedTLS, WinCNG and OS/400 advertised both
3412 SHA2 and SHA1 host key algos, even when SHA1 was not supported by the
3413 crypto backend or when forcefully disabled via `LIBSSH2_NO_RSA_SHA1`.
3414
3415 Reported-by: João M. S. Silva
3416 Fixes #1092
3417 Closes #1093
3418
3419 - openssl.h: whitespace tidy-up [ci skip]
3420
3421 GitHub (14 Jun 2023)
3422 - [Dan Fandrich brought this change]
3423
3424 test_sshd.test: set a safe PID directory (#1089)
3425
3426 The compiled in default to sshd can be a non-writable location since it
3427 expects to be run as root.
3428
3429 Viktor Szakats (13 Jun 2023)
3430 - mingw: fix printf mask for 64-bit integers
3431
3432 Before 02f2700a61157ce5a264319bdb80754c92a40a24 #846 #876, we used
3433 `%I64d'. That patch changed this to `%lld`. This patch uses `PRId64`
3434 (defined in `inttypes.h`).
3435
3436 Fixes #1090
3437 Closes #1091
3438
3439 - test_sshd.test: minor cleanups
3440
3441 Daniel Stenberg (7 Jun 2023)
3442 - provide SPDX identifiers
3443
3444 - All files have prominent copyright and SPDX identifier
3445 - If not embedded in the file, in the .reuse/dep5 file
3446 - All used licenses are in LICENSES/ (not shipped in tarballs)
3447 - A new REUSE CI job verify that all files are OK
3448
3449 Assisted-by: Viktor Szakats
3450
3451 Closes #1084
3452
3453 Viktor Szakats (6 Jun 2023)
3454 - src: improve MSVC C4701 warning fix
3455
3456 Simplify the code to avoid this warning. This might also help avoiding
3457 it with other compilers (e.g. gcc?).
3458
3459 Improves 02f2700a61157ce5a264319bdb80754c92a40a24 #876
3460 Might fix #1083
3461 Closes #1086
3462
3463 Daniel Stenberg (5 Jun 2023)
3464 - configure.ac: remove AB_INIT
3465
3466 Not used. Remove m4/autobuild.m4 as well
3467
3468 Viktor Szakats (4 Jun 2023)
3469 - copyright: remove years from copyright headers
3470
3471 Also:
3472 - uppercase `(C)`.
3473 - add missing 'All rights reserved.' lines.
3474 - drop duplicate 'Author' lines.
3475 - add copyright headers where missing.
3476 - enable copyright header check in checksrc.
3477
3478 Reasons for deleting years (copied as-is from curl):
3479 - they are mostly pointless in all major jurisdictions
3480 - many big corporations and projects already don't use them
3481 - saves us from pointless churn
3482 - git keeps history for us
3483 - the year range is kept in COPYING
3484
3485 Closes #1082
3486
3487 - tests: cast to avoid `-Wchar-subscripts` with Cygwin
3488
3489 ```
3490 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:
3491 $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':
3492 $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]
3493 136 | while(end > 0 && isspace(buf[end - 1])) {
3494 | ~~~^~~~~~~~~
3495 ```
3496 Ref: https://github.com/libssh2/libssh2/files/11644340/cygwin-x86_64-libssh2-1.11.0-1-check.log
3497
3498 Reported-by: Brian Inglis
3499 Fixes #1080
3500 Closes #1081
3501
3502 - tidy-up: avoid exclamations, prefer single quotes, in outputs
3503
3504 Closes #1079
3505
3506 - autotools: improve libz position
3507
3508 We repositioned crypto libs in 4f0f4bff5a92dce6a6cd7a5600a8ee5660402c3f
3509 via #941 and subsequently in d4f58f03438e326b8696edd31acadd6f3e028763
3510 from d93ccf4901ef26443707d341553994715414e207 via #1013.
3511
3512 This patch moves libz accordingly, to unbreak certain build scenarios.
3513
3514 Reported-by: Kenneth Davidson
3515 Regression from 4f0f4bff5a92dce6a6cd7a5600a8ee5660402c3f #941
3516 Fixes #1075
3517 Closes #1077
3518
3519 - src: bump `hash_len` to `size_t` in `LIBSSH2_HOSTKEY_METHOD`
3520
3521 Follow-up to 7b8e02257f01a6dac5f65305b18bb74a157fb5c4
3522 Closes #1076
3523
3524 - ci: add non-static autotools i386 build, ignore GHA updates on AppVeyor
3525
3526 Add a non-static autotools build to GitHub Actions. Make this build
3527 target i386 and libgcrypt, to test a new build combination if we are at
3528 it.
3529
3530 Also:
3531 - GHA: add necessary generic bits for i386 autotools builds.
3532 - AppVeyor CI: teach it to ignore commits updating our GHA config.
3533
3534 Follow-up to 572c57c9d8d4e89cfce19dde40125d55481256d1 #1072
3535 Closes #1074
3536
3537 GitHub (31 May 2023)
3538 - [Xi Ruoyao brought this change]
3539
3540 autotools: skip tests requiring static lib if `--disable-static` (#1072)
3541
3542 Co-authored-by: Viktor Szakats
3543 Regression from 83853f8aea0e2f739cacd491632eb7fd3d03ad2d #663
3544 Fixes #1056
3545
3546 Viktor Szakats (31 May 2023)
3547 - ci: prefer `=` operator in shell snippets
3548
3549 Closes #1073
3550
3551 - src: bump DSA and ECDSA sign `hash_len` to `size_t`
3552
3553 Closes #1055
3554
3555 - scp: fix missing cast for targets without large file support
3556
3557 E.g. on 32-bit Linux. Issue revealed after adding i386 Linux CI build
3558 in abdf40c741c575f94bdea1c67a9d1182ff813ccb #1057.
3559
3560 ```
3561 /home/runner/work/libssh2/libssh2/src/scp.c: In function 'scp_recv':
3562 /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]
3563 765 | sb->st_size = session->scpRecv_size;
3564 | ^~~~~~~
3565 ```
3566 Ref: https://github.com/libssh2/libssh2/actions/runs/5126803482/jobs/9221746299?pr=1054#step:12:51
3567
3568 Regression from 5db836b2a829c6fff1e8c7acaa4b21b246ae1757 #1002
3569 Closes #1060
3570
3571 - mbedtls.h: formatting [ci skip]
3572
3573 For consistency with `mbedtls.c`.
3574
3575 Follow-up to 1153ebdeba563ac657b525edd6bf6da68b1fe5e2
3576
3577 - libssh2.h: bump to 1.11.1_DEV [ci skip]
3578
3579 - mbedtls: use more `size_t` to sync up with `crypto.h`
3580
3581 Ref: 5a96f494ee0b00282afb2db2e091246fc5e1774a #846 #879
3582
3583 Fixes #1053
3584 Closes #1054
3585
3586 - ci: drop redundant/unused vars, sync var names
3587
3588 Closes #1059
3589
3590 - ci: add i386 Linux build (with mbedTLS)
3591
3592 Also:
3593 - reorder Linux build matrix to make build tool more visible.
3594 - hide apt-get progress bar.
3595 - prepare package install step for i386 builds.
3596
3597 Detects bug #1053
3598 Closes #1057
3599
3600 - checksrc: switch to dot file
3601
3602 Closes #1052
3603
3604 Version 1.11.0 (30 May 2023)
3605
3606 Daniel Stenberg (30 May 2023)
3607 - libssh2.h: bump to 1.11.0 for release
3608
3609 GitHub (30 May 2023)
3610 - [Will Cosgrove brought this change]
3611
3612 Libssh2 1.11 release notes, copyright (#1048)
3613
3614 * Libssh2 1.11 release notes, copyright
3615
3616 Viktor Szakats (29 May 2023)
3617 - add copyright/credits
3618
3619 Closes #1050
3620
3621 - ci: add LIBSSH2_NO_AES_CBC to GNU Make build
3622
3623 Closes #1049
3624
3625 - ci: add wolfSSL Linux builds
3626
3627 Exclude wolfSSL builds from tests. All fail:
3628
3629 ```
3630 2/43 Test #2: test_aa_warmup ............................***Failed 5.59 sec
3631 libssh2_session_handshake failed (-44): Unable to ask for ssh-userauth service
3632 ```
3633 Ref: https://github.com/libssh2/libssh2/actions/runs/5085775952/jobs/9139583212#step:12:942 (with logging)
3634 Ref: https://github.com/libssh2/libssh2/actions/runs/5085586301/jobs/9139192562#step:12:225
3635
3636 wolfSSL version:
3637 ```
3638 Get:1 http://azure.archive.ubuntu.com/ubuntu jammy/universe amd64 libwolfssl32 amd64 5.2.0-2 [818 kB]
3639 Get:2 http://azure.archive.ubuntu.com/ubuntu jammy/universe amd64 libwolfssl-dev amd64 5.2.0-2 [1194 kB]
3640 ```
3641
3642 Cherry-picked from #1046
3643 Closes #1046
3644
3645 - ci: mbedTLS build config tidy-up
3646
3647 Cherry-picked from #1046
3648
3649 - wolfssl: fix detection of AES-GCM feature
3650
3651 Follow-up to df513c0128e1a811ad863d153892618e728845f0
3652
3653 Ref: https://github.com/libssh2/libssh2/issues/1020#issuecomment-1562069241
3654 Closes #1045
3655
3656 - build: fix 'unused' compiler warnings with all `NO` options set
3657
3658 - add `LIBSSH2_NO_ED25519` build-time option to force-disable ED25519
3659 support. Useful to replicate crypto-backend builds without ED25519,
3660 such as wolfSSL.
3661
3662 - openssl: fix unused variable and function warnings with all supported
3663 `LIBSSH2_NO_*` options enabled.
3664
3665 - mbedtls: fix misplaced `#endif` leaving out the required internal
3666 public function `libssh2_supported_key_sign_algorithms()`.
3667
3668 - mbedtls: add missing prototype for two internal public functions.
3669
3670 - delete a redundant block.
3671
3672 All `NO` options:
3673 ```shell
3674 CPPFLAGS='
3675 -DLIBSSH2_NO_MD5 -DLIBSSH2_NO_HMAC_RIPEMD -DLIBSSH2_NO_DSA
3676 -DLIBSSH2_NO_RSA -DLIBSSH2_NO_RSA_SHA1
3677 -DLIBSSH2_NO_ECDSA -DLIBSSH2_NO_ED25519 -DLIBSSH2_NO_AES_CTR
3678 -DLIBSSH2_NO_BLOWFISH -DLIBSSH2_NO_RC4 -DLIBSSH2_NO_CAST
3679 -DLIBSSH2_NO_3DES'
3680 ```
3681
3682 Closes #1044
3683
3684 - cmake: avoid `list(PREPEND)` for compatibility
3685
3686 `list(PREPEND)` requires CMake v3.15, our minimum is v3.1. `APPEND`
3687 should work fine for headers anyway.
3688
3689 Also fix a wrongly placed comment.
3690
3691 Ref: https://cmake.org/cmake/help/latest/command/list.html#prepend
3692
3693 Regression from 1e3319a167d2f32d295603167486e9e88af9bb4e
3694
3695 Closes #1043
3696
3697 - checksrc: verify label indent, fix fallouts
3698
3699 Also update two labels to match the rest of the source.
3700
3701 checksrc update credit: Emanuele Torre @emanuele6
3702
3703 Ref: https://github.com/curl/curl/pull/11134
3704
3705 Closes #1042
3706
3707 - tidy-up: minor nits
3708
3709 - ci: drop default shared/static configuration options
3710
3711 Both autotools and cmake build both shared and static lib by default.
3712
3713 Ref: 896154bc17f000c0a1bb89b74bc879692ac0d47c
3714
3715 Delete configuration enabling these explicitly in CI jobs.
3716
3717 Cherry-picked from #1036
3718 Closes #1036
3719
3720 - cmake: enable shared libssh2 library by default
3721
3722 This brings default behaviour in sync with autotools, which builds both
3723 lib flavours by default.
3724
3725 (Notice that on Windows, autotools includes the Windows Resource in the
3726 static library, when building both at the same time. CMake doesn't have
3727 this issue.)
3728
3729 Enabling both lib flavours has a side-effect when using non-MinGW
3730 toolchains (e.g. MSVC): to resolve the filename conflict between import
3731 and static libraries, we add a suffix to the static lib, naming it
3732 `libssh2_static.lib`. This can break dependent builds relying on
3733 `libssh2.lib` for linking the static libssh2.
3734
3735 Workarounds:
3736
3737 - disable either shared or static libssh2 via
3738 `-DBUILD_STATIC_LIBS=OFF` or
3739 `-DBUILD_SHARED_LIBS=OFF`. This results in a libssh2 library (either
3740 static or shared) without a prefix: `libssh2.lib`.
3741
3742 - set a custom static library suffix via:
3743 `-DSTATIC_LIB_SUFFIX=_my_static`. Resulting in
3744 `libssh2_my_static.lib`, and import library
3745 `libssh2.lib`.
3746
3747 - set a custom import library suffix via:
3748 `-DIMPORT_LIB_SUFFIX=_my_implib`. Resulting in
3749 `libssh2_my_implib.lib` import library, and static library
3750 `libssh2.lib`.
3751
3752 - customize the default static/import library suffix (incl. extension)
3753 via
3754 `-DCMAKE_STATIC_LIBRARY_SUFFIX=_my_static_suffix.lib` or
3755 `-DCMAKE_IMPORT_LIBRARY_SUFFIX=_my_import_suffix.lib`.
3756
3757 Cherry-picked from #1036
3758
3759 - cmake: tweak static/import lib name collision avoidance logic
3760
3761 The collision issue affects (typically) MSVC, when building both shared
3762 and static libssh2 in one go.
3763
3764 Ref: https://stackoverflow.com/questions/2140129/what-is-proper-naming-convention-for-msvc-dlls-static-libraries-and-import-libr
3765
3766 Initially we handled this by appending the `_imp` suffix to the import
3767 library filename. This is how curl tackles this, but on a second look,
3768 this solution seem to be accidental and has no widespread use.
3769
3770 It seems more widely accepted to use the '_static' suffix for the static
3771 library. This patch implements this.
3772
3773 (MinGW, Cygwin and unixy platforms are not affected by this issue.)
3774
3775 Follow-up to 4e2580628dd1f8dc51ac65ac747ebcf0e93fa3d1
3776
3777 Cherry-picked from #1036
3778
3779 - cmake: add `IMPORT_LIB_SUFFIX` (like `STATIC_LIB_SUFFIX`)
3780
3781 Allow resolving the import/static library name collision also by setting
3782 a custom _import_ library name suffix.
3783
3784 Follow-up to 4e2580628dd1f8dc51ac65ac747ebcf0e93fa3d1
3785
3786 Cherry-picked from #1036
3787
3788 - ci: do not disable shared lib with msys2/autotools in GHA
3789
3790 Cherry-picked from #1036
3791
3792 - Makefile.mk: fix `DYN=1 test` by skipping tests needing static lib
3793
3794 `DYN=1` means to build examples/tests against the shared libssh2.
3795
3796 Before this patch this was broken for building tests. This patch skips
3797 building tests that require the static libssh2 library, so the build now
3798 succeeds.
3799
3800 Also move the list of tests that require static lib from
3801 `CMakeLists.txt` to `Makefile.inc`, so that we can reuse it in
3802 `Makefile.mk`.
3803
3804 Couldn't find a way to also reuse it in `Makefile.am`. Move the
3805 `Makefile.am` specific definitions close to the shared list, to make it
3806 easier to keep them synced.
3807
3808 Cherry-picked from #1036
3809
3810 - ci: make one of the AppVeyor CMake jobs shared-only
3811
3812 This build combination did not have a CI test before.
3813
3814 Cherry-picked from #1036
3815
3816 - cmake: allow tests with `BUILD_STATIC_LIBS=OFF`
3817
3818 Before this patch, the CMake build did not allow to disable static
3819 libssh2 library while also building tests.
3820
3821 This patch removes this constraint, and makes this combination possible.
3822 In this case the 3 (at the moment) tests that require a static libssh2
3823 library, are skipped from the build and test runs.
3824
3825 Cherry-picked from #1036
3826
3827 - build: fix to set `-DLIBSSH2DEBUG` for tests
3828
3829 Required for tests using libssh2 internals. These are the ones
3830 requiring the libssh2 _static_ lib.
3831
3832 Before this patch, `src` and `tests` declared the `session` structure
3833 differently, due to extra struct members added with the `LIBSSH2DEBUG`
3834 macro set. But, the macro was only set for `src` when using CMake. At
3835 runtime this caused struct members to be at different offsets between
3836 lib and test code, resulting in the test failures below.
3837
3838 Due to another bug in the affected test, these failures did not reflect
3839 in the exit code, which always returned success, so this went unnoticed
3840 for a good while. Fixed in: 84d31d0ca7b647ad4c2aa92bf8f4a94b233f5d3b
3841
3842 ```
3843 Start 5: test_auth_keyboard_info_request
3844 [...]
3845 5: Test case 1 passed
3846 5: Test case 2 passed
3847 5: Test case 3: expected return code to be 0 got -1
3848 5: Test case 4: expected last error code to be "-6" got "-38"
3849 5: Test case 5: expected last error code to be "-6" got "-38"
3850 5: Test case 6: expected last error code to be "-6" got "-38"
3851 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
3852 5: Test case 8: expected last error code to be "-41" got "-38"
3853 5: Test case 9: expected return code to be 0 got -1
3854 5: Test case 10: expected return code to be 0 got -1
3855 5: Test case 11: expected last error code to be "-6" got "-38"
3856 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"
3857 5: Test case 13: expected return code to be 0 got -1
3858 5: Test case 14: expected return code to be 0 got -1
3859 5: Test case 15: expected last error code to be "-6" got "-38"
3860 5: Test case 16: expected last error code to be "-6" got "-38"
3861 5: Test case 17: expected last error code to be "-6" got "-38"
3862 5: Test case 18: expected last error code to be "-6" got "-38"
3863 ```
3864 Ref: https://ci.appveyor.com/project/libssh2org/libssh2/builds/46925869/job/i9uasceu3coss0i2#L440
3865 Ref: https://ci.appveyor.com/project/libssh2org/libssh2/builds/46983040/job/c3vag25c26a77lyr#L485
3866
3867 Cherry-picked from #1037
3868 Closes #1037
3869
3870 - test_auth_keyboard_info_request: fix to return failure
3871
3872 Before this patch, this test returned success even when one of its tests
3873 failed. Fix it by returning 1 in case any of the tests fails.
3874
3875 This issue masked a CMake build bug with logging enabled. Subject to an
3876 upcoming patch.
3877
3878 Cherry-picked from #1037
3879
3880 - test_auth_keyboard_info_request: fix indentation
3881
3882 Cherry-picked from #1037
3883
3884 - tidy-up: move comment off from copyright header
3885
3886 Cherry-picked from #1037
3887
3888 - ci: enable shared libs in msys2/macOS cmake builds
3889
3890 Shared libs improve example/tests build times. For "unity"
3891 builds the overhead of building shared lib is negligible, so
3892 this even reduced the overall build-time.
3893
3894 Follow-up to 3d64a3f5100f7f4cf52202396eb4f1c3f3567771
3895 Follow-up to d93ccf4901ef26443707d341553994715414e207
3896
3897 Tests:
3898 https://github.com/libssh2/libssh2/actions/runs/4906586658: unity builds enabled
3899 https://github.com/libssh2/libssh2/actions/runs/4906925743: unity builds enabled + parallel msys2 builds
3900 https://github.com/libssh2/libssh2/actions/runs/4906777629: unity + shared lib (this commit)
3901 https://github.com/libssh2/libssh2/actions/runs/4906927190: unity + shared lib (this commit) + parallel msys2 builds
3902
3903 Consider making shared libs enabled by default also in CMake, to sync it with autotools?
3904
3905 Closes #1035
3906
3907 - ci: add missed --parallel 3 from msys2 cmake builds
3908
3909 Follow-up to 3d64a3f5100f7f4cf52202396eb4f1c3f3567771
3910
3911 - cmake: add and test "unity" builds
3912
3913 "Unity" (aka "jumbo", aka "amalgamation" builds concatenate source files
3914 before compiling. It has these benefits for example: faster builds,
3915 improved code optimization, cleaner code. Let's support and test this.
3916
3917 - enable unity builds for some existing CI builds to test this build
3918 scenario.
3919 - tune `UNITY_BUILD_BATCH_SIZE` size.
3920 - disable unity build for example and test programs (they use one source
3921 each already).
3922
3923 You can enable it by passing `-DCMAKE_UNITY_BUILD=ON` to cmake.
3924 Supported by CMake 3.16 and newer.
3925
3926 Ref: https://cmake.org/cmake/help/latest/prop_tgt/UNITY_BUILD.html
3927
3928 Closes #1034
3929
3930 - tests: simplify passing `srcdir` to tests
3931
3932 Before this patch libssh2 used a variety of solutions to pass the source
3933 directory to tests: `FIXTURE_WORKDIR` build-time macro (cmake),
3934 `FIXTURE_WORKDIR` envvar (unused), setting `srcdir` manually
3935 (autotools), setting current directory (cmake), and also `builddir`
3936 envvar (autotools) for passing current working dir to `mansyntax.sh`.
3937
3938 This patch reduces this to using existing `srcdir` with autotools and
3939 setting it ourselves in CMake. This was mostly enabled by this recent
3940 patch: 4c9ed51f962f542b98789b15bedaaa427f4029a2
3941
3942 Details:
3943
3944 - cmake: replace baked-in `FIXTURE_WORKDIR` macro with env.
3945
3946 Added in 54bef4c5dad868a9d45fdbfca9729b191c0abab5 #198 (2018-03-21)
3947
3948 - rename `FIXTURE_WORKDIR` to `srcdir`, to match autotools.
3949
3950 - cmake: add missing `srcdir` for algo and sshd tests.
3951
3952 - session_fixture: stop `chdir()`-ing, rely on prefixing with `srcdir`.
3953
3954 Changing current directory should be unnecessary after
3955 4c9ed51f962f542b98789b15bedaaa427f4029a2 #801 (2023-02-24),
3956 that prefixes referenced input filenames with the `srcdir` envvar.
3957
3958 The `srcdir` envvar was already exported by autotools, and now we're
3959 also setting it from CMake.
3960
3961 - cmake: stop setting `WORKING_DIRECTORY`, rely on `srcdir` env.
3962
3963 `WORKING_DIRECTORY` is no longer necessary, after passing `srcdir` to
3964 all tests, so they can find our source tree and keys/etc in it
3965 regardless of the current directory.
3966
3967 Also this past commit hints that `WORKING_DIRECTORY` wasn't always
3968 working for this purpose as expected:
3969 "tests: Xcode doesn't obey CMake's test working directory"
3970 Ref: https://github.com/libssh2/libssh2/pull/198/commits/10a5cbf945abcc60153ee3d59284d09fc64ea152
3971
3972 - autotools: delete explicit `srcdir` for test env.
3973
3974 Added in 13f8addd1bc17e6c55d52491cc6304319ac38c6d (2015-07-02)
3975
3976 automake documents `srcdir` as exported to the test environment:
3977 https://github.com/autotools-mirror/automake/blob/c04c4e8856e3c933239959ce18e16599fcc04a8b/doc/automake.texi#L9302-L9304
3978 https://www.gnu.org/software/automake/manual/html_node/Scripts_002dbased-Testsuites.html
3979 It's mentioned in the docs back in 1997 and got a regression test in
3980 2012. We can safely assume it to be available without setting it
3981 ourselves.
3982
3983 - autotools: delete explicit `builddir`.
3984
3985 Added in 13f8addd1bc17e6c55d52491cc6304319ac38c6d (2015-07-02)
3986
3987 It seems this wasn't necessary to make the above fix work, and
3988 `mansyntax.sh` is able to figure out the build workdir by reading
3989 `$PWD`. Our out-of-tree and `make distcheck` CI builds also work
3990 without it.
3991
3992 Let us know if there is a scenario we're missing and needs this.
3993
3994 Closes #1032
3995
3996 - src: fix `libssh2_store_*()` for >u32 inputs
3997
3998 `_libssh2_store_str()` and `_libssh2_store_bignum2_bytes()` accept
3999 inputs of `size_t` max, store the size as 32-bit unsigned integer, then
4000 store the complete input buffer.
4001
4002 With inputs larger than `UINT_MAX` this means the stored size is smaller
4003 than the data that follows it.
4004
4005 This patch truncates the stored data to the stored size, and now returns
4006 a boolean with false if the stored length differs from the requested
4007 one. Also add `assert()`s for this condition.
4008
4009 This is still not a correct fix, as we now dump consistent, but still
4010 truncated data which is not what the caller wants. In future steps we'll
4011 need to update all callers that might pass large data to this function
4012 to check the return value and handle an error, or make sure to not call
4013 this function with more than UINT_MAX bytes of data.
4014
4015 Ref: c3bcdd88a44c4636818407aeb894fabc90bb0ecd (2010-04-17)
4016 Ref: ed439a29bb0b4d1c3f681f87ccfcd3e5a66c3ba0 (2022-09-29)
4017
4018 Closes #1025
4019
4020 - cmake: limit WinCNG to Windows
4021
4022 After deleting the `bcrypt.h` check, no check remained. Restore
4023 a `WIN32` check here to ensure WinCNG is not enabled outside Windows.
4024
4025 Follow-up to 1289033598546ee5089ff0fc4369d24e1e2be81f
4026
4027 Tested-in #1032
4028
4029 - cmake: move `CMAKE_VS_GLOBALS` setting to CI configs
4030
4031 To not force this setting for local builds where they might serve
4032 a good purpose.
4033
4034 It makes our CI runs slightly faster and we don't need to track
4035 file changes in unattended, single, CI runs.
4036
4037 Cherry-picked from #1031
4038
4039 - cmake: prefill for faster config phase on Windows
4040
4041 Prefill known detection results on Windows with MinGW and MSVC, to
4042 avoid spending time on detecting these on every cmake configuration
4043 run.
4044
4045 With MinGW + clang and MSVC, this elminates all detections.
4046 With MinGW + gcc, it reduces them to 3.
4047
4048 Cherry-picked from #1031
4049
4050 - libssh2_setup.h: set `HAVE_INTTYPES_H` for MSVC
4051
4052 To sync up the hand-crafted config with actual detection results
4053 by CMake and autotools. Sources compiled fine without it anyway.
4054
4055 Cherry-picked from #1031
4056
4057 - cmake: re-add `select()` detection (regression)
4058
4059 `select()` detection suffered two regressions: First I accidentally
4060 deleted it for non-Windows [1]. Then the Windows-specific setting got
4061 missed from the generated `libssh2_config.h` after a rearrangement in
4062 `CMakeLists.txt` files.
4063
4064 [1] 31fb8860dbaae3e0b7d38f2a647ee527b4b2a95f (2023-03-07)
4065 [2] 803f19f004eb6a5b525c48fff6f46a493d25775c (2023-04-18)
4066
4067 This patch restores detection. For Windows, enable it unconditionally,
4068 not only for speed reasons, but because detection needs `ws2_32`, and
4069 even that is broken on the x86 platform. According to the original
4070 `cmake/SocketLibraries.cmake`, caused by a calling convention mismatch.
4071 FWIW autotools detects it correctly.
4072
4073 Cherry-picked from #1031
4074
4075 - ci: merge make job into msys2 section, enable zlib + openssl
4076
4077 Follow up to dd625766271a0ba13f5ac661bdc2fa40bbfa580a
4078
4079 Cherry-picked from #1030
4080
4081 - ci: add missing timeouts for autotools tests
4082
4083 Cherry-picked from #1030
4084
4085 - ci: add mingw-w64 clang and gcc CMake jobs
4086
4087 Cherry-picked from #1030
4088
4089 - cmake: assume `bcrypt.h` with WinCNG
4090
4091 autotools already didn't check for `bcrypt.h`, and such check is only
4092 required for old/legacy mingw without obsolete/incomplete Windows
4093 headers.
4094
4095 curl deprecated old-mingw support just recently and will delete support
4096 in September 2023.
4097
4098 This patch saves some complexity and detection time by dropping this
4099 check for CMake. Meaning that mingw-w64 is now required to compile
4100 libssh2 when using the WinCNG backend for 32-bit builds. Other backends
4101 and CPU platforms are not affected.
4102
4103 Ref: https://github.com/curl/curl/commit/e4d5685cb5d6eb07e1b43156fd7e3ba3563afba5
4104
4105 Closes #1026
4106
4107 - cmake: do not check for `poll()` on Windows
4108
4109 While it seems to exist on mingw in theory, it's not detected as of this
4110 writing. It also has issues, and not ready for production use:
4111 https://stackoverflow.com/questions/1671827/poll-c-function-on-windows
4112
4113 On MSVC it's even less supported.
4114
4115 Skip checking this to save CMake detection time.
4116
4117 Closes #1027
4118
4119 - agent_win: make a struct static and other build improvements
4120
4121 Also:
4122 - merge back `agent.h` into `agent.c` where it was earlier.
4123 Ref: c998f79384116e9f6633cb69c2731c60d3a442bb
4124 - introduce `HAVE_WIN32_AGENT` internal macro.
4125 - fix two guards to exclude more code unused in UWP builds.
4126
4127 Follow-up to 1c1317cb768688eee0e5496c72683190aaf63b29
4128
4129 Closes #1028
4130
4131 - tidy-up: formatting nits
4132
4133 Whitespace and redundant parenthesis in `return`s.
4134
4135 Closes #1029
4136
4137 GitHub (3 May 2023)
4138 - [Nick Woodruff brought this change]
4139
4140 sftp: parse attribute extensions, if present, to avoid stream parsing errors (#1019)
4141
4142 Prevents directory listing errors when attribute extensions are present
4143 by advancing stream parsing past extensions.
4144
4145 Viktor Szakats (3 May 2023)
4146 - tests: merge `sshd_fixture.sh` into `test_sshd.test`
4147
4148 Merge the loop executing multiple tests and the script that actually
4149 launches the tests into a single script. This same script is now called
4150 from both autotools and CMake. autotools loads the list of tests from
4151 `Makefile.inc`, CMake passes it via the command-line. It's also possible
4152 to call the script manually with a custom list of tests or individual
4153 ones.
4154
4155 With this setup we're now launching a single sshd session for all tests,
4156 instead of launching and killing it for each test. This did not improve
4157 reliability of these test on CI machines, and it's easy to go back to
4158 the previous behaviour if necessary.
4159
4160 Also:
4161
4162 - allow passing custom sshd options via `SSHD_FLAGS`.
4163
4164 - add `SSHD_TESTS_LIMIT_TO` to limit the number of tests to its value.
4165 E.g. `SSHD_TESTS_LIMIT_TO=1` executes the first test only. Meant for
4166 debugging.
4167
4168 - use `ssh` to test the connection (if available) instead of fixed
4169 amount of wait. Made to also work on Windows.
4170
4171 - set `PermitRootLogin yes` in `sshd`, to allow running tests as root.
4172
4173 - show `sshd` path and version.
4174
4175 Cherry-picked from #1017 (the last one)
4176 Closes #1024
4177
4178 - ci: make sure to run tests after all builds in GHA
4179
4180 Whenever possible. Due to flakiness/hangs/timeouts, keep sshd
4181 tests disabled on Windows and macOS.
4182
4183 Also keep Docker tests disabled on these platforms, they do not work:
4184
4185 GHA Windows:
4186 ```
4187 no matching manifest for windows/amd64 in the manifest list entries
4188 ```
4189
4190 GHA macOS:
4191 ```
4192 sh: docker: command not found
4193 ```
4194
4195 It's not possible to run UWP and ARM64 binaries:
4196 UWP:
4197 ```
4198 Test #2: test_simple ......................Exit code 0xc0000135
4199 ```
4200 Needs but doesn't find: `VCRUNTIME140_APP.dll`.
4201
4202 ARM64
4203 ```
4204 D:/a/libssh2/libssh2/bld/tests/Release/test_ssh2.exe: cannot execute binary file: Exec format error
4205 ```
4206
4207 Cherry-picked from #1017
4208
4209 - tests: disable sshd tests on Windows via new options
4210
4211 Instead of using hacks inside the build systems.
4212
4213 `SSHD` variable added to GitHub Actions is not currently used.
4214 Added there to make it easy to experiment with these tests and
4215 the path is non-trivial to discover. Using the Windows built-in
4216 sshd server is another option (haven't discovered its path yet).
4217
4218 Cherry-picked from #1017
4219
4220 - tests: add cmake/autotools options to disable running tests
4221
4222 autotools:
4223 - `--disable-docker-tests`
4224 - `--disable-sshd-tests`
4225
4226 cmake:
4227 - `RUN_DOCKER_TESTS`
4228 - `RUN_SSHD_TESTS`
4229
4230 Update automake and ci to use this new flag and delete former logic
4231 of relying on Windows detection and `HOST_WINDOWS`. Also fix honoring
4232 this when running `test_read_algos.test`.
4233
4234 This allows to disable these individually and on per-CI/local-job basis.
4235 To run as much tests as the env allows.
4236
4237 Cherry-picked from #1017
4238
4239 - ci: add `make distcheck` job
4240
4241 Cherry-picked from #1017
4242
4243 - ci: switch to out-of-tree autotools builds
4244
4245 Cherry-picked from #1017
4246
4247 - ci: restore parallel builds with cmake
4248
4249 Also add missing -j3 for macOS builds.
4250
4251 Partial revert of 0d08974633cfc02641e6593db8d569ddb3644255
4252
4253 Cherry-picked from #1017
4254
4255 - ci: sync names, steps, syntax, build dirname between jobs
4256
4257 Also:
4258
4259 - delete an unused 64-bit option for Linux (all jobs are 64-bit).
4260
4261 - fix to not install libgcrypt and openssl when doing mbedTLS builds.
4262
4263 [ Empty lines after multiline run commands are solely to unbreak
4264 my editor's syntax highlighting. They can be deleted in the future ]
4265
4266 Cherry-picked from #1017
4267
4268 - ci: add `Makefile.mk` test, with `LIBSSH2_NO_*` options
4269
4270 Cherry-picked from #1017
4271
4272 - Makefile.mk: use Makefile.inc from example and tests
4273
4274 Instead of assembling the list using `$(wildcard ...)`.
4275
4276 Also split off a `tests/Makefile.inc` from `tests/Makefile.am`. With its
4277 simpler syntax, this also allows to delete some complexity from the
4278 CMake loader.
4279
4280 Cherry-picked from #1017
4281
4282 - example, tests: fix ssh2 to correctly return failure
4283
4284 Before this patch ssh2 and test_ssh2 returned success even if the session
4285 failed at `libssh2_session_handshake()` or after.
4286
4287 This patch depends on cda41f7cb87c3af5258ba48ccef19d3efdbd3d3b, that fixed
4288 running test_ssh2 on Windows via sshd_fixture.
4289
4290 Cherry-picked from #1017
4291
4292 - tests: set -e -u in shell scripts
4293
4294 Cherry-picked from #1017
4295
4296 - cmake: use shared libs again in example and tests
4297
4298 Re-sync with autotools and v1.10.0 behavior.
4299
4300 This improves build times. It also allows to stop building our special
4301 shared test target to test shared builds.
4302
4303 Follow-up to 4e2580628dd1f8dc51ac65ac747ebcf0e93fa3d1
4304
4305 Cherry-picked from #1017
4306 Closes #1022
4307
4308 - tests: retry KEX failures when using the WinCNG backend
4309
4310 Twice. This tests are flaky and we haven't figured out why. In the
4311 meantime use this workaround to test and log these issues, but also
4312 ensure that CI run aren't flagged red because of it.
4313
4314 Also:
4315 - kex: add debug message when hostkey `sig_verify` fails,
4316 to help tracking WinCNG KEX failures.
4317 - test_ssh2: also add retry logic.
4318 I'm not quite sure this is correct. Please let me know.
4319 - session_fixture: bump up `src_path` slots to fit retries and show
4320 message when hitting the limit.
4321 - session_fixture: clear `kbd_password` static variable after use.
4322 - session_fixture: close and deinit socket after use.
4323 - session_fixture: deinit libssh2 after use.
4324
4325 Ref: #804 #846 #979 #1012 #1015
4326
4327 Cherry-picked from #1017
4328 Closes #1023
4329
4330 - example, test_ssh2: shutdown socket before close
4331
4332 Syncing them with `tests/session_fixture.c`.
4333
4334 Cherry-picked from #1017
4335
4336 - ci.yml: fix indentation [ci skip]
4337
4338 Cherry-picked from #1017
4339
4340 - Makefile.mk: make tests depend on runner lib
4341
4342 Cherry-picked from #1017
4343
4344 - build: compile agent_win.c via agent.c
4345
4346 Silences these warnings on non-Windows:
4347 ```
4348 ranlib: file: libssh2.a(agent_win.c.o) has no symbols
4349 ```
4350
4351 Cherry-picked from #1017
4352
4353 - cmake: delete obsolete comment
4354
4355 Follow-up to 80175921638fa0a345237d23206a2ad1644cdd9b
4356
4357 Cherry-picked from #1017
4358
4359 - checksrc.sh: fix it to run from any current directory
4360
4361 Also silence a shellcheck warning.
4362
4363 Cherry-picked from #1017
4364
4365 - ISSUE_TEMPLATE: ask for crypto backend version
4366
4367 Also fix casing in backend names.
4368
4369 Cherry-picked from #1017
4370
4371 - tests: fix newlines in test keys for sshd on Windows
4372
4373 Make sure these files get LF newlines on checkout. Before this patch
4374 a checked out libssh2 Git repository may have used CRLF newlines in text
4375 files, include test keys. Private keys with CRLF newlines could confuse
4376 sshd on Windows:
4377
4378 ```
4379 # sshd version: 'OpenSSH_9.2, OpenSSL 1.1.1t 7 Feb 2023'
4380 Unable to load host key "/d/a/libssh2/libssh2/tests/openssh_server/ssh_host_ed25519_key": invalid format
4381 Unable to load host key: /d/a/libssh2/libssh2/tests/openssh_server/ssh_host_ed25519_key
4382 ```
4383 Ref: https://github.com/libssh2/libssh2/actions/runs/4846188677/jobs/8635575847#step:6:39
4384
4385 Cherry-picked from #1017
4386
4387 - cmake: move option descriptions next to definition
4388
4389 Cherry-picked from #1017
4390
4391 - checksrc: sync with curl
4392
4393 There were no new issues detected.
4394
4395 Cherry-picked from #1017
4396
4397 - openssl: enable AES-GCM with wolfSSL
4398
4399 Follow-up to 3c953c05d67eb1ebcfd3316f279f12c4b1d600b4 #797
4400
4401 There is pending issue with wolfSSL, where encryption/decryption is not
4402 working (both with and without this patch). Ref: #1020
4403
4404 Cherry-picked from #1017
4405
4406 - appveyor: add a UWP OpenSSL 3 build
4407
4408 Cherry-picked from #1017
4409
4410 - appveyor: skip `before_test` when not doing tests
4411
4412 Also merge `before_test` section into `test_script`.
4413
4414 Cherry-picked from #1017
4415
4416 - docs: delete two stray characters
4417
4418 Cherry-picked from #1017
4419
4420 - tidy-up: avoid expression 'of course'
4421
4422 Cherry-picked from #1017
4423
4424 - tidy-up: avoid word 'just'
4425
4426 Cherry-picked from #1017
4427
4428 - tidy-up: avoid word 'simply'
4429
4430 Cherry-picked from #1017
4431
4432 - tests: teach to use the `USERNAME` envvar on Windows
4433
4434 Necessary to pick the correct local username when run on Windows.
4435
4436 Cherry-picked from #1017
4437
4438 - test_ssh2: support `FIXTURE_TRACE_ALL*` envvars
4439
4440 Cherry-picked from #1017
4441
4442 - tidy-up: add missing newline to error msg, formatting
4443
4444 Also:
4445 - fix indent
4446 - lowercase variables names
4447 - fix formatting in `src/global.c`
4448
4449 Cherry-picked from #1017
4450
4451 - appveyor: wait more for SSH connection from GHA
4452
4453 Cherry-picked from #1017
4454
4455 - ci: restrict permissions in GitHub Actions
4456
4457 Cherry-picked from #1017
4458
4459 - build: fix autoreconf warnings
4460
4461 - update `AC_HELP_STRING' to 'AS_HELP_STRING`:
4462 ```
4463 configure.ac:[...]: warning: The macro `AC_HELP_STRING' is obsolete.
4464 ```
4465 "AC_HELP_STRING is deprecated in 2.70+ and I believe AS_HELP_STRING works
4466 already since 2.59 so bump the minimum required version to that."
4467
4468 Ref: https://github.com/curl/curl/commit/a59f04611629f0db9ad8e768b9def73b9b4d9423
4469
4470 - simplify to avoid:
4471 ```
4472 src/Makefile.inc:48: warning: variable 'EXTRA_DIST_SOURCES' is defined but no program or
4473 src/Makefile.inc:48: library has 'DIST' as canonical name (possible typo)
4474 ```
4475 Regression from 2c18b6fc8df060c770fa7e5da704c32cf40a5757
4476
4477 - `AC_TRY_LINK`/`AC_TRY_COMPILE`:
4478 ```
4479 configure.ac:335: warning: The macro `AC_TRY_COMPILE' is obsolete.
4480 configure.ac:335: warning: The macro `AC_TRY_LINK' is obsolete.
4481 ```
4482
4483 - `libtool`-related ones:
4484 ```
4485 configure.ac:70: warning: The macro `AC_LIBTOOL_WIN32_DLL' is obsolete.
4486 configure.ac:70: warning: AC_LIBTOOL_WIN32_DLL: Remove this warning and the call to _LT_SET_OPTION when you
4487 configure.ac:70: put the 'win32-dll' option into LT_INIT's first parameter.
4488 configure.ac:71: warning: The macro `AC_PROG_LIBTOOL' is obsolete.
4489 ```
4490 Using code copied from curl:
4491 https://github.com/curl/curl/blob/9ce7eee07042605045dcfd02a6f5b38ad5c8a05d/m4/xc-lt-iface.m4#L157-L163
4492
4493 - delete commented and obsolete `AC_HEADER_STDC`.
4494
4495 - formatting.
4496
4497 Most cherry-picked from `autoupdate` updates.
4498
4499 Cherry-picked from #1017
4500 Closes #1021
4501
4502 - docker-bridge.ps1: use native newlines
4503
4504 Also add a shebang and exec flag to ease testing/handling on *nix.
4505 PowerShell accepts both LF and CRLF.
4506
4507 Cherry-picked from #1017
4508
4509 GitHub (1 May 2023)
4510 - [Zenju brought this change]
4511
4512 sftp: remove packet limit for directory reading (#791)
4513
4514 Currently libssh2 cannot read huge directory listings when the package
4515 size of `LIBSSH2_SFTP_PACKET_MAXLEN` (256KB) is hit. For example AWS
4516 always sends a single package with all files of a directory, no matter
4517 how big it is: https://freefilesync.org/forum/viewtopic.php?t=10020
4518 Package size is probably around 7MB in this case!
4519
4520 `LIBSSH2_SFTP_PACKET_MAXLEN` is a good idea in general, but there
4521 doesn't seem to be a one size fits all. While almost all(?) SFTP
4522 responses come in very small packages, I believe the `SSH_FXP_READDIR`
4523 request should be exempted.
4524
4525 The proposed patch, enhances the package size reading to include parsing
4526 the full SFTP packet header. And in case a package is of type
4527 `SSH_FXP_NAME` and matches an expected `readdir_request_id`, it does not
4528 fail if `LIBSSH2_SFTP_PACKET_MAXLEN` is hit. The chances of accidentally
4529 hiding data-corruption are pretty non-existent, because both SFTP
4530 `request_id` and packet type must match. No change in behavior
4531 otherwise.
4532
4533 Best, Zenju
4534
4535 Previous discussion: #268 #269
4536
4537 With the above changes, the `LIBSSH2_SFTP_PACKET_MAXLEN` value could
4538 (and should?) probably be set back to a small number again.
4539
4540 Integration-patches-by: Viktor Szakats
4541
4542 Viktor Szakats (28 Apr 2023)
4543 - checksrc: update and apply fixes
4544
4545 Update to latest revision and fix new issues detected.
4546
4547 Closes #1014
4548
4549 - ci: add macOS CI jobs + fix issues revealed
4550
4551 Add macOS CI jobs, both cmake and autotools for all supported crypto
4552 backends (except BoringSSL), with debug, zlib enabled. Without running
4553 tests. It also introduces OpenSSL 1.1 into the CI with a non-MSVC
4554 compiler.
4555
4556 Credits to curl's `macos.yml`, that I used as a base.
4557
4558 Fix these issues uncovered by the new tests:
4559
4560 - openssl: fix warning when built with wolfSSL, or OpenSSL 1.1 and
4561 earlier. CI missed it because apparently the only OpenSSL 1.1 test
4562 we had used MSVC, which did not complain.
4563
4564 ```
4565 ../src/openssl.c:3852:19: error: variable 'sslError' set but not used [-Werror,-Wunused-but-set-variable]
4566 unsigned long sslError;
4567 ^
4568 ```
4569
4570 Regression from 097c8f0dae558643d43051947a1c35b65e1c5761
4571
4572 - pem: add hack to build without MD5 crypto-backend support.
4573
4574 The Homebrew wolfSSL build comes with MD5 support disabled. We can
4575 expect this becoming the norm. FIPS also requires MD5 disabled.
4576
4577 We deleted the same hack from `hostkey.c` a month ago:
4578 ad6aae302aaec84afbfacf0c1dfdc446d46eaf21
4579
4580 A better fix would be to guard the MD5 logic with our `LIBSSH2_MD5`
4581 macro.
4582
4583 ```
4584 pem.c:214:32: error: use of undeclared identifier 'MD5_DIGEST_LENGTH'; did you mean 'SHA_DIGEST_LENGTH'?
4585 unsigned char secret[2*MD5_DIGEST_LENGTH];
4586 ^~~~~~~~~~~~~~~~~
4587 SHA_DIGEST_LENGTH
4588 ```
4589
4590 Regression from 386e012292a96fcf0dc6861588397845df0aba2c
4591
4592 - `configure.ac`: add crypto libs late.
4593
4594 Fix it by adding crypto libs to `LIBS` at the end of the configuration
4595 process.
4596
4597 Otherwise `configure` links crypto libs while doing feature tests,
4598 which can cause unwanted detections. For example LibreSSL publishes
4599 the function `explicit_bzero()`, which masks the system alternative,
4600 e.g. `memset_s()` on macOS. Then when trying to compile libssh2, its
4601 declaration is missing:
4602
4603 ```
4604 bcrypt_pbkdf.c:93:5: error: implicit declaration of function 'explicit_bzero' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
4605 _libssh2_explicit_zero(ciphertext, sizeof(ciphertext));
4606 ^
4607 ../src/misc.h:50:43: note: expanded from macro '_libssh2_explicit_zero'
4608 ^
4609 ```
4610
4611 Regression from 4f0f4bff5a92dce6a6cd7a5600a8ee5660402c3f
4612
4613 - cmake: fix to list our own include directory before the crypto libs',
4614 when building tests.
4615
4616 Otherwise a global crypto header path, such as `/usr/local/include`,
4617 containing an external `libssh2.h` of a different version, could cause
4618 weird errors:
4619
4620 ```
4621 cc -DHAVE_CONFIG_H -DLIBSSH2_LIBGCRYPT \
4622 -I../src -I../../src -I/usr/local/include -I[...]/libssh2/include \
4623 -g -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX13.1.sdk \
4624 -mmacosx-version-min=12.6 -MD -MT \
4625 tests/CMakeFiles/test_aa_warmup.dir/test_aa_warmup.c.o \
4626 -MF CMakeFiles/test_aa_warmup.dir/test_aa_warmup.c.o.d \
4627 -o CMakeFiles/test_aa_warmup.dir/test_aa_warmup.c.o -c \
4628 [...]/libssh2/tests/test_aa_warmup.c
4629 ```
4630
4631 ```
4632 [ 62%] Building C object tests/CMakeFiles/test_aa_warmup.dir/test_aa_warmup.c.o
4633 In file included from /Users/runner/work/libssh2/libssh2/tests/test_aa_warmup.c:4:
4634 In file included from /Users/runner/work/libssh2/libssh2/tests/runner.h:42:
4635 In file included from /Users/runner/work/libssh2/libssh2/tests/session_fixture.h:43:
4636 /Users/runner/work/libssh2/libssh2/tests/../src/libssh2_priv.h:649:5: error: type name requires a specifier or qualifier
4637 LIBSSH2_AUTHAGENT_FUNC((*authagent));
4638 ^
4639 /Users/runner/work/libssh2/libssh2/tests/../src/libssh2_priv.h:649:30: error: type specifier missing, defaults to 'int' [-Werror,-Wimplicit-int]
4640 LIBSSH2_AUTHAGENT_FUNC((*authagent));
4641 ^
4642 /Users/runner/work/libssh2/libssh2/tests/../src/libssh2_priv.h:650:5: error: type name requires a specifier or qualifier
4643 LIBSSH2_ADD_IDENTITIES_FUNC((*addLocalIdentities));
4644 ^
4645 /Users/runner/work/libssh2/libssh2/tests/../src/libssh2_priv.h:650:35: error: type specifier missing, defaults to 'int' [-Werror,-Wimplicit-int]
4646 LIBSSH2_ADD_IDENTITIES_FUNC((*addLocalIdentities));
4647 ^
4648 /Users/runner/work/libssh2/libssh2/tests/../src/libssh2_priv.h:651:5: error: type name requires a specifier or qualifier
4649 LIBSSH2_AUTHAGENT_SIGN_FUNC((*agentSignCallback));
4650 ^
4651 /Users/runner/work/libssh2/libssh2/tests/../src/libssh2_priv.h:651:35: error: type specifier missing, defaults to 'int' [-Werror,-Wimplicit-int]
4652 LIBSSH2_AUTHAGENT_SIGN_FUNC((*agentSignCallback));
4653 ^
4654 6 errors generated.
4655 ```
4656
4657 - `tests/session_fixture.h`: delete duplicate `libssh2.h`,
4658 `libssh2_priv.h` already includes it.
4659
4660 Follow-up to a683133dfe96de126194f58f183131a84c7d36a2
4661
4662 CI logs with these errors:
4663 https://github.com/libssh2/libssh2/actions/runs/4824079094
4664 https://github.com/libssh2/libssh2/actions/runs/4824270819
4665
4666 curl's `macos.yml`: https://github.com/curl/curl/blob/da2470de96e94e1c8d276b9ae6e4c97c2cf54239/.github/workflows/macos.yml
4667
4668 Tidying-up while here:
4669
4670 - tests/session_fixture.h: delete duplicate `libssh2.h`.
4671 `libssh2_priv.h` includes it already.
4672
4673 Follow-up to a683133dfe96de126194f58f183131a84c7d36a2
4674
4675 - ci.yml: yamllint warnings and formatting.
4676
4677 - ci.yml: msvc section formatting and step-naming sync with macOS.
4678
4679 Follow-up to f4a4c05dc3bcd62ecaa1b0cac5997faefe16c83f
4680
4681 - ci.yml: enable `--enable-werror` for msys2 jobs.
4682
4683 Follow-up to 71cae949d577fdd632a271da0bec89f977dc5dd2
4684
4685 - appveyor.yml: show OpenSSL versions, link to image content.
4686
4687 Closes #1013
4688
4689 - ci: convert `docker-bridge.bat` to shell script
4690
4691 Convert `ci/appveyor/docker-bridge.bat` to a POSIX shell script.
4692
4693 Also bump the tunnel to use ed25519 (was RSA-2048).
4694
4695 Closes #997
4696
4697 - kex: use distinctive error strings
4698
4699 Use unique error strings to help localize errors.
4700
4701 Closes #1011
4702
4703 - tidy-up: C header use
4704
4705 - drop unused or duplicate C headers.
4706 - add missing ones (that worked by chance).
4707 (`string.h`, `stdlib.h`)
4708 - mention the functions that need certain headers.
4709 - move some headers from crypto header to crypto C source.
4710 - reorder headers in some places.
4711 - simplify the #if tree for `sys/select.h` in `libssh2_priv.h`.
4712 - move scp-specific macros next to their header to `scp.c`
4713 Follow-up to 5db836b2a829c6fff1e8c7acaa4b21b246ae1757
4714
4715 Closes #999
4716
4717 - tidy-up: text nits, English contractions [ci skip]
4718
4719 In input/output text and docs mostly.
4720
4721 - ci: add MSVC and UWP builds to GitHub Actions
4722
4723 - add MSVC jobs to GitHub Actions. They are similar to the 'Build-only'
4724 jobs we have on AppVeyor CI, though only the ARM64 Windows one is
4725 identical. Major disadvantage is that we don't run tests here. Major
4726 advantage is they only take a few minutes to complete, compared to
4727 an hour on AppVeyor, so WinCNG build results now appear quicker.
4728
4729 Docker tests might be possible, but my light attempts failed.
4730 Finding ZLIB also failed, so we still miss an MSVC test with it.
4731
4732 Tool versions as of now: Server 2022, VS2022, OpenSSL 1.1.1
4733
4734 - add UWP builds for both ARM64 and x64. This hasn't been CI tested
4735 before.
4736
4737 (We could probably enable UWP on AppVeyor CI as well.
4738 I haven't tried.)
4739
4740 - fix two uncovered UWP issues in tests.
4741
4742 - rename internal macro `LIBSSH2_WINDOWS_APP` to `LIBSSH2_WINDOWS_UWP`.
4743
4744 Follow-up to 2addafb77b662e64248d156c71c69b91ba7b926e
4745
4746 - fold long lines and quote truthy values in `.github/workflows/ci.yml`.
4747
4748 Closes #1010
4749
4750 - session_fixture: avoid no-op `chdir(getcwd())`
4751
4752 If no `FIXTURE_WORKDIR` macro or envvar is present to set the cwd,
4753 avoid querying the cwd and then calling chdir with the result.
4754
4755 Ref: 54bef4c5dad868a9d45fdbfca9729b191c0abab5 (patch)
4756 Ref: 10a5cbf945abcc60153ee3d59284d09fc64ea152 (individual commit)
4757
4758 Closes #1009
4759
4760 - tests/sshd_fixture.sh: convert back to POSIX
4761
4762 There was no strong reason to require bash. Let's use POSIX shell
4763 like before the recent overhaul.
4764
4765 Follow-up to a459a25302a31f6e2aba3c4e15b1472b83b596fc
4766
4767 Closes #1008
4768
4769 GitHub (26 Apr 2023)
4770 - [Miguel de Icaza brought this change]
4771
4772 If SFTP fails to initialize, do not busy loop waiting for IO to happen (#720)
4773
4774 Currently SFTP's init will busy loop waiting for the channel to close,
4775 even if the underlying transport returns EAGAIN. While this works for
4776 sockets, it might not work out if you have a different transport that
4777 needs to do some additional processing on the side.
4778
4779 Integration-patches-by: Viktor Szakats
4780
4781 Viktor Szakats (26 Apr 2023)
4782 - docs: simplify `.TH` header & other cleanups [ci skip]
4783
4784 - simplify `.TH` headers.
4785 - delete empty lines before sections.
4786 - update template with an `AVAILABILITY` section.
4787
4788 Left libssh2 version number in the `.TH` header for entries without an
4789 `AVAILABILITY` section, or where there was a different version number
4790 there.
4791
4792 - tidy-up: formatting nits [ci skip]
4793
4794 - vms: fix to include `sys/socket.h`
4795
4796 Due to a typo in the `HAVE_*` macro, this header was never included.
4797
4798 A comment suggests that `socklen_t` is not defined on VMS and defines it
4799 manually. This symbol is usually in `sys/socket.h`, so the typo may have
4800 been the reason for it to be missing.
4801
4802 Closes #1007
4803
4804 - build: fix `make distcheck` regressions
4805
4806 - add #included C files to `EXTRA_DIST`.
4807
4808 Regression from 4f0f4bff5a92dce6a6cd7a5600a8ee5660402c3f
4809
4810 - fix `tests/sshd_fixture.sh` to not write into the test dir, by using
4811 a pre-assembled `TrustedUserCAKeys` file. Update `Dockerfile` too to
4812 use this.
4813
4814 Regression from a459a25302a31f6e2aba3c4e15b1472b83b596fc
4815
4816 Also update `tests/sshd_fixture.sh` to use
4817 `openssh_server/authorized_keys` like `Dockerfile` does. And a few more
4818 cosmetic updates.
4819
4820 Closes #1006
4821
4822 - libssh2_priv.h: assume `HAVE_LONGLONG`
4823
4824 Unless I'm missing something, it looks like `libssh2.h` has been using
4825 `libssh2_int64_t` unconditionally since at least 2010-04-17 when
4826 `libssh2_scp_send64()` landed via commit
4827 be9ee7095e2d5021985f57d88f5f889d3c2b9d8f.
4828
4829 This makes it redundant to detect `HAVE_LONGLONG` to fallback to a
4830 32-bit `scpRecv_size` in `libssh2_priv.h`. Then deal with possible
4831 combinations of this flag and `strtoll()` options, which was
4832 error-prone.
4833
4834 Instead, assume in `libssh2_priv.h` that we have `libssh2_int64_t`, and
4835 use it always.
4836
4837 For MSVC, this means `_MSC_VER` `1310` (from year 2003) is now
4838 required. Based on the above, this was already so before this patch.
4839
4840 If there happens to be no 64-bit `strtoll()` detected, fall back to the
4841 32-bit `strtol()` (this should never happen with MSVC, and probably
4842 neither with any other reasonably modern toolchain.)
4843
4844 Also make sure to set `HAVE_STRTOI64` for older, non-CMake, MSVC builds
4845 (e.g. `Makefile.mk` or `NMakefile` ones).
4846
4847 Closes #1002
4848
4849 GitHub (26 Apr 2023)
4850 - [Miguel de Icaza brought this change]
4851
4852 fix a couple of small regressions (#1004)
4853
4854 - openssl: fix potentially missing `ERR_*` constants by including
4855 `openssl/err.h`. This could happen with recent version of Xcode
4856 or when building against OpenSSL built with the `OPENSSL_NO_ENGINE`
4857 option.
4858
4859 Regression from 097c8f0dae558643d43051947a1c35b65e1c5761 (#789)
4860
4861 - channel: fix an issue that would corrupt the data stream when
4862 attempting to initialize the agent in non-blocking mode, as it is
4863 necessary to propagate the `EAGAIN` signal upstream when the transport
4864 returns `EAGAIN`.
4865
4866 Regression from bc4e619e76071393e466c29220fc4ef5764c2820 (#752)
4867
4868 - packet: the current code does not set the state machine upon reaching
4869 this point which means that if the code is suspended due to the
4870 transport returning an `EAGAIN`, this will re-initialize the structure
4871 every time.
4872
4873 The issue is that this keeps assigning a new channel-id downstream,
4874 which does not match the initial channel-id that is initially
4875 generated, causing a lookup later to fail as there is no matching
4876 channel.
4877
4878 Regression from bc4e619e76071393e466c29220fc4ef5764c2820 (#752)
4879
4880 Viktor Szakats (26 Apr 2023)
4881 - tidy-up: `gettimeofday()` fallback and use
4882
4883 Simplify the way we handle `gettimeofday()` fallback for platforms
4884 without native support or without any support. Make it similar to
4885 how we handle `snprintf()`.
4886
4887 In case of no native `gettimeofday()` support and a non-Windows
4888 platform, our local fallback returns zero in `tv_usec` and `tv_sec`,
4889 ending up with a zero `timeout_remaining` in `session.c`, same as
4890 before this patch.
4891
4892 Also:
4893 - drop unused `sys/time.h` headers.
4894 - fix our fallback code to compile with any Windows compilers
4895 (not just MSVC)
4896 - delete unnecessary casts.
4897
4898 Closes #1001
4899
4900 - libssh2_priv.h: fix checksrc warning [ci skip]
4901
4902 Regression from 9ef75298fae0728305d9d38ba1e3c838ad0513f7
4903
4904 - libssh2_priv.h: whitespace fixes cont. [ci skip]
4905
4906 - libssh2_priv.h: whitespace fixes [ci skip]
4907
4908 - cmake: use portable mkdir for tests/coverage target [ci skip]
4909
4910 Makes `make coverage` work without a POSIX mkdir.
4911
4912 Tested locally.
4913
4914 Ref: https://cmake.org/cmake/help/latest/manual/cmake.1.html#cmdoption-cmake-E-arg-make_directory
4915
4916 - kex: fix overlapping memcpy() to memmove()
4917
4918 Noticed this when libasan started kicking out errors when sending in
4919 MACs preferences that were not supported yet.
4920
4921 Reported-by: fourierules on github
4922 Fixes #611
4923 Closes #1000
4924
4925 - test/CMakeLists.txt: reuse `Makefile.am` librunner source list
4926
4927 Follow-up to a459a25302a31f6e2aba3c4e15b1472b83b596fc
4928
4929 Closes #998
4930
4931 GitHub (25 Apr 2023)
4932 - [Zenju brought this change]
4933
4934 openssl: fix misleading error message if wrong passphrase (#789)
4935
4936 Fixes #608
4937
4938 Viktor Szakats (25 Apr 2023)
4939 - tidy-up: tiny nits [ci skip]
4940
4941 - tests: improve running tests
4942
4943 TL;DR: Sync test builds between autotools and CMake. Sync sshd
4944 configuration between Docker and non-Docker fixtures. Bump up
4945 sshd_config for recent OpenSSH releases.
4946
4947 This also opens up the path to have non-Docker tests that use a
4948 local sshd process. Though sshd is practically unusable on Windows
4949 CI machines out of the box, so this will need further efforts.
4950
4951 Details:
4952
4953 - cmake: run sshd fixture test just like autotool did already.
4954
4955 - sync tests and their order between autotools and CMake.
4956
4957 It makes `test_aa_warmup` the first test with both.
4958
4959 - cmake: load test lists from `Makefile.am`.
4960
4961 Needed to update the loader to throw away certain lines to keep the
4962 converted output conform CMake syntax. Using regexp might be an
4963 alternative way of doing this, but couldn't make it work.
4964
4965 - cmake: use the official way to configure test environment variables.
4966 Switch to syntax that's extendable.
4967
4968 - cmake: allow to run the same test both under Docker and sshd fixture.
4969
4970 Useful for testing the sshd fixture runner, or how the same test
4971 behaves in each fixture.
4972
4973 - update test fixture to read the username from `USER` envvar instead of
4974 using the Dockfile-specific hardwired one, when running outside Docker.
4975
4976 - rework `ssh2.sh` into `sshd_fixture.sh`, to:
4977
4978 - allow running any tests (not just `test_ssh2`).
4979 - configure Docker tests for running outside Docker.
4980 - fixup `SSHD` path when running on Windows (e.g. in AppVeyor CI).
4981 Fixes: `sshd re-exec requires execution with an absolute path`
4982 - allow overriding `PUBKEY` and `PRIVKEY` envvars.
4983 - allow overriding `ssh_config` via `SSHD_FIXTURE_CONFIG`.
4984
4985 - prepare support for running multiple tests via sshd_fixture.
4986
4987 Add a TAP runner for autotools and extend CMake logic. The TAP runner
4988 loads the test list from `Makefile.am`.
4989
4990 Notice however that on Windows, `sshd_fixture.sh` is very flaky with
4991 GitHub Actions. And consistently broken for subsequent tests in
4992 AppVeyor CI:
4993 'libssh2_session_handshake failed (-43): Failed getting banner'
4994
4995 Another way to try is a single sshd instance serving all tests.
4996 For CMake this would probably mean using an external script.
4997
4998 - ed25519 test keys were identical for auth and host. Regenerate the
4999 auth keypair to make them distinct.
5000
5001 - sync the sshd environment between Docker and sshd_fixture.
5002
5003 - use common via `openssh_server/sshd_config`.
5004 - accept same auth keys.
5005 - offer the same host keys.
5006 - sync TrustedUserCAKeys.
5007 - delete now unused keypairs: `etc/host*`, `etc/user*`.
5008 - bump up startup delay for Windows (randomly, to 5 secs, from 3).
5009 - delete `UsePrivilegeSeparation no` to avoid deprecation warnings.
5010 `command-line line 0: Deprecated option UsePrivilegeSeparation`
5011 - delete `Protocol 2` to avoid deprecation warnings.
5012 It has been the default since OpenSSH 3.0 (2001-11-06).
5013 - delete `StrictModes no` (CI tests work without it, Docker tests
5014 never used it).
5015
5016 - bump `Dockerfile` base image to `testing-slim` (from `bullseye-slim`).
5017
5018 It needed `sshd_config` updates to keep things working with
5019 OpenSSH 9.2 (compared to bullseye's 8.4).
5020
5021 - replace `ChallengeResponseAuthentication` alias with
5022 `KbdInteractiveAuthentication`.
5023 The former is no longer present in default `sshd_config` since
5024 OpenSSH 8.7 (2021-08-20). This broke the `Dockerfile` script.
5025 The new name is documented since OpenSSH 4.9 (2008-03-31)
5026
5027 - add `PubkeyAcceptedKeyTypes +ssh-rsa,ssh-dss,[email protected]`
5028 and `HostKeyAlgorithms +ssh-rsa`.
5029
5030 Original-patch-by: Eric van Gyzen (@vangyzen on github)
5031 Fixes #691
5032
5033 There is a new name for `PubkeyAcceptedKeyTypes`:
5034 `PubkeyAcceptedAlgorithms`.
5035 It requires OpenSSH 8.5 (2021-03-03) and breaks some envs so we're
5036 not using it just yet.
5037
5038 - drop `[email protected]` tests and references from config.
5039
5040 This is a draft alias for `aes256-cbc`. No need to test it twice.
5041 Also this alias is no longer recognized by OpenSSH 8.5 (2021-03-03).
5042
5043 - update `mansyntax.sh` and `sshd_fixture.sh` to not rely on `srcdir`.
5044
5045 Hopefully this works with out-of-tree builds.
5046
5047 - fix `test_read_algos.test` to honor CRLF EOLs in their inputs
5048 (necessary when running on Windows.)
5049
5050 - fix `test_read_algos.test` to honor `EXEEXT`. Might be useful when
5051 running tests under cross-builds?
5052
5053 - `test_ssh2.c`:
5054
5055 - use libssh2 API to set blocking mode. This makes it support all
5056 platforms.
5057 - adapt socket open timeout logic from `openssh_fixture.c`.
5058 Sadly this did not help fix flakiness on GHA Windows.
5059
5060 - tests: delete unused C headers and variable initialization.
5061
5062 - delete unused test files: `sshd_fixture.sh.in`, `sshdwrap`,
5063 `etc/sshd_config`.
5064
5065 Ref: cf80f2f4b5255cc85a04ee43b27a29c678c1edb1
5066
5067 - autotools: delete stray `.c` test sources from `EXTRA_DIST` in tests.
5068
5069 - `tests/.gitignore`: drop two stray tests.
5070
5071 - autotools: fix passing `SSHD` containing space (Windows needs this).
5072
5073 - autotools: sort `EXTRA_DIST` in tests.
5074
5075 - cmake: fix to add `test_ssh2` to `TEST_TARGETS`.
5076
5077 - fix `authorized_key` order in `tests/gen_keys.sh`.
5078
5079 - silence shellcheck warning in `ci/checksrc.sh`.
5080
5081 - set `SSHD` for autotools on GitHub Actions Windows. [skipped]
5082
5083 Auto-detection doesn't work (maybe because sshd is installed via
5084 Git for Windows and we're using MSYS2's shell.)
5085
5086 It enables running sshd fixture (non-Docker) tests in these jobs.
5087
5088 I did not include this in the final patch due to flakiness:
5089 ```
5090 Connection to 127.0.0.1:4711 attempt #0 failed: retrying...
5091 Connection to 127.0.0.1:4711 attempt #1 failed: retrying...
5092 Connection to 127.0.0.1:4711 attempt #2 failed: retrying...
5093 Failure establishing SSH session: -43
5094 ```
5095
5096 Can be enabled with:
5097 `export SSHD='C:/Program Files/Git/usr/bin/sshd.exe'`
5098
5099 Closes #996
5100
5101 - ci: reduce algo test runtime on AppVeyor
5102
5103 Make the block count customizable in `test_read` via environment
5104 `FIXTURE_XFER_COUNT`.
5105
5106 Set the custom count lower than the default when running on AppVeyor.
5107
5108 The goal is to reduce CI roundtrip times.
5109
5110 Closes #995
5111
5112 GitHub (22 Apr 2023)
5113 - [Michael Buckley brought this change]
5114
5115 Agent forwarding implementation (#752)
5116
5117 This PR contains a series of patches that date back many years and I
5118 believe were discussed on the mailing list, but never merged. We have
5119 been using these in our local copy of libssh2 without issue since 2015,
5120 if not earlier. I believe this is the full set of changes, as we tried
5121 to use comments to mark where our copy of libssh2 differs from the
5122 canonical version.
5123
5124 This also contains changes I made earlier this year, but which were not
5125 discussed on the mailing list, to support certificates and FIDO2 keys
5126 with agent forwarding.
5127
5128 Note that this is not a complete implementation of agent forwarding, as
5129 that is outside the scope of libssh2. Clients still need to provide
5130 their own implementation that parses ssh-agent methods after calling
5131 libssh2_channel_read() and calls the appropriate callback messages in
5132 libssh2. See the man page changes in this PR for more details.
5133
5134 Integration-patches-by: Viktor Szakats
5135
5136 * prefer size_t
5137 * prefer unsigned int over u_int in public function
5138 * add const
5139 * docs, indent, checksrc, debug call, compiler warning fixes
5140
5141 Viktor Szakats (21 Apr 2023)
5142 - ci: add Windows Server 2016 into the test mix
5143
5144 We had Windows Server 2012 R2 (8.1) and Windows Server 2019 (10) before
5145 this patch. After, we also have Windows Server 2016 (10).
5146
5147 The WinCNG flakey tests should have a better chance when running on the
5148 newer OS.
5149
5150 This update does not change the compiler mix.
5151
5152 Also change the test fixture to not use the `--quiet` option with the
5153 `docker pull` commant. This option requires docker v19.03, and
5154 AppVeyor's Visual Studio 2017 image doesn't support it. Log output did
5155 not change without `--quiet`, so it seems safe to delete it. In case
5156 we'd need it, another solution is to retry without `--quiet` if the
5157 command fails. docker's exit status is 125 in that case.
5158
5159 Ref: https://github.com/libssh2/libssh2/issues/804#issuecomment-1515232799
5160 Ref: https://www.appveyor.com/docs/windows-images-software/
5161
5162 Closes #994
5163
5164 - build: add autotools test_read support and more
5165
5166 Keep a single list for mac and crypt algos that we use in both CMake
5167 and autotools. Use the same test names across build tools.
5168
5169 Use the TAP protocol to track individual tests run from a single shell
5170 script.
5171
5172 Also:
5173
5174 - enable the rest of our tests with autotools.
5175
5176 - set `make check` verbose to see errors in case they happen.
5177
5178 - silence stray 'command not found' error when running `mansyntax.sh`
5179 on Windows.
5180
5181 GitHub Actions Windows docker tests disabled due to:
5182 ```
5183 Command: docker build --quiet -t libssh2/openssh_server ../tests/openssh_server
5184 Error running command 'docker build --quiet -t libssh2/openssh_server ../tests/openssh_server' (exit 1): Sending build context to Docker daemon 22.02kB
5185 Step 1/42 : FROM debian:bullseye-slim
5186 bullseye-slim: Pulling from library/debian
5187 no matching manifest for windows/amd64 10.0.20348 in the manifest list entries
5188 Failed to build docker image
5189 ```
5190
5191 Closes #993
5192
5193 - cmake: restore a dash char in comment [ci skip]
5194
5195 It's a CMake comment header convention.
5196
5197 GitHub (21 Apr 2023)
5198 - [Dan Fandrich brought this change]
5199
5200 tests: add AES-GCM protocol read tests (#992)
5201
5202 Closes #992
5203
5204 - [Viktor Szakats brought this change]
5205
5206 support encrypt-then-mac (etm) MACs (#987)
5207
5208 Support for calculating MAC (message authentication code) on encrypted
5209 data instead of plain text data.
5210
5211 This adds support for the following MACs:
5212 - `[email protected]`
5213 - `[email protected]`
5214 - `[email protected]`
5215
5216 Integration-patches-by: Viktor Szakats
5217
5218 * rebase on master
5219 * fix checksec warnings
5220 * fix compiler warning
5221 * fix indent/whitespace/eol
5222 * rebase/manual merge onto AES-GCM patch #797
5223 * more manual merge of `libssh2_transport_send()` based
5224 on dfandrich/shellfish
5225
5226 Fixes #582
5227 Closes #655
5228 Closes #987
5229
5230 Viktor Szakats (20 Apr 2023)
5231 - docs: fix typo in argument name [ci skip]
5232
5233 - [Keith Dart brought this change]
5234
5235 channel: add support for "signal" message
5236
5237 Can send specific signals to remote process. Allows for slightly
5238 improved remote process management, if the server supports it.
5239
5240 Integration-patches-by: Viktor Szakats
5241
5242 * doc updates
5243 * change `signame_len` to `size_t`
5244 * variable scopes
5245 * fix checksrc warnings
5246
5247 Closes #672
5248 Closes #991
5249
5250 - crypto: add `LIBSSH2_NO_AES_CBC` option
5251
5252 Also rename internal `LIBSSH2_AES` to `LIBSSH2_AES_CBC`.
5253
5254 Follow-up to 857e431648df6edcb3e17138d877f2e65d2d769d
5255
5256 Closes #990
5257
5258 - tidy-up: indentation fixes [ci skip]
5259
5260 GitHub (20 Apr 2023)
5261 - [Dan Fandrich brought this change]
5262
5263 Add support for AES-GCM crypto protocols (#797)
5264
5265 Add support for [email protected] and [email protected]
5266 ciphers, which are the OpenSSH implementations of AES-GCM cryptography.
5267 It is similar to RFC5647 but has changes to the MAC protocol
5268 negotiation. These are implemented for recent versions of OpenSSL only.
5269
5270 The ciphers work differently than most previous ones in two big areas:
5271 the cipher includes its own integrated MAC, and the packet length field
5272 in the SSH frame is left unencrypted. The code changes necessary are
5273 gated by flags in the LIBSSH2_CRYPT_METHOD configuration structure.
5274
5275 These differences mean that both the first and last parts of a block
5276 require special handling during encryption. The first part is where the
5277 packet length field is, which must be kept out of the encryption path
5278 but in the authenticated part (as AAD). The last part is where the
5279 Authentication Tag is found, which is calculated and appended during
5280 encryption or removed and validated on decryption. As encryption/
5281 decryption is performed on each packet in a loop, one block at a time,
5282 flags indicating when the first and last blocks are being processed are
5283 passed down to the encryption layers.
5284
5285 The strict block-by-block encryption that occurs with other protocols is
5286 inappropriate for AES-GCM, since the packet length shifts the first
5287 encrypted byte 4 bytes into the block. Additionally, the final part of
5288 the block must contain the AES-GCM's Authentication Tag, so it must be
5289 presented to the lower encryption layer whole. These requirements mean
5290 added code to consolidate blocks as they are passed down.
5291
5292 When AES-GCM is negotiated as the cipher, its built-in MAC is
5293 automatically used as the SSH MAC so further MAC negotiation is not
5294 necessary. The SSH negotiation is skipped when _libssh2_mac_override()
5295 indicates that such a cipher is in use. The virtual MAC configuration
5296 block mac_method_hmac_aesgcm is then used as the MAC placeholder.
5297
5298 This work was sponsored by Anders Borum.
5299
5300 Integration-patches-by: Viktor Szakats
5301
5302 * fix checksrc errors
5303 * fix openssl.c warning
5304 * fix transport.c warnings
5305 * switch to `LIBSSH2_MIN/MAX()` from `MIN()`/`MAX()`
5306 * fix indent
5307 * fix libgcrypt unused warning
5308 * fix mbedtls unused warning
5309 * fix wincng unused warning
5310 * fix old openssl unused variable warnings
5311 * delete blank lines
5312 * updates to help merging with the ETM patch
5313
5314 Viktor Szakats (20 Apr 2023)
5315 - tidy-up: align comments [ci skip]
5316
5317 - tidy-up: whitespace nits [ci skip]
5318
5319 - crypto: add/fix algo guards and extend `NO` options
5320
5321 Add new guard `LIBSSH2_RSA_SHA1`. Add missing guards for `LIBSSH2_RSA`,
5322 `LIBSSH2_DSA`.
5323
5324 Fix warnings when all options are disabled.
5325
5326 This is still not complete and it's possible to break a build with
5327 certain crypto backends (e.g. mbedTLS) and/or combination of options.
5328 It's not guaranteed that all bits everywhere get disabled by these
5329 settings. Consider this a "best effort".
5330
5331 Add these new options to disable certain crypto elements:
5332 - `LIBSSH2_NO_3DES`
5333 - `LIBSSH2_NO_AES_CTR`
5334 - `LIBSSH2_NO_BLOWFISH`
5335 - `LIBSSH2_NO_CAST`
5336 - `LIBSSH2_NO_ECDSA`
5337 - `LIBSSH2_NO_RC4`
5338 - `LIBSSH2_NO_RSA_SHA1`
5339 - `LIBSSH2_NO_RSA`
5340
5341 The goal is to offer a way to disable legacy/obsolete/insecure ones.
5342
5343 See also: 146a25a06dd2365a4330dad34fefcdcee1a206aa `LIBSSH2_NO_HMAC_RIPEMD`
5344 See also: 38015f4e46d8dbeea522dc7ee664522d4f47fc75 `LIBSSH2_NO_DSA`
5345 See also: be31457f3071686b555a0f0b19e5dcf63d67fc27 `LIBSSH2_NO_MD5`
5346
5347 Closes #986
5348
5349 - scp: fix typo in comments [ci skip]
5350
5351 Follow-up to 0a500b3554c29451708353279eefce750f4bca6c
5352
5353 - base64: do not use `snprintf()` on encoding
5354
5355 This also significantly (by 7-8x in my limited tests with a short
5356 string) speeds up this function. The impact is still minor as this
5357 function is only used in `knownhost.c` in release builds.
5358
5359 Closes #985
5360
5361 - wincng: constify data arg of `libssh2_wincng_hash()`
5362
5363 Tested in #979
5364
5365 - wincng: fix unused variables with `LIBSSH2_RSA_SHA2` disabled
5366
5367 Tested in #979
5368
5369 - ci: delete config elements for unused 32-bit Linux builds
5370
5371 They have been disabled since d9b4222ef1c5ab9b9e499fe6234556e5cca7c4fe
5372
5373 Tested in #979
5374
5375 - ci: enable FIXTURE_TRACE_ALL_CONNECT for WinCNG tests
5376
5377 To hopefully help finding the WinCNG hostkey verification
5378 intermittent failure #804.
5379
5380 Tested in #979
5381
5382 - tests: add `FIXTURE_TRACE_ALL_CONNECT` option
5383
5384 Works like the `FIXTURE_TRACE_ALL` envvar, but enables full trace for
5385 the connection phase only.
5386
5387 Also fix a possible NULL deref with `FIXTURE_TRACE_ALL` and a failed
5388 `libssh2_session_init_ex()`.
5389
5390 Tested in #979
5391
5392 - ci: really enable logging in AppVeyor CMake builds
5393
5394 `CONFIGURATION` was never passed to the cmake command, so it had
5395 never enabled logging when set to `Debug`.
5396
5397 Also `CONFIGURATION` is ambiguous depending on the "generator" used
5398 by CMake. In case of Visual Studio, this is a build/ctest-time
5399 setting, not a cmake-config parameter.
5400
5401 So set this permanently to `Release` and enable logging via our
5402 dedicated CMake option `ENABLE_DEBUG_LOGGING`.
5403
5404 Tested in #979
5405
5406 - HACKING-CRYPTO: fix stray whitespace
5407
5408 - tidy-up: fix more nits
5409
5410 - fix indentation errors.
5411 - reformat `cmake/FindmbedTLS.cmake`
5412 - replace a macro with a variable in `example/sftp_RW_nonblock.c`.
5413 - delete macOS macro `_DARWIN_USE_64_BIT_INODE` from the
5414 OS/400 config header, `os400/libssh2_config.h`.
5415 - fix other minor nits.
5416
5417 Closes #983
5418
5419 - mansyntax: make it work on macOS, check reqs locally
5420
5421 - use `gman` alias if present. This makes it work when the correct `man`
5422 command is provided via `brew` on macOS.
5423
5424 - move CMake attempts to detect tools necessary to run `mansyntax.sh`
5425 into the script itself.
5426
5427 - delete CMake TODO to move more test logic into CMake. This would make
5428 it CMake-specific and require maintaining it separately for each build
5429 tool. Just use our external script when a POSIX shell is available.
5430
5431 Closes #982
5432
5433 - cmake: dedupe setting `-DHAVE_CONFIG_H`
5434
5435 Move `libssh2_config.h` generation and setting `-DHAVE_CONFIG_H` to
5436 the root `CMakeFile.txt`.
5437
5438 Also move symbol hiding setup there. It needs to be done before
5439 generating the config file for `LIBSSH2_API` value to be set in it.
5440
5441 After this change the `HIDE_SYMBOLS` setting is accepted without an
5442 annoying CMake warning when not actually building a shared libssh2 lib.
5443
5444 Closes #981
5445
5446 - build: assume non-blocking I/O on Windows
5447
5448 Drop checks from Windows builds and enable it based on `WIN32`.
5449
5450 This saves detection time and also makes 3rd party builds simpler.
5451
5452 Also:
5453
5454 - delete `HAVE_DISABLED_NONBLOCKING`, that we used in build tools to
5455 explicitly disable an explicit `#error` in `session.c`.
5456
5457 - replace existing `WSAEWOULDBLOCK` check for Windows support with
5458 `WIN32`. Cleaner with the same result.
5459
5460 Follow-up to f1e80d8d8ce9570d81836da96ba02f4d4552a7b3
5461 Follow-up to 5644eea2161b17f7c16e18f3a10465ebb217ca1f
5462
5463 Closes #980
5464
5465 - ci: rename Logging to Debug in AppVeyor
5466
5467 - switch to internal base64 decode that uses size_t
5468
5469 Make the public `libssh2_base64_decode()` a wrapper for that.
5470 Bump up length sizes in callers.
5471
5472 Also fix output size calculation to first divide then multiply.
5473
5474 Closes #978
5475
5476 - tests: switch to debian:bullseye-slim in Dockerfile
5477
5478 'slim' provides all we need, with less bloat.
5479
5480 Tested in #976
5481
5482 Follow-up to 78cb64a85955f2cd9700c4fbad3f02d589dd7169
5483
5484 - tests: build improvements and more
5485
5486 - rename tests to have more succint names and a more useful natural
5487 order.
5488
5489 - rename `simple` and `ssh2` in tests to have the `test_` prefix.
5490
5491 This avoids a name collisions with `ssh2` in examples.
5492
5493 - cmake: drop the `example-` prefix for generated examples.
5494
5495 Bringing their names in sync with other build tools, like autotools.
5496
5497 - move common auth test code into the fixture and simplify tests by
5498 using that.
5499
5500 - move feature guards from CMake to preprocessor for auth tests.
5501
5502 Now it works with all build tools and it's easier to keep it in sync
5503 with the lib itself.
5504
5505 For this we need to include `libssh2_priv.h` in tests, which in turn
5506 needs tweaking on the trick we use to suppress extra MSVS warnings
5507 when building tests and examples.
5508
5509 - move mbedTLS blocklist for crypto tests from CMake to the test
5510 fixture.
5511
5512 - add ed25519 hostkey tests to `test_hostkey` and `test_hostkey_hash`.
5513
5514 - add shell script to regenerate all test keys used for our tests.
5515
5516 - alpha-sort tests.
5517
5518 - rename `signed_*` keys to begin with `key` like the rest of the keys
5519 do.
5520
5521 - whitespace fixes.
5522
5523 Closes #969
5524
5525 - autotools: rename a variable
5526
5527 To match its counterpart we use for clang and to better match
5528 the original code in curl.
5529
5530 Follow-up to ec0feae7920d695ce234a5aba13014bf29824c09
5531
5532 Closes #977
5533
5534 - ssh2.sh: revert likely wrong quoting [ci skip]
5535
5536 Follow-up to 50124428509ffc2f5d08d8d3c152fa36546c9a75
5537
5538 - build: add `-Wbad-function-cast` picky warning
5539
5540 Also adjust minimum gcc versions in comment.
5541
5542 Closes #975
5543
5544 - tests: restore debian:bullseye in Dockerfile
5545
5546 Follow-up to 78cb64a85955f2cd9700c4fbad3f02d589dd7169
5547
5548 - session: simplify preprocessor logic
5549
5550 - by using #elif
5551 - by merging two blocks
5552
5553 Closes #972
5554
5555 - tests: try debian:testing for Dockerfile
5556
5557 Follow-up to 78cb64a85955f2cd9700c4fbad3f02d589dd7169
5558
5559 - src: add and use `LIBSSH2_MIN/MAX` macros
5560
5561 Also for #797
5562
5563 Closes #974
5564
5565 - tests: switch Dockerfile to debian:testing-slim
5566
5567 From debian:bullseye
5568
5569 - doesn't need manual bumps.
5570 - is ahead of stable and should be stable enough for our purpose.
5571 - slim is saving resources.
5572
5573 Closes #971
5574
5575 - cmake: optimize non-blocking tests on WIN32/non-WIN32
5576
5577 Skip testing unixy methods on Windows and vice versa.
5578
5579 I continue to assume that CMake doesn't define `WIN32` with Cygwin
5580 (as Cygwin doesn't define `_WIN32`/`WIN32` for C), though I haven't
5581 tested this.
5582
5583 Closes #970
5584
5585 GitHub (15 Apr 2023)
5586 - [Jörgen Sigvardsson brought this change]
5587
5588 scp: option to not quote paths (#803)
5589
5590 A new flag named `LIBSSH2_FLAG_QUOTE_PATHS` has been added, to make
5591 libssh2 not quote file paths sent to the remote's scp subsystem. Some
5592 custom ssh daemons cannot handle quoted paths, and this makes this flag
5593 useful.
5594
5595 Authored-by: Jörgen Sigvardsson <[email protected]>
5596
5597 Viktor Szakats (15 Apr 2023)
5598 - cmake: make Windows builds initialize faster
5599
5600 By skipping unixy header checks that always fail with
5601 the MSVC toolchain or all Windows toolchains.
5602
5603 Closes #968
5604
5605 - cmake: use a single build rule for all tests
5606
5607 - use the complete filename of test sources in the input list.
5608
5609 - build all tests with the ability to access libssh2 internals.
5610
5611 This is necessary for `test_keyboard_interactive_auth_info_request`
5612 now and might be necessary for others in the future, e.g. to avoid
5613 the depreacted public base64 decoding API.
5614
5615 - move `test_keyboard_interactive_auth_info_request` into the main
5616 test build loop.
5617
5618 - move `simple` into the main test build loop too.
5619
5620 - build `ssh2` also in static mode.
5621
5622 - cleanup the way we detect and enable gcov.
5623
5624 - fix indentation.
5625
5626 Closes #967
5627
5628 - tidy-up: more whitespace in src
5629
5630 Closes #966
5631
5632 - checksrc: fix `EQUALSNULL` warnings
5633
5634 `s/([a-z0-9._>*-]+) == NULL/!\1/g`
5635
5636 Closes #964
5637
5638 - Makefile.am: add new OS400 header [ci skip]
5639
5640 Follow-up to 6dc42e9d625deb816a051d312d09e68926959e78
5641
5642 - checksrc: fix `NOTEQUALSZERO` warnings
5643
5644 Closes #963
5645
5646 - checksrc: fix `SIZEOFNOPAREN` warnings
5647
5648 `s/sizeof ([a-z0-9._>*-]+)/sizeof(\1)/g`
5649
5650 Closes #962
5651
5652 - crypto: add `LIBSSH2_NO_HMAC_RIPEMD` option
5653
5654 See also: 38015f4e46d8dbeea522dc7ee664522d4f47fc75
5655 See also: be31457f3071686b555a0f0b19e5dcf63d67fc27
5656
5657 Ref: https://github.com/stribika/stribika.github.io/issues/46
5658
5659 Closes #965
5660
5661 - tidy-up: example, tests continued
5662
5663 - fix skip auth if `userauthlist` is NULL.
5664 Closes #836 (Reported-by: @sudipm-mukherjee on github)
5665 - fix most silenced `checksrc` warnings.
5666 - sync examples/tests code between each other.
5667 (output messages, error handling, declaration order, comments)
5668 - stop including unnecessary headers.
5669 - always deinitialize in case of error.
5670 - drop some redundant variables.
5671 - add error handling where missing.
5672 - show more error codes.
5673 - switch `perror()` to `fprintf()`.
5674 - fix some `printf()`s to be `fprintf()`.
5675 - formatting.
5676
5677 Closes #960
5678
5679 - src: fix indentation of macro definitions (follow-up)
5680
5681 Follow-up to d5438f4ba9036e8028f35258dd1ab97cc2edb37c
5682
5683 - src: fix indentation of macro definitions
5684
5685 And some comment cleanup.
5686
5687 Closes #958
5688
5689 - example/ssh2_exec: drop conditional code for deprecated API
5690
5691 GitHub (13 Apr 2023)
5692 - [monnerat brought this change]
5693
5694 Make OS/400 implementation work again (#953)
5695
5696 * os400: support QADRT development files in a non-standard directory
5697
5698 This enables the possibility to compile libssh2 even if the ascii
5699 runtime development files are not installed system-wide.
5700
5701 * userauth_kbd_packet: fix a pointer target type mismatch.
5702
5703 A temporary variable matching the parameter type is used before copying
5704 to the real target and checking for overflow (that should not occur!).
5705
5706 * os400qc3: move and fix big number procedures
5707
5708 A bug added by a previous code style cleaning is fixed.
5709 _libssh2_random() now checks and return the success status.
5710
5711 * os400qc3: fix cipher definition block lengths
5712
5713 They were wrongly set to the key size.
5714
5715 * Diffie-Hellman min/max modulus sizes are dependent of crypto-backend
5716
5717 In particular, os400qc3 limits the maximum group size to 2048-bits.
5718 Move definitions of these parameters to crypto backend header files.
5719
5720 * kex: return an error if Diffie-Hellman key pair generation fails
5721
5722 * os400: add an ascii assert.h header file
5723
5724 * os400qc3: implement RSA SHA2 256/512
5725
5726 Viktor Szakats (13 Apr 2023)
5727 - sftp: add open functions with custom attribute support
5728
5729 Before this patch, libssh2 sent hardcoded `LIBSSH2_SFTP_ATTRIBUTES`
5730 struct on handle open. This can be problematic on some special OS,
5731 where the file size should be known on new file creation. I added
5732 two new functions to resolve this issue.
5733
5734 Patch-by: @vajdaakos on github via #506
5735
5736 Changes compared to #506:
5737 - drop attr size fixup in favour of #946.
5738 - move `memcpy()` under the state where we need it.
5739 - bump filename length type to `size_t`.
5740 - fix filenames in documentation and other nits.
5741
5742 Closes #506
5743 Closes #947
5744
5745 - build: speed up and extend picky compiler options
5746
5747 Implement picky warnings with clang in autotools. Extend picky gcc
5748 warnings, sync them between build tools and compilers and greatly
5749 speed up detection in CMake.
5750
5751 - autotools: enable clang compiler warnings with `--enable-debug`.
5752
5753 - autotools: enable more gcc compiler warnings with `--enable-debug`.
5754
5755 - autotools/cmake: sync compiler warning options between gcc and clang.
5756
5757 - sync compiler warning options between autotools and cmake.
5758
5759 - cmake: reduce option-checks to speed up the detection phase.
5760 Bring them down to 3 (from 35). Leaving some checks to keep the
5761 CMake logic alive and for an easy way to add new options.
5762
5763 clang 3.0 (2011-11-29) and gcc 2.95 (1999-07-31) now required.
5764
5765 - autotools logic copied from curl, with these differences:
5766
5767 - delete `-Wimplicit-fallthrough=4` due to a false positive.
5768
5769 - reduce `-Wformat-truncation=2` to `1` due to a false positive.
5770
5771 - simplify MinGW detection for `-Wno-pedantic-ms-format`.
5772
5773 - cmake: show enabled picky compiler options (like autotools).
5774
5775 - cmake: do compile `tests/simple.c` and `tests/ssh2.c`.
5776
5777 - fix new compiler warnings.
5778
5779 - `tests/CMakeLists.txt`: fix indentation.
5780
5781 Original source of autotools logic:
5782 - https://github.com/curl/curl/blob/a8fbdb461cecbfe1ac6ecc5d8f6cf181e1507da8/acinclude.m4
5783 - https://github.com/curl/curl/blob/a8fbdb461cecbfe1ac6ecc5d8f6cf181e1507da8/m4/curl-compilers.m4
5784
5785 Notice that the autotools implementation considers Apple clang as
5786 legacy clang 3.7. CMake detection works more accurately, at the same
5787 time more error-prone and difficult to update due to the sparsely
5788 documented nature of Apple clang option evolution.
5789
5790 Closes #952
5791
5792 - include: delete leading underscore from macro name
5793
5794 It can cause compiler warnings in 3rd-party code.
5795
5796 Follow-up to 59666e03f04927e5fe3e8d8772d40729f63c570e
5797
5798 Closes #957
5799
5800 - ci: use OpenSSL 3 on AppVeyor VS2022 images
5801
5802 Closes #954
5803
5804 - build: be friendly with 3rd-party build tools
5805
5806 After recent build changes, 3rd party build that took the list of
5807 C source to compile them as-is, stopped working as expected, due to
5808 `blowfish.c` and crypto-backend C sources no longer expected to compile
5809 separately but via `bcrypt_pbkdf.c` and `crypto.c`, respectively.
5810
5811 This patch ensures that compiling these files directly result in an
5812 empty object instead of redundant code and duplicated symbols.
5813
5814 Also:
5815 - add a compile-time error if none of the supported crypto backends
5816 are enabled.
5817 - fix `libssh2_crypto_engine()` for wolfSSL and os400qc3.
5818 Rearrange code to avoid a hard-to-find copy of crypto-backend
5819 selection guards.
5820
5821 Follow-up to 4f0f4bff5a92dce6a6cd7a5600a8ee5660402c3f
5822 Follow-up to ff3c774e03585252b70a9ee0fcf254de7b14a767
5823
5824 Closes #951
5825
5826 - sftp: calculate attr size based on attr content in `sftp_open()`
5827
5828 Improve robustness by replacing constant argument of `sftp_attrsize()`
5829 in `sftp_open()` with the actual `flag` value read from the `attr` we
5830 plan to transfer. Restores state of this before
5831 37624b61e3ec4aa65a608800613d00b55ced56d7.
5832
5833 Prerequisite for #947, #506.
5834
5835 Also improve readability a bit and link to SFTP specs. Delete comment
5836 about version 6: The latest spec no longer features the mentioned
5837 "DO NOT IMPLEMENT" notice.
5838
5839 Closes #946
5840
5841 - man: fixups
5842
5843 - add missing `.fi` tags.
5844 - fix misplaced `.nf` tags.
5845 - add `.nf`/`.fi` tags `SYNOPSIS` where missing.
5846 - fix missing/wrong function name from `SH NAME`.
5847 - fix wrong function name in `TH`.
5848 - keep return values in a separate line.
5849 - indent.
5850 - fold long lines.
5851 - deleted `libssh2_channel_direct_streamlocal()`, there is no such function.
5852 - add missing types.
5853 - add missing headers.
5854
5855 Closes #949
5856
5857 - include: indentation fixes
5858
5859 - tidy-up: misc & minor cmake MSVS fix
5860
5861 - `libssh2.rc`: document language/codepage codes.
5862
5863 Ref: https://learn.microsoft.com/windows/win32/intl/code-page-identifiers
5864
5865 - convert to Markdown: `docs/BINDINGS`, `docs/HACKING`
5866
5867 Blind update for `vms/libssh2_make_help.dcl`. Please double-check.
5868
5869 - cmake: fix to recognize dash-style warning options (`-Wn`) with MSVC.
5870
5871 - `NMakefile`: sync `rd` command with `Makefile.mk`.
5872
5873 - delete a CVS header.
5874
5875 - cmake: simplify a `LIBSSH2_HAVE_ZLIB` macro.
5876
5877 - few other nits and whitespace mods.
5878
5879 Closes #943
5880
5881 GitHub (10 Apr 2023)
5882 - [Viktor Szakats brought this change]
5883
5884 Support for [email protected] UNIX socket connection (#945)
5885
5886 This patch allow to use direct-streamlocal service from OpenSSH 6.7,
5887 that allows UNIX socket connections.
5888
5889 Mods:
5890 - delete unrelated condition:
5891 Ref: https://github.com/libssh2/libssh2/pull/216#discussion_r374748111
5892 - rebase on master, whitespace updates.
5893
5894 Patch-by: @gjalves Gustavo Junior Alves
5895
5896 Closes #216
5897 Closes #632
5898 Closes #945
5899
5900 Viktor Szakats (10 Apr 2023)
5901 - build: support `libssh2.rc` with autotools
5902
5903 Caveat: When building `--enable-static` and `--enable-shared` at the
5904 same time, the compiled Windows resource is also included in the
5905 static library. This appears to be an autotools limitation, with no
5906 way to have different input lists (or different custom options) for
5907 shared and static libraries, even though it builds them separately.
5908
5909 The workaround is to build static libraries in a separate
5910 `./configure` + `make` pass.
5911
5912 Closes #944
5913
5914 - crypto: add `LIBSSH2_NO_DSA` to disable DSA support
5915
5916 See also: be31457f3071686b555a0f0b19e5dcf63d67fc27
5917
5918 Closes #942
5919
5920 - build: unify source lists
5921
5922 - introduce `src/crypto.c` as an umbrella source that does nothing else
5923 than include the selected crypto backend source. Moving this job from
5924 the built-tool to the C preprocessor.
5925
5926 - this allows dropping the various techniques to pick the correct crypto
5927 backend sources in autotools, CMake and other build method. Including
5928 the per-backend `Makefile.<crypto-backend>.inc` makefiles.
5929
5930 - copy a trick from curl and instead of maintaining duplicate source
5931 lists for CMake, convert the GNU Makefile kept for autotools
5932 automatically. Do this in `docs`, `examples` and `src`.
5933
5934 Ref: https://github.com/curl/curl/blob/dfabe8bca218d2524af052bd551aa87e13b8a10b/CMakeLists.txt#L1399-L1413
5935
5936 Also fixes missing `libssh2_setup.h` from `src/CMakeFiles.txt` after
5937 59666e03f04927e5fe3e8d8772d40729f63c570e.
5938
5939 - move `Makefile.inc` from root to `src`.
5940
5941 - reformat `src/Makefile.inc` to list each source in separate lines,
5942 re-align the continuation character and sort the lists alphabetically.
5943
5944 - update `docs/HACKING-CRYPTO` accordingly.
5945
5946 - autotools: update the way we add crypto-backends to `LIBS`.
5947
5948 - delete old CSV headers, indent, and merge two lines in
5949 `docs/Makefile.am` and `src/Makefile.am`.
5950
5951 - add `libssh2.pc` to `.gitignore`, while there.
5952
5953 Closes #941
5954
5955 GitHub (9 Apr 2023)
5956 - [Zenju brought this change]
5957
5958 sftp: always clear protocol error (#787)
5959
5960 Viktor Szakats (9 Apr 2023)
5961 - cmake: add `HIDE_SYMBOLS` option & do symbol hiding on *nix
5962
5963 - implement symbol hiding on non-Windows platforms.
5964
5965 The essence of the detection logic was copied from:
5966 https://github.com/curl/curl/blob/dfabe8bca218d2524af052bd551aa87e13b8a10b/CMake/CurlSymbolHiding.cmake
5967
5968 Then simplified and shortened. This method doesn't require a recent
5969 CMake version, nor an external, auto-generated C header.
5970
5971 Move `configure_file()` after `set(LIBSSH2_API ...)`, for the config
5972 file to pick up `LIBSSH2_API`s value.
5973
5974 Closes #602
5975
5976 - add CMake option `HIDE_SYMBOLS`.
5977
5978 This setting means to hide non-public functions from the libssh2
5979 dynamic library when set to `ON`. The default.
5980
5981 When set to `OFF`, make all non-static/internal functions visible
5982 in the dynamic library.
5983
5984 This setting requires `BUILD_SHARED_LIBS=ON`.
5985
5986 - honor this setting on Windows.
5987
5988 By setting the `LIBSSH2_EXPORTS` manual macro again, and stop
5989 recognizing the automatic CMake macro for this purpose:
5990 `libssh2_shared_EXPORT`.
5991
5992 Closes #939
5993
5994 - build: make `windows.h` even leaner
5995
5996 Disable GDI and NLS features in `windows.h`. libssh2 doesn't use these.
5997
5998 Closes #940
5999
6000 - blowfish: build improvements
6001
6002 - include `blowfish.c` into `bcrypt_pbkdf.c`, instead of
6003 compiling it as a distinct object.
6004
6005 - make low-level blowfish functions static. This prevents this symbols
6006 to pollute the public namespace of libssh2. It also allows the
6007 compiler to inline these functions.
6008
6009 - integrate `blf.h` header into `bcrypt_pbkdf.c` as well.
6010
6011 - use `_DEBUG_BLOWFISH` instead of `#if 0`.
6012
6013 - fix `_DEBUG_BLOWFISH` compiler warnings and other nits.
6014
6015 - `#undef` `inline` before redefining it in `libssh2_priv.h`.
6016 (copied from `blowfish.c`)
6017
6018 - delete unused `inline` redefinitions from `blowfish.c`.
6019
6020 - disable unused low-level blowfish functions.
6021
6022 - formatting, header order.
6023
6024 Closes #938
6025
6026 - libssh2.rc: fix debug flag, other cleanups
6027
6028 - fix to use `LIBSSH2DEBUG` macro to set the debug flag.
6029 (was `DEBUGBUILD`, a curl-specific macro)
6030
6031 - use manifest constants instead of literals
6032
6033 - change language to neutral
6034
6035 Closes #937
6036
6037 - tidy-up: example, tests
6038
6039 - drop unnecessary `WIN32`-specific branches.
6040
6041 - add `static`.
6042
6043 - sync header inclusion order.
6044
6045 - sync some common code between examples/tests.
6046
6047 - fix formatting/indentation.
6048
6049 - fix some `checksrc` errors not caught by `checksrc`.
6050
6051 Closes #936
6052
6053 - tests/mansyntax.sh: avoid `if !` for portability
6054
6055 Ref: https://www.gnu.org/software/autoconf/manual/autoconf-2.69/html_node/Limitations-of-Builtins.html#Limitations-of-Builtins
6056
6057 Fixes #704
6058 Closes #935
6059
6060 - tidy-up: indentation in guarded #includes [ci skip]
6061
6062 - Makefile.mk: drop `PROOT` variable [ci skip]
6063
6064 - build: hand-crafted config rework & header tidy-up
6065
6066 - introduce the concept of a project level setup header
6067 `src/libssh2_setup.h`, that is used by `src`, `example` and `tests`
6068 alike. Move there all common platform/compiler configuration from
6069 `src/libssh2_priv.h`, individual sources and `CMakeFiles.txt` files.
6070 Also move there our hand-crafted (= not auto-generated by CMake or
6071 autotools) configuration `win32/libssh2-config.h`.
6072
6073 - `win32` directory is empty now, delete it.
6074
6075 - `Makefile.mk`: adapt to the above. Build-directory is the target
6076 triplet, or any custom name set via `BLD_DIR`.
6077
6078 - sync header path order between build systems:
6079 build/src -> source/src -> source/include
6080
6081 - delete redundant references to `windows.h`, `winsock2.h`,
6082 `ws2tcpip.h`.
6083
6084 - delete unnecessary #includes, update order (`libssh2_setup.h` first,
6085 `winsock2.h` first), simplify where possible.
6086
6087 This makes the code warning-free without `WIN32_LEAN_AND_MEAN`.
6088 At the same time this patch applies this macro globally, to avoid
6089 header bloat.
6090
6091 - example: add missing *nix header guards.
6092
6093 - example: fix misindented `HAVE_UNISTD_H` `#ifdef`s.
6094
6095 - set `WIN32` with all build-tools.
6096
6097 - set `HAVE_SYS_PARAM_H` in the hand-crafted config for MinGW.
6098 To match auto-detection.
6099
6100 - move a source-specific macro to `misc.c` from `libssh2_priv.h`.
6101
6102 See the PR's individual commits for step-by-step updates.
6103
6104 Closes #932
6105
6106 - Makefile.mk: build tests and other improvements [ci skip]
6107
6108 - use `example` target for building examples (was: `test`).
6109
6110 - add support for building tests via the `test` target.
6111
6112 - accept lib-only options in a new `LIBSSH2_CPPFLAGS_LIB` variable.
6113
6114 Useful to pass `-DLIBSSH2_EXPORTS` for correct `dllexport` in
6115 `libssh2.dll`.
6116
6117 - fix to put dynamic library in lib directory for non-Windows builds
6118
6119 - fix to not delete lib objects on `testclean`
6120
6121 - test_warmup: re-implement as `test()`
6122
6123 Instead of overriding `main()`. To align with the other tests.
6124
6125 Overriding `main()` can cause duplicate symbols without using a lib for
6126 the `runner` code.
6127
6128 Follow-up to 40ac6b230a309d35c57aa65a8f6d7ab6654aa3d8
6129
6130 Closes #934
6131
6132 - NMakefile: drop `/DEBUG` linker option in release mode [ci skip]
6133
6134 - NMakefile: simplify [ci skip]
6135
6136 - Makefile.mk: merge two rules [ci skip]
6137
6138 - TODO: update item about compiler warnings [ci skip]
6139
6140 Follow-up to 08354e0abbe86d4cc5088d210d53531be6d8981a
6141 Follow-up to 29347905721d2e7fbb97dabfb0071bee51db3013
6142 Follow-up to 5a96f494ee0b00282afb2db2e091246fc5e1774a
6143 Follow-up to 463449fb9ee7dbe5fbe71a28494579a9a6890d6d
6144 Follow-up to 02f2700a61157ce5a264319bdb80754c92a40a24
6145
6146 GitHub (5 Apr 2023)
6147 - [ihsinme brought this change]
6148
6149 example/x11: Add null-termination (#749)
6150
6151 Viktor Szakats (5 Apr 2023)
6152 - crypto: fix `LIBSSH2_NO_MD5` compiler warnings
6153
6154 Follow-up to be31457f3071686b555a0f0b19e5dcf63d67fc27
6155
6156 Closes #933
6157
6158 - build: add new man pages
6159
6160 Follow-up to c20c81ab105cdf27f5a4e2604bd13085f46e21de
6161
6162 GitHub (5 Apr 2023)
6163 - [Daniel Silverstone brought this change]
6164
6165 Configurable session read timeout (#892)
6166
6167 This set of changes provides a mechanism to runtime-configure the
6168 previously #define'd timeout for reading packets from a session. The
6169 intention here is to also extend libcurl to be able to use this
6170 interface so that when fetching from sftp servers which are very slow
6171 to return directory listings, connections do not time-out so much.
6172
6173 * Add new field to session to hold configurable read timeout
6174
6175 * Updated `_libssh2_packet_require()`, `_libssh2_packet_requirev()`,
6176 and `sftp_packet_requirev()` to use new field in session structure
6177
6178 * Updated docs for API functions to set/get read timeout field in
6179 session structure
6180
6181 * Updated `libssh2.h` to declare the get/set read timeout functions
6182
6183 Co-authored-by: Jon Axtell <[email protected]>
6184 Credit: Daniel Silverstone
6185
6186 Viktor Szakats (4 Apr 2023)
6187 - cmake: whitespace fixes [ci skip]
6188
6189 - libssh2.h: bump LIBSSH2_COPYRIGHT year [ci skip]
6190
6191 - Makefile.mk: move portable GNU Make file to the root
6192
6193 Move the GNU Make file formerly known as `win32/GNUmakefile` to the
6194 root directory from `win32`. It now supports any platform with a
6195 GCC-like toolchain, while also keeping support for win32.
6196
6197 For non-Windows platforms it's necessary to provide a hand-crafted
6198 `libssh2_config.h` header for now.
6199
6200 Usage: `make -f Makefile.mk`
6201
6202 - src: include `limits.h` for `*_MAX` macros
6203
6204 Follow-up to 5a96f494ee0b00282afb2db2e091246fc5e1774a
6205
6206 Reported-by: OldWorldOrdr on github
6207 Fixes #928
6208 Closes #930
6209
6210 - build: MSVS warning suppression option tidy-up
6211
6212 - in `win32/libssh2_config.h` replace `_CRT_SECURE_NO_DEPRECATE` with
6213 `_CRT_SECURE_NO_WARNINGS`, to use the official macro for this, like
6214 in CMake.
6215
6216 Also, it's now safe to move it back under `_MSC_VER`.
6217
6218 Suppressing:
6219
6220 `warning C4996: 'fopen': This function or variable may be unsafe. Consider using fopen_s instead.`
6221 `warning C4996: 'getenv': This function or variable may be unsafe. Consider using _dupenv_s instead.`
6222
6223 - move `_CRT_NONSTDC_NO_DEPRECATE` to `example` and `tests`.
6224 Not needed for `src`.
6225
6226 Suppressing:
6227
6228 `warning C4996: 'strdup': The POSIX name for this item is deprecated. Instead, use the ISO C and C++ conformant name: _strdup.`
6229 `warning C4996: 'write': The POSIX name for this item is deprecated. Instead, use the ISO C and C++ conformant name: _write.`
6230
6231 - move `_WINSOCK_DEPRECATED_NO_WARNINGS` from source files to
6232 CMake files, in `example` and `tests`. Also limit this to MSVC.
6233
6234 Suppressing:
6235
6236 `warning C4996: 'inet_addr': Use inet_pton() or InetPton() instead`
6237
6238 TODO: try fixing these instead of suppressing.
6239
6240 Closes #929
6241
6242 - win32/GNUmakefile: make it movable [ci skip]
6243
6244 - add `BLD_DIR` to customize the output directory (where libs, .zip,
6245 obj subdir will go). This directory must exist.
6246
6247 It remains `./win32` for Windows builds.
6248
6249 - add `CONFIG_H_DIR` option to customize `libssh2_config.h` location.
6250
6251 It remains `./win32` for Windows builds.
6252
6253 - include `.def` in distro zip for Windows.
6254
6255 - ready to move to the root directory.
6256
6257 - win32/GNUmakefile: drop an unnecessary variable [ci skip]
6258
6259 - windows: re-add `libssh2.rc`
6260
6261 Lost while moving it from the win32 directory
6262
6263 Follow-up to 194cfc0f84192809c87f846140e5bf06b7a864af
6264
6265 - crypto: add `LIBSSH2_NO_MD5` to disable MD5 support
6266
6267 Closes #927
6268
6269 - hostkey: fix `hash_len` field constants
6270
6271 Replace incorrect `MD5_DIGEST_LENGTH` with `SHA_DIGEST_LENGTH` for these
6272 hostkey algos:
6273
6274 - `ssh-rsa` and `ssh-dss`
6275
6276 Ref: 7a5ffc8cee259bbde82ab92515cd8fea2166854b (2004-12-07 Initial)
6277
6278 - `[email protected]`
6279
6280 Ref: 4b21e49d9d2db74579b18804ed1f5eeb16578b2f (2022-07-28)
6281 Ref: #710
6282
6283 Also delete local fall-back definition of `MD5_DIGEST_LENGTH` (added
6284 in 9af7eb48dc3854ce8ee0589f7e2beb944e064847). Macro is no longer used.
6285
6286 Reported-by: Markus-Schmidt on github
6287 Fixes #919
6288 Closes #926
6289
6290 - ci: add MSVS 2008/2010 build tests and fix warnings
6291
6292 Also:
6293
6294 - fix newly surfaced (bogus) warnings in examples with MSVS 2010:
6295
6296 ```
6297 ..\..\example\direct_tcpip.c(262): warning C4127: conditional expression is constant
6298 ```
6299 Happens for every `FD_SET()` macro reference.
6300
6301 Ref: https://ci.appveyor.com/project/libssh2org/libssh2/builds/46677835/job/ni4hs97bh18c14ap
6302
6303 - silence MSVS 2010 predefined Windows macro warnings:
6304
6305 ```
6306 ..\..\src\wincng.c(867): warning C4306: 'type cast' : conversion from 'int' to 'LPCSTR' of greater size
6307 ..\..\src\wincng.c(897): warning C4306: 'type cast' : conversion from 'int' to 'LPCSTR' of greater size
6308 ..\..\src\wincng.c(1132): warning C4306: 'type cast' : conversion from 'int' to 'LPCSTR' of greater size
6309 ```
6310
6311 Ref: https://ci.appveyor.com/project/libssh2org/libssh2/builds/46678071/job/08t5ktvkcgdghp7r
6312
6313 Closes #925
6314
6315 - transport: rename local `RANDOM_PADDING` macro
6316
6317 Rename `RANDOM_PADDING` macro used internally to enable some code.
6318
6319 Committed in the initial version of `transport.c` in
6320 9d55db6501aa4e21f0858cf36cdc2ddc11b96e83 (2007-02-02). libssh2 code
6321 never defined it.
6322
6323 The name happens to collide with a Windows macro in `wincrypt.h`.
6324 `transport.c` doesn't include this header, but it includes `winsock2.h`,
6325 and it turns out it can also define this macro in some cases, e.g.
6326 when `WIN32_LEAN_AND_MEAN` is not set.
6327
6328 To be on the safe side, prefix the name with `LIBSSH2_` to avoid
6329 enabling it by accident.
6330
6331 Q: Maybe it'd be best to delete it with the guarded code?
6332
6333 Reported-by: Markus-Schmidt on github
6334 Fixes #921
6335 Closes #924
6336
6337 - windows: move `libssh2.rc` to the `src` directory
6338
6339 Closes #918
6340
6341 - autotools: delete unused conditional `HAVE_SYS_UN_H`
6342
6343 No longer necessary after moving the disabling/enabling logic from
6344 build tool to `example/x11.c`.
6345
6346 Reverts 4774d500e724bc4e548f743a0cb644ab05599474
6347 Follow-up to d245c66cc0029e480674394c23e8be1c9410f7ad
6348
6349 - win32/GNUmakefile: update help & exit without crypto backend [ci skip]
6350
6351 Follow-up to: 5bcd25c4c980e9765c00a2f20ac5348635063aad
6352 Follow-up to: 68fd02fba002c8c6af3ba51a2780de46b47b3787
6353
6354 - build: respect autotools `DLL_EXPORT` in `libssh2.h`
6355
6356 The `DLL_EXPORT` macro is automatically set by autotools when building
6357 the libssh2 DLL. Certain toolchains might require this to correctly
6358 export symbols, so make sure to respect it in `libssh2.h` to enable
6359 `declspec(dllexport)`.
6360
6361 With this patch we have a manual macro for that (`LIBSSH2_EXPORT`),
6362 this autotools one, the CMake one, and `_WINDLL` (added in
6363 c355d31ff94a1622526c4988b9d09074f7f7605d), possibly defined by Visual
6364 Studio.
6365
6366 Closes #917
6367
6368 - build: make `HAVE_LIBCRYPT32` local to `wincng.c`
6369
6370 libssh2 uses `wincrypt.h` aka the `crypt32` Windows system library
6371 for the function `CryptDecodeObjectEx()` [1]. This function has been
6372 available for Win32 (and UWP/WinRT apps) for a long while. Even old
6373 MinGW supports it, and also Watcom 1.9, of the rare/old compilers
6374 I checked.
6375
6376 CMake had it permanently enabled, while it also did an extra check
6377 for the header to add the lib to the lib list. Autotools did the
6378 detection proper. Other builds had it permanently enabled.
6379
6380 It seems safe to assume this function/header/lib is available in all
6381 environments we support.
6382
6383 In this patch we simplify by deleting these detections and feature
6384 flags from all build tools.
6385
6386 Keep the feature flag internal to `wincng.h`, and for extra safety add
6387 the new macro `LIBSSH2_WINCNG_DISABLE_WINCRYPT` do disable it via
6388 custom `CPPFLAGS`.
6389
6390 WinCNG's other requirement is `bcrypt`. That also has been universally
6391 available for a long time. Here the only known outlier is old/legacy
6392 MinGW, which is missing support.
6393
6394 [1] https://learn.microsoft.com/en-us/windows/win32/api/wincrypt/nf-wincrypt-cryptdecodeobjectex
6395
6396 Closes #916
6397
6398 - autotools: delete `src/libssh2.pc.in` reference [ci skip]
6399
6400 Follow-up to 06f281921907fa077884c7020917661ca805b9d3
6401
6402 - tidy-up: null-mac/cipher documentation
6403
6404 Move documentation for these deleted build-level options from
6405 autotools/cmake docs to the source code itself.
6406
6407 Follow-up to 50c9bf868e833258d23c5f55ed546d1fcd5687d0
6408
6409 Closes #915
6410
6411 - cmake: re-use existing `libssh2.pc` template
6412
6413 Instead of maintaining a second copy of `libssh2.pc.in` in `src` just
6414 for CMake, teach CMake to use the existing template in the root dir,
6415 that we already use with autotools.
6416
6417 Closes #914
6418
6419 - delete redundant `HAVE_STDLIB_H`
6420
6421 libssh2 used this standard C89 header unconditionally before this patch.
6422
6423 Delete the feature checks and all unnecessary header guards.
6424
6425 Closes #913
6426
6427 - NMakefile: drop redundant variable and assignments [ci skip]
6428
6429 - delete redundant `HAVE_WINSOCK2_H`
6430
6431 `libssh2.h` required `winsock2.h` for `_WIN32` since
6432 81d53de4dc5ee39bd6215958c7dce3b12731195e (2011-06-04).
6433
6434 Apply that to the whole codebase. This makes it unnecessary to detect
6435 `HAVE_WINSOCK2_H` and allows to drop all its uses.
6436
6437 Completes TODO from b66d7317ca6c882afbe52fe426f68c119c40d348
6438
6439 TODO: Straighten out the use a mixture of `HAVE_WINDOWS_H`,
6440 `WIN32`, `_WIN32` to detect Windows.
6441
6442 - cmake: detect WinCNG last
6443
6444 This gives a chance to auto-detect mbedTLS on Windows with CMake.
6445
6446 - NMakefile: rename config variables, default to WinCNG [ci skip]
6447
6448 - replace `OPENSSLINC` and `OPENSSLLIB` with `OPENSSL_PATH`.
6449 Assume `include` and `lib` subdirs for headers and libs.
6450
6451 - replace `WITH_ZLIB`, `ZLIBINC` and `ZLIBLIB` with `ZLIB_PATH`.
6452 Assume `include` and `lib` subdirs for header and lib.
6453
6454 - make WinCNG the default if `WITH_OPENSSL` is not set.
6455
6456 - win32/GNUmakefile: rename object dir and update .gitignore [ci skip]
6457
6458 From `<triplet>-{release|debug}` to `{release|debug}-<triplet>`.
6459
6460 Follow-up to 68fd02fba002c8c6af3ba51a2780de46b47b3787
6461
6462 - win32/GNUmakefile: add libgcrypt support [ci skip]
6463
6464 In the previous commit 969487113aae856e43d3d905c3f2260246d44f9b,
6465 the commit message should read `win32/GNUmakefile: ` instead of
6466 `libssh2-gnumake.sh: `. Sorry for the mixup.
6467
6468 - libssh2-gnumake.sh: make variable names platform-agnostic [ci skip]
6469
6470 Also more consistent. Refer to DLL/SO/shared as 'dyn'.
6471
6472 Also add comment on how to find customizable environment variables.
6473
6474 - win32/GNUmakefile: make it support non-Windows builds [ci skip]
6475
6476 With 20-ish extra lines, make this Makefile support all GCC-like
6477 toolchains.
6478
6479 The temporary directory becomes `<triplet>-{release|debug}` from
6480 the former `{release|debug}`.
6481
6482 Also change the lib directory name in the `dist` package from
6483 `win32` to `lib`, to match other packages and build tools.
6484
6485 - win32/GNUmakefile: default to WinCNG [ci skip]
6486
6487 Also check for wolfSSL before mbedTLS to match CMake.
6488
6489 - win32/GNUmakefile: fixups to previous commit [ci skip]
6490
6491 - `-lws2_32` is necessary when building examples.
6492
6493 - drop a temporary variable.
6494
6495 Follow-up to d245c66cc0029e480674394c23e8be1c9410f7ad
6496
6497 - delete redundant `HAVE_WS2TCPIP_H`
6498
6499 It was used once in `src/libssh2_priv.h`, but without any effect.
6500 The header included `ws2tcpip.h` twice, once guarded by
6501 `HAVE_WS2TCPIP_H` and another time by `HAVE_WINSOCK2_H`.
6502
6503 Dedupe these to not use `HAVE_WS2TCPIP_H`. Then delete detection
6504 of this feature from all build methods.
6505
6506 TODO: Replace `HAVE_WINSOCK2_H` with `_WIN32`/`WIN32`.
6507
6508 - win32/libssh2_config.h: set `HAVE_LONGLONG` & `HAVE_STDLIB_H` [ci skip]
6509
6510 - enable `HAVE_LONGLONG` for MinGW and MSVC versions supporting it.
6511
6512 Necessary for `GNUmakefile`/`NMakefile` builds to create the same
6513 binaries as CMake/autotools ones do.
6514
6515 - enable `HAVE_STDLIB_H`. It has been universally available on
6516 Windows for a long time.
6517
6518 Fixes these clang-cl warnings:
6519 ```
6520 src\wincng.c(444,5) : warning: implicit declaration of function 'free' is invalid in C99 [-Wimplicit-function-declaration]
6521 free(buf);
6522 ^
6523 src\wincng.c(491,20) : warning: implicitly declaring library function 'malloc' with type 'void *(unsigned long long)' [-Wimplicit-function-declaration]
6524 pbHashObject = malloc(dwHashObject);
6525 ^
6526 src\wincng.c(491,20) : note: include the header <stdlib.h> or explicitly provide a declaration for 'malloc'
6527 src\wincng.c(2106,14) : warning: implicitly declaring library function 'realloc' with type 'void *(void *, unsigned long long)' [-Wimplicit-function-declaration]
6528 bignum = realloc(bn->bignum, length);
6529 ^
6530 src\wincng.c(2106,14) : note: include the header <stdlib.h> or explicitly provide a declaration for 'realloc'
6531 3 warnings generated.
6532 ```
6533
6534 - example: make `x11` exclusion build-tool-agnostic
6535
6536 Whether to build the `x11` example or not was decided by each build
6537 tool. CMake didn't build it even on supported platforms. GNUMakefile
6538 used a specific blocklist for it, while autotools enabled it based on
6539 feature-detection.
6540
6541 Migrate the enabler logic to an #ifdef in source and build `x11`
6542 unconditionally with all build tools.
6543
6544 On unsupported platforms (=Windows) this program now displays a short
6545 message stating that fact.
6546
6547 Also:
6548
6549 - fix `x11.c` warnings uncovered after CMake started building it.
6550
6551 - use `libssh2_socket_t` type for portability in `x11.c` too.
6552
6553 - use detected header guards in `x11.c`.
6554
6555 - delete a duplicate reference to `-lws2_32` from `win32/GNUmakefile`
6556 while there.
6557
6558 Closes #909
6559
6560 - .gitignore updates [ci skip]
6561
6562 - tidy-up: whitespace, sorting, comment and naming fixups
6563
6564 - cmake: add missing man pages
6565
6566 - cmake: dedupe and merge config detection
6567
6568 Before this patch CMake did feature detections in three files:
6569 `src/CMakefiles.txt`, `examples/CMakefiles.txt` and
6570 `tests/CMakefiles.txt`.
6571
6572 Merge and move them to the root `CMakefiles.txt`.
6573
6574 After this patch we end up with a single `src/libssh2_config.h`. This
6575 brings CMake in sync with autotools builds, which already worked with
6576 a single config header.
6577
6578 This also prevents mistakes where feature detection went out of sync
6579 between `src` & `tests` (see ae90a35d15d97154ac0c8554bce99ebfb18ee825).
6580 `tests` do compile sources from `src` directly, so these should always
6581 be in sync.
6582
6583 It also allows to better integrate hand-crafted, platform-specific
6584 config headers into the builds, like the one currently residing in
6585 the `win32` directory (and also in `vms` and `os400`). Subject to an
6586 upcoming PR.
6587
6588 Also fix a warning revealed after this patch made CMake correctly
6589 enable `HAVE_GETTIMEOFDAY` for `example` programs.
6590
6591 Closes #906
6592
6593 - cmake: dedupe crypto-backend detection
6594
6595 Before this patch CMake did crypto-backend detection in both
6596 `src/CMakefiles.txt` and `tests/CMakefiles.txt`.
6597
6598 Merge them and move it to the root `CMakefiles.txt`.
6599
6600 While here, also add zlib for OpenSSL. Necessary when using OpenSSL
6601 builds with zlib enabled.
6602
6603 Closes #905
6604
6605 - cmake: add missing #cmakedefines to src
6606
6607 - `HAVE_MEMSET_S` missing since
6608 03092292597ac601c3f9f0c267ecb145dda75e4e (2018-08-02)
6609
6610 - `HAVE_EXPLICIT_BZERO` and `HAVE_EXPLICIT_MEMSET` missing since
6611 00005682f7b9a1aa42be50e269056ea873637047 (2023-03-28)
6612
6613 GitHub (31 Mar 2023)
6614 - [Viktor Szakats brought this change]
6615
6616 tidy-up: NMakefile (#903)
6617
6618 Viktor Szakats (30 Mar 2023)
6619 - GNUmakefile: adjust win32/.gitignore [ci skip]
6620
6621 - build: delete references to deleted NMake files [ci skip]
6622
6623 Follow-up to 057522bb0f15c10c33159e12899ecc60e40aa6ef
6624
6625 GitHub (30 Mar 2023)
6626 - [Viktor Szakats brought this change]
6627
6628 NMakefile: merge them into a single file [ci skip] (#902)
6629
6630 Also:
6631
6632 - allow to override `AR` and `ARFLAGS`.
6633
6634 - The extra `src` subdir in the target directory is no longer, to
6635 simplify things.
6636
6637 - gone the dynamically generated `objects.mk`. Now replaced with some
6638 tricky logic to do that inline.
6639
6640 - add necessary `LIBS` for WinCNG. (untested)
6641
6642 Lightly tested via clang-cl.
6643
6644 - [Viktor Szakats brought this change]
6645
6646 maketgz: tidy-up [ci skip] (#901)
6647
6648 - fix shellcheck warnings:
6649 - use quotes
6650 - use `$()`
6651 - use `printf` (instead of calling perl).
6652 - indent.
6653 - copy/adapt header comment from curl to `maketgz`.
6654
6655 - [Viktor Szakats brought this change]
6656
6657 ci: flatten AppVeyor jobs, add debug builds (#900)
6658
6659 This results in better job names (now including CPU), avoiding the
6660 complex exception rules, and fine-tuning the order and variation of
6661 these tests.
6662
6663 Enable `LIBSSH2DEBUG` for two of the existing jobs.
6664
6665 - [Viktor Szakats brought this change]
6666
6667 ci: add VS2022 builds (incl. ARM64) to AppVeyor (#899)
6668
6669 - add MSVS 2022 WinCNG builds for x64 and ARM64,
6670 replacing MSVS 2013 WinCNG builds for x64 and x86.
6671
6672 - add MSVS 2022 OpenSSL builds for x64.
6673
6674 - fix a compiler warning uncovered by the new ARM64 build:
6675
6676 ```
6677 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'
6678 tests\openssh_fixture.c(393,17): message : consider using '%lld' in the format string
6679 tests\openssh_fixture.c(393,17): message : consider using '%Id' in the format string
6680 tests\openssh_fixture.c(393,17): message : consider using '%I64d' in the format string
6681 ```
6682
6683 - echo the actual CMake command-line.
6684
6685 - cmake: echo the DLL filenames found by the OpenSSL DLL-finder
6686 heuristics.
6687
6688 - cmake: delete `libcrypto.dll` and `libssl.dll` names from the above
6689 logic.
6690
6691 I've added these in 19884e5055b6c65f0df93d7cc776a01c518a2f06. That
6692 resulted in CMake picking up a rogue `libcrypto.dll` (with no
6693 `libssl.dll` pair) from `C:\Windows\System32\` on the
6694 `Visual Studio 2022` image, breaking tests.
6695
6696 Turns out, OpenSSL v1.0.2 uses the "EAY" names, but let's not re-add
6697 those either, because CMake mis-picks those up from
6698 `C:/OpenSSL-Win64/bin/`, even while pointing `OPENSSL_ROOT_DIR` to a
6699 v1.1.1 installation.
6700
6701 - cmake: set `NO_DEFAULT_PATH` for OpenSSL DLL lookup to avoid picking
6702 up all kinds of wrong DLLs. CMake considers not the first, but the
6703 _last_ hit the valid one. This happened to be
6704 `C:/Program Files/Meson/lib*-1_1.dll` when using the
6705 `Visual Studio 2022` image.
6706
6707 Ref: https://cmake.org/cmake/help/latest/command/find_file.html
6708
6709 - cmake: leave two commented debug lines that will be useful next time
6710 the DLL detection lookup goes wrong.
6711
6712 Ref: https://cmake.org/cmake/help/latest/variable/CMAKE_FIND_DEBUG_MODE.html
6713
6714 - on error, also dump `CMakeFiles/CMakeConfigureLog.yaml` if it exists
6715 (requires CMake 3.26 and newer)
6716
6717 - [Viktor Szakats brought this change]
6718
6719 src: fix compiler warning on Darwin (#898)
6720
6721 ```
6722 src/session.c:675:52: warning: implicit conversion loses integer precision: 'long' to '__darwin_suseconds_t' (aka 'int') [-Wshorten-64-to-32]
6723 tv.tv_usec = (ms_to_next - tv.tv_sec*1000) * 1000;
6724 ~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~
6725 ```
6726
6727 Viktor Szakats (29 Mar 2023)
6728 - tidy-up: tabs to spaces in Makefile.am [ci skip]
6729
6730 Follow-up to 2f16d8105c9491beb2a02b3081f4f1c2a224fa62
6731
6732 GitHub (29 Mar 2023)
6733 - [Viktor Szakats brought this change]
6734
6735 netware: delete support (#888)
6736
6737 Last related commit happened 15 years ago.
6738 NetWare had it last release in 2009.
6739
6740 All links referenced from the make file are inaccessible.
6741
6742 - [Viktor Szakats brought this change]
6743
6744 wolfssl: add workaround for HMAC_Update() len arg difference (#897)
6745
6746 It's `int` in wolfSSL. `size_t` in OpenSSL/quictls/LibreSSL/BoringSSL.
6747
6748 Ref: https://github.com/wolfSSL/wolfssl/blob/ba47562d182e10e59813da012e0ab8ef20892231/wolfssl/openssl/hmac.h#L60-L61
6749
6750 /cc @wolfSSL
6751
6752 - [Viktor Szakats brought this change]
6753
6754 cmake: introduce variables for lib target names (#896)
6755
6756 Make our CMake config more self-documenting by introducing variables
6757 for the shared and static lib target names. Without this, it might be
6758 non-trivial to find out which line is referring to a target name vs
6759 libname, export name or other occurrences of `libssh2`.
6760
6761 This allows to rename back the shared lib target name to the value used
6762 before 4e2580628dd1f8dc51ac65ac747ebcf0e93fa3d1:
6763 `libssh2_shared` -> `libssh2`, if necessary for compatibility. Notice:
6764 before that patch, `libssh2` name referred to either the static or
6765 shared lib, depending on build settings.
6766
6767 - [Viktor Szakats brought this change]
6768
6769 detect and use explicit_bzero() and explicit_memset() (#895)
6770
6771 Also skip detecting these and `memset_s()` for Windows targets in CMake,
6772 to save detection time. On Windows we always use `SecureZeroMemory()`.
6773
6774 - [Viktor Szakats brought this change]
6775
6776 ci: bump mbedtls (#894)
6777
6778 - [Viktor Szakats brought this change]
6779
6780 GNUmakefile: minor fix for DYN mode [ci skip] (#893)
6781
6782 Follow-up to b8762c1003d97e109efa587bdc760ff9873949eb
6783
6784 - [Viktor Szakats brought this change]
6785
6786 build: delete MS Dev Studio build files (#891)
6787
6788 Last updated in 2007.
6789
6790 Also delete `VCPROJ` target remains (necessary files seem to have
6791 been missing from the repo all along) for Visual Studio 2008.
6792
6793 Viktor Szakats (28 Mar 2023)
6794 - checksrc: fix reference in Makefile.am, update options [ci skip]
6795
6796 GitHub (28 Mar 2023)
6797 - [Viktor Szakats brought this change]
6798
6799 build: delete native Watcom wmake support with Win32 (#889)
6800
6801 CMake supports generating Watcom wmake files:
6802 https://cmake.org/cmake/help/v3.1/generator/Watcom%20WMake.html
6803
6804 - [Viktor Szakats brought this change]
6805
6806 checksrc: update and fix warnings (#890)
6807
6808 Update from:
6809 https://github.com/curl/curl/blob/5fec927374e4d9553205d861f2dcb39ec78002cc/scripts/checksrc.pl
6810
6811 - suppress these new checks:
6812
6813 - EQUALSNULL: 320 warnings
6814 - NOTEQUALSZERO: 142 warnings
6815 - TYPEDEFSTRUCT: 16 warnings
6816
6817 We can enabled them in the future.
6818
6819 - fix all other new ones.
6820
6821 - also fix whitespace in two `NMakefile` files.
6822
6823 - [Viktor Szakats brought this change]
6824
6825 tidy-up: fix/update URLs (#887)
6826
6827 - [Viktor Szakats brought this change]
6828
6829 tidy-up: fix typos (#886)
6830
6831 detected by codespell 2.2.4.
6832
6833 - [Viktor Szakats brought this change]
6834
6835 tidy-up: replace tabs and other whitespace (#885)
6836
6837 There are a few non-whitespace changes, see them here:
6838 https://github.com/libssh2/libssh2/pull/885/files?w=1
6839
6840 - [Viktor Szakats brought this change]
6841
6842 ci: drop cmake --parallel (#884)
6843
6844 `--parallel 2` did not seem to make builds faster. Neither did 4 or 6.
6845
6846 Delete this option from both GHA and AppVeyor jobs.
6847
6848 On AppVeyor, with VS, it uses MSBuild under the hood where apparently
6849 `--parallel` doesn't do much [1]. The suggested MSBuild-specific option
6850 `/p:CL_MPcount=2` did not improve build times either.
6851
6852 CMake spends significant time (comparable to building the project
6853 itself) on feature detection, it'd be nice to execute those in parallel,
6854 but I found not such CMake option.
6855
6856 [1] https://discourse.cmake.org/t/parallel-does-not-really-enable-parallel-compiles-with-msbuild/964
6857
6858 Partial revert of 7a039d9a7a2945c10b4622f38eeed21ba6b4ec55
6859
6860 - [Viktor Szakats brought this change]
6861
6862 rework how to enable insecure null-cipher/null-MAC (#873)
6863
6864 Null-cipher and null-MAC are security footguns we want to avoid.
6865
6866 Existing option names to toggle these were ambiguous and gave room for
6867 misinterpretation. Some projects may have had these options enabled by
6868 accident.
6869
6870 This patch aims to make it more difficult to enable them, and making
6871 sure that existing methods require an update to stay enabled.
6872
6873 - delete CMake/autotools settings to enable the "none" cipher and MAC.
6874
6875 - rename existing C macros that can enable them.
6876
6877 To use them, pass them as custom `CPPFLAGS` to the build.
6878
6879 - enable them only if `LIBSSH2DEBUG` is also enabled.
6880
6881 Best would be to delete them, though they may have some use while
6882 developing libssh2 itself, or debugging.
6883
6884 - [Viktor Szakats brought this change]
6885
6886 delete old gex (SSH2_MSG_KEX_DH_GEX_REQUEST_OLD) build option (#872)
6887
6888 libssh2 supports an "old" style KEX message
6889 `SSH2_MSG_KEX_DH_GEX_REQUEST_OLD`, as an off-by-default build option.
6890
6891 OpenSSH deprecated/disabled this feature in v6.9 (2015-07-01):
6892 https://www.openssh.com/releasenotes.html#6.9
6893
6894 This patch deletes this obsolete feature from libssh2, with no option
6895 to enable it.
6896
6897 Added to libssh2 in: cf8ca63ea0c9388c8ae9079961d7e6a91b72b5c8 (2004-12-31)
6898 RFC: https://datatracker.ietf.org/doc/html/rfc4419 (2006-03)
6899
6900 - [Viktor Szakats brought this change]
6901
6902 src: more tolerant snprintf() local override (#881)
6903
6904 `#undef snprintf` before redefining it, when `HAVE_SNPRINTF` is not
6905 defined, even though `snprintf` is available and it should have been.
6906 Possibly with 3rd party builds.
6907
6908 Downside is that cases of missing `HAVE_SNPRINTF` are less trivially
6909 detected at compile-time.
6910
6911 - [Viktor Szakats brought this change]
6912
6913 ci: fix cmake warning with AppVeyor WinCNG builds (#883)
6914
6915 ```
6916 CMake Warning:
6917 Manually-specified variables were not used by the project:
6918
6919 OPENSSL_ROOT_DIR
6920 ```
6921
6922 Follow-up to 0834b9bcc85b90c78afff103f909b5a909b95e45
6923
6924 - [Viktor Szakats brought this change]
6925
6926 ci: cmake `ENABLE_WERROR` -> `ON` (#877)
6927
6928 Consider warnings as errors for CMake jobs in CI.
6929
6930 Viktor Szakats (26 Mar 2023)
6931 - src: silence compiler warnings 4 (alignment in WinCNG)
6932
6933 Silence alignment warnings in WinCNG, by reworking the code.
6934
6935 Also add two unrelated casts to avoid gcc compiler warnings
6936 in surrounding code.
6937
6938 `increases required alignment from 1 to 4 [-Wcast-align]`
6939 `increases required alignment from 1 to 8 [-Wcast-align]`
6940
6941 See warning details in the PR's individual commits.
6942
6943 Reviewed-by: Marc Hörsken in <https://github.com/libssh2/libssh2/pull/846#pullrequestreview-1350253621>
6944 Cherry-picked from #846
6945 Closes #880
6946
6947 - src: silence compiler warnings 3 (change types)
6948
6949 Apply type changes to avoid casts and warnings. In most cases this
6950 means changing to a larger type, usually `size_t` or `ssize_t`.
6951
6952 Change signedness in a few places.
6953
6954 Also introduce new variables to avoid reusing them for multiple
6955 purposes, to avoid casts and warnings.
6956
6957 - add FIXME for public `libssh2_sftp_readdir_ex()` return type.
6958
6959 - fix `_libssh2_mbedtls_rsa_sha2_verify()` to verify if `sig_len`
6960 is large enough.
6961
6962 - fix `_libssh2_dh_key_pair()` in `wincng.c` to return error if
6963 `group_order` input is negative.
6964
6965 Maybe we should also reject zero?
6966
6967 - bump `_libssh2_random()` size type `int` -> `size_t`. Add checks
6968 for WinCNG and OpenSSL to return error if requested more than they
6969 support (`ULONG_MAX`, `INT_MAX` respectively).
6970
6971 - change `_libssh2_ntohu32()` return value `unsigned int` -> `uint32_t`.
6972
6973 - fix `_libssh2_mbedtls_bignum_random()` to check for a negative `top`
6974 input.
6975
6976 - size down `_libssh2_wincng_key_sha_verify()` `hashlen` to match
6977 Windows'.
6978
6979 - fix `session_disconnect()` to limit length of `lang_len`
6980 (to 256 bytes).
6981
6982 - fix bad syntax in an `assert()`.
6983
6984 - add a few `const` to casts.
6985
6986 - `while(1)` -> `for(;;)`.
6987
6988 - add casts that didn't fit into #876.
6989
6990 - update `docs/HACKING-CRYPTO` with new sizes.
6991
6992 May need review for OS400QC3: /cc @monnerat @jonrumsey
6993
6994 See warning details in the PR's individual commits.
6995
6996 Cherry-picked from #846
6997 Closes #879
6998
6999 - src: silence compiler warnings 2 (ZLIB interface)
7000
7001 Silence warnings in the ZLIB interface by adding casts and changing
7002 types.
7003
7004 See PR for individual commits.
7005
7006 Cherry-picked from #846
7007 Closes #878
7008
7009 - src: silence compiler warnings 1
7010
7011 Most of the changes aim to silence warnings by adding casts.
7012
7013 An assortment of other issues, mainly compiler warnings, resolved:
7014
7015 - unreachable code fixed by using `goto` in
7016 `publickey_response_success()` in `publickey.c`.
7017
7018 - potentially uninitialized variable in `sftp_open()`.
7019
7020 - MSVS-specific bogus warnings with `nid_type` in `kex.c`.
7021
7022 - check result of `kex_session_ecdh_curve_type()`.
7023
7024 - add missing function declarations.
7025
7026 - type changes to fit values without casts:
7027 - `cmd_len` in `scp_recv()` and `scp_send()`: `int` -> `size_t`
7028 - `Blowfish_expandstate()`, `Blowfish_expand0state()` loop counters:
7029 `uint16_t` -> `int`
7030 - `RECV_SEND_ALL()`: `int` -> `ssize_t`
7031 - `shell_quotearg()` -> `unsigned` -> `size_t`
7032 - `sig_len` in `_libssh2_mbedtls_rsa_sha2_sign()`:
7033 `unsigned` -> `size_t`
7034 - `prefs_len` in `libssh2_session_method_pref()`: `int` -> `size_t`
7035 - `firstsec` in `_libssh2_debug_low()`: `int` -> `long`
7036 - `method_len` in `libssh2_session_method_pref()`: `int` -> `size_t`
7037
7038 - simplify `_libssh2_ntohu64()`.
7039
7040 - fix `LIBSSH2_INT64_T_FORMAT` for MinGW.
7041
7042 - fix gcc warning by not using a bit field for
7043 `burn_optimistic_kexinit`.
7044
7045 - fix unused variable warning in `_libssh2_cipher_crypt()` in
7046 `libgcrypt.c`.
7047
7048 - fix unused variables with `HAVE_DISABLED_NONBLOCKING`.
7049
7050 - avoid const stripping with `BIO_new_mem_buf()` and OpenSSL 1.0.2 and
7051 newer.
7052
7053 - add a missing const in `wincng.h`.
7054
7055 - FIXME added for public:
7056 - `libssh2_channel_window_read_ex()` `read_avail` argument type.
7057 - `libssh2_base64_decode()` `datalen` argument type.
7058
7059 - fix possible overflow in `sftp_read()`.
7060
7061 Ref: 4552c73cd58fccb1fc49cb0f25f86619133e560f
7062
7063 - formatting in `wincng.h`.
7064
7065 See warning details in the PR's individual commits.
7066
7067 Cherry-picked from #846
7068 Closes #876
7069
7070 GitHub (24 Mar 2023)
7071 - [Viktor Szakats brought this change]
7072
7073 cmake: automatic exports macro tidy-up (#875)
7074
7075 In a recent CMake update I left the original CMake EXPORTS macro
7076 unchanged (`libssh2_EXPORTS`) for compatibility.
7077
7078 However, that macro was also recently added [1] and not present in an
7079 official release yet, so we might as well just use the new native one
7080 instead (`libssh2_shared_EXPORTS`), defined by CMake automatically.
7081 This way we don't need to define the old macro manually.
7082
7083 CMake forms this macro from the lib's internal name as defined in
7084 `add_library()` by appending `_EXPORTS`. That target name changed from
7085 `libssh2` to `libssh2_shared` after introducing dual shared + static
7086 builds in the recent update.
7087
7088 If we're here, add a new, stable, build-tool agnostic macro with the
7089 same effect, for non-CMake use: `LIBSSH2_EXPORTS`
7090
7091 [1] 1f0fe7443a1ecddd320f2c693607b2afee9bbe2f (2021-10-26)
7092
7093 Follow-up to 4e2580628dd1f8dc51ac65ac747ebcf0e93fa3d1
7094
7095 - [Viktor Szakats brought this change]
7096
7097 maketgz: add .xz, .bz2, .zip source archive formats (#874)
7098
7099 Copied from curl:
7100 https://github.com/curl/curl/blob/4528690cd51e5445df74aef8f83470a602683797/maketgz#L174-L222
7101
7102 [ci skip]
7103
7104 Viktor Szakats (23 Mar 2023)
7105 - dist: delete reference to recently deleted file [ci skip]
7106
7107 Follow-up to b8762c1003d97e109efa587bdc760ff9873949eb
7108
7109 GitHub (23 Mar 2023)
7110 - [Viktor Szakats brought this change]
7111
7112 cmake: separate compilation passes for shared/static (#871)
7113
7114 Before this patch, cmake did a single compilation pass when we enabled
7115 both shared and static lib targets. This saves build time (esp. with
7116 MinGW targets and cross-compiling), but has the disadvantage that static
7117 libs built this way must have PIC enabled (offering slightly less
7118 performance) and `dllexport` enabled also, which means that executables
7119 linking the static libssh2 lib export its public symbols.
7120
7121 To avoid these downsides, this patch separates the two passes and
7122 creates a non-PIC, non-`dllexport` static lib, even when also building
7123 the shared lib.
7124
7125 - [Viktor Szakats brought this change]
7126
7127 ci: test with OpenSSL v1.1.1 on AppVeyor (#870)
7128
7129 Was: v1.0.2.
7130
7131 Keep using v1.0.2 with the static-only test. To make sure we don't break
7132 support.
7133
7134 - [Viktor Szakats brought this change]
7135
7136 ci: speed up static-only build tests on AppVeyor (#868)
7137
7138 - limit static-only build to a single platform (x64).
7139
7140 - skip running ctest for the static-only build.
7141
7142 - use MSVS 2013 for static-only builds. It's faster.
7143
7144 - run static-only test before WinCNG ones. Otherwise it's often skipped
7145 due to WinCNG failures (#804).
7146
7147 - [Viktor Szakats brought this change]
7148
7149 cmake: fix error with static lib off and example/tests on (#869)
7150
7151 Regression from 4e2580628dd1f8dc51ac65ac747ebcf0e93fa3d1
7152
7153 - [Viktor Szakats brought this change]
7154
7155 ci: parallelize more (#867)
7156
7157 - [Viktor Szakats brought this change]
7158
7159 cmake/src: move build options before target definitions (#864)
7160
7161 To allow more flexibility when defining targets.
7162
7163 - [Viktor Szakats brought this change]
7164
7165 ci: use static+shared builds to cut number of cmake jobs (#865)
7166
7167 With CMake builds supporting static-shared libssh2 builds in a single
7168 pass, we no longer need to run static and shared jobs separately. For
7169 the same effect it's enough to run builds with both shared and static
7170 builds enabled. Halving CI jobs.
7171
7172 We add an extra run to test the CMake config-path without shared builds
7173 enabled.
7174
7175 This allows to add useful jobs, e.g. MSVS 2022 or ZLIB-enabled builds
7176 for Windows, valgrind builds or other useful stuff, without stretching
7177 CI run times further.
7178
7179 Ref: #863
7180
7181 Viktor Szakats (22 Mar 2023)
7182 - cmake: allow building static + shared libs in a single pass
7183
7184 - `BUILD_SHARED_LIBS=ON` no longer disables building static lib.
7185
7186 When set, we build the static lib with PIC enabled.
7187
7188 For shared lib only, set `BUILD_STATIC_LIBS=OFF`. For static lib
7189 without PIC, leave this option disabled.
7190
7191 - new setting: `BUILD_STATIC_LIBS`. `ON` by default.
7192
7193 Force-enabled when building examples or tests (we build those in
7194 static mode always.)
7195
7196 - fix to exclude Windows Resource from the static lib.
7197
7198 - fix to not overwrite static lib with shared implib on Windows
7199 platforms using identical suffix for them (MSVS). By using
7200 `libssh2_imp<.ext>` implib filename.
7201
7202 - add support for `STATIC_LIB_SUFFIX` setting to set an optional suffix
7203 (e.g. `_static`) for the static lib. (experimental, not documented).
7204 Overrides the above when set.
7205
7206 - fix to set `dllexport` when building shared lib.
7207
7208 - set `TrackFileAccess=false` for MSVS.
7209
7210 For faster builds, shorter verbose logs.
7211
7212 - tests: new test linking against shared libssh2: `test_warmup_shared`
7213
7214 - tests: simplify 'runner' lib by merging 3 libs into a single one.
7215
7216 - tests: drop hack from `test_keyboard_interactive_auth_info_request`
7217 build.
7218
7219 We no longer need to compile `src/misc.c` because we always link
7220 libssh2 statically.
7221
7222 - tests: limit `FIXTURE_WORKDIR=` to the `runner` target.
7223
7224 TL;DR: Default behavior unchanged: static (no-PIC), no shared.
7225 Enabling shared unchanged, but now also builds a static (PIC)
7226 lib by default.
7227
7228 Based-on: b60dca8b6450a9729670986d2899cca54ccdbb6d #547 by berney on github
7229 Fixes: #547
7230 Fixes: #675
7231 Closes: #863
7232
7233 - include: silence warnings with casts in public `libssh2_sftp.h`
7234
7235 Avoid triggering warnings in macros coming from public libssh2 headers.
7236
7237 Cherry-picked from: #846
7238 Closes #862
7239
7240 - example, tests: address compiler warnings
7241
7242 Fix or silence all C compiler warnings discovered with (or without)
7243 `PICKY_COMPILER=ON` (in CMake). This means all warnings showing up in
7244 CI (gcc, clang, MSVS 2013/2015), in local tests on macOS (clang 14) and
7245 Windows cross-builds using gcc (12) and llvm/clang (14/15).
7246
7247 Also fix the expression `nread -= nread` in `sftp_RW_nonblock.c`.
7248
7249 Cherry-picked from: #846
7250 Closes #861
7251
7252 - openssl: require `EVP_aes_128_ctr()` support
7253
7254 libssh2 built with OpenSSL and without its `EVP_aes_128_ctr()`, aka
7255 `HAVE_EVP_AES_128_CTR`, option are working incorrectly. This option
7256 wasn't always auto-detected by autotools up until recently (#811).
7257 Non-cmake, non-autotools build methods never enabled it automatically.
7258
7259 OpenSSL supports this options since at least v1.0.2, which is already
7260 EOLed and considered obsolete. OpenSSL forks (LibreSSL, BoringSSL)
7261 supported it all along.
7262
7263 In this patch we enable this option unconditionally, now requiring
7264 OpenSSL supporting this function, or one of its forks.
7265
7266 Also modernize OpenSSL lib references to what 1.0.2 and newer versions
7267 have been using.
7268
7269 Fixes #739
7270
7271 - wincng: fix memory leak in `_libssh2_dh_secret()`
7272
7273 Patch-by: iruis on github
7274 Assisted-by: Marc Hörsken
7275 Bug #846, commit e3487092ef9553af67633c6747cb9ab2f86465e0.
7276 Fixes #856
7277 Closes #858
7278
7279 GitHub (19 Mar 2023)
7280 - [Viktor Szakats brought this change]
7281
7282 nw, os400, watcom: stop setting unused macros [ci skip] (#859)
7283
7284 Viktor Szakats (19 Mar 2023)
7285 - cmake: fix `ENABLE_WERROR=ON` breaking auto-detections
7286
7287 - cmake: fix compiler warnings in `CheckNonblockingSocketSupport`.
7288 detection functions.
7289
7290 Without this, these detections fail when `ENABLE_WERROR=ON`.
7291
7292 - cmake: disable ENABLE_WERROR for MSVC during symbol checks in `src`.
7293
7294 CMake's built-in symbol check function `check_symbol_exists()`
7295 generate warnings with MSVC. With warnings considered errors, these
7296 detections fail permanently. Our workaround is to disable
7297 warnings-as-errors while running these checks.
7298
7299 ```
7300 CheckSymbolExists.c(8): warning C4054: 'type cast': from function pointer '__int64 (__cdecl *)(const char *,char **,int)' to data pointer 'int *'
7301 in `return ((int*)(&strtoll))[argc];`
7302 ```
7303
7304 Ref: https://ci.appveyor.com/project/libssh2org/libssh2/builds/46537222/job/4vg4yg333mu2lg9b
7305
7306 - example: replace `strcasecmp()` with C89 `strcmp()`.
7307
7308 To avoid using CMake symbol checks in `example`.
7309
7310 Another option is to duplicate the `check_symbol_exists()` workaround
7311 from `src`, but I figure it's not worth the complexity. We use
7312 `strcasecmp()` solely to check optional command-line options for
7313 example programs, and those are fine as lower-case.
7314
7315 Without this, these detections fail when `ENABLE_WERROR=ON`.
7316
7317 - also delete `__function__` detection/use in `example`.
7318
7319 To avoid the complexity for the sake of using it at a single place in
7320 of the example's error branch. Replace that use with a literal name of
7321 the function.
7322
7323 - cmake: also use `CMakePushCheckState` functions instead of manual
7324 save/restore.
7325
7326 Closes #857
7327
7328 - build: improve a test build workaround with bcrypt
7329
7330 - cmake: extend workaround for linking a test with shared libssh2.
7331
7332 One of the tests uses internal libssh2 functions, and with CMake it
7333 compiles `src/misc.c` directly for this. `misc.c` references bcrypt /
7334 blowfish code. This needs a workaround for build configs where libssh2
7335 doesn't export these.
7336
7337 Before this patch, we enabled this workaround for MSVC.
7338
7339 In the patch we extend this to all Windows. There is no CI test for
7340 this, but gcc and llvm/clang + mingw64 builds also need it. This may
7341 well apply to other configurations (it should, as shared libs are not
7342 supposed to export internal functions), so also make it easy to enable
7343 it at a single point.
7344
7345 [ autotools builds force-link this one test against static libssh2. ]
7346
7347 - make `misc.c` not depend on bcrypt.
7348
7349 By moving out our `bcrypt_pbkdf()` wrapper into `bcrypt_pbkdf.c`
7350 itself.
7351
7352 This allows to compile `misc.c` into tests without pulling in bcrypt /
7353 blowfish functions, and simplify the above workaround.
7354
7355 Source code uses `HAVE_BCRYPT_PBKDF`, a leftover from original bcrypt
7356 source. We never define this inside libssh2. Defining it breaks the
7357 build, and this patch doesn't change that.
7358
7359 - make `bcrypt_pbkdf()` static.
7360
7361 While here, make the low-level `bcrypt_pbkdf()` function static to
7362 avoid namespace pollution.
7363
7364 Closes #855
7365
7366 GitHub (17 Mar 2023)
7367 - [Viktor Szakats brought this change]
7368
7369 ci: more timeout adjustments (#853)
7370
7371 - add timeout to SSH connection wait loop in AppVeyor test prep.
7372 (2 minutes)
7373
7374 - switch to per-step timeout for GitHub CI cmake/ctest runs.
7375 (10 minutes)
7376
7377 ctest timeout (of 450 seconds) didn't seem to make any difference.
7378
7379 Viktor Szakats (17 Mar 2023)
7380 - ci: set timeout to ctest and GitHub CI jobs
7381
7382 - `ctest` shows a the default timeout '10000000' (turns out to be
7383 in seconds), cause infinite waits e.g. in case the necessary server
7384 worker is not available.
7385
7386 CMake CI tests take approx:
7387 - GitHub / Linux : 125 seconds
7388 - AppVeyor / Windows: 300 seconds
7389
7390 New timeouts are: 450 and 900 seconds respectively.
7391
7392 - set timeouts for style-check, fuzz, Linux and Windows GitHub CI
7393 jobs to avoid hanging forever.
7394
7395 Also:
7396
7397 - move `choco install` to before_test to make builds start faster
7398 in `appveyor.yml`.
7399
7400 - fix some yamllint `ON`/`OFF`-confusion issue by quoting these
7401 values in `appveyor.yml`.
7402
7403 - fix indentation in `appveyor.yml`.
7404
7405 - convert to GitHub workflows to LF line-ending.
7406
7407 Ref: https://github.com/libssh2/libssh2/pull/655#issuecomment-1472853493
7408
7409 Closes #851
7410
7411 GitHub (17 Mar 2023)
7412 - [Viktor Szakats brought this change]
7413
7414 ci: update mbedTLS repo URL, delete Travis CI (#850)
7415
7416 Last Travis CI session run on 2021-11-18.
7417
7418 Ref: https://app.travis-ci.com/github/libssh2/libssh2
7419 Ref: https://travis-ci.org/github/libssh2/libssh2/builds
7420
7421 - [Viktor Szakats brought this change]
7422
7423 appveyor.yml: reorder tests to return relevant feedback earlier (#849)
7424
7425 - build x64 first
7426
7427 x64 is the more interesting target. Most type conversion issues are
7428 revealed here. Also more commonly used by now.
7429
7430 - test VS 2013 earlier
7431
7432 - test WinCNG earlier
7433
7434 - delete reference to no longer used VS 2008
7435
7436 After this patch we end up starting with all Shared builds (2015, 2013,
7437 OpenSSL, WinCNG), then continue with Static ones. Shared/Static makes
7438 a minor if any difference in builds/tests compared to different VS
7439 versions of TLS backends.
7440
7441 --
7442
7443 CI run times:
7444
7445 Preparation + build takes:
7446 8 x VS2015 4.5 mins -> total: 36
7447 8 x VS2013 2 mins -> total: 16
7448 Total: 52 mins
7449
7450 with our 30 tests, it increases to:
7451 8 x VS2015 8-10 mins -> total: 72
7452 8 x VS2013 6- 9 mins -> total: 60
7453 Total: 132 mins
7454
7455 Without tests: https://ci.appveyor.com/project/libssh2org/libssh2/builds/46475315
7456 With tests: https://ci.appveyor.com/project/libssh2org/libssh2/builds/46480549
7457
7458 Dan Fandrich (14 Mar 2023)
7459 - src: check for NULL pointer passed to _libssh2_get_string
7460
7461 Callers should be protecting against this, but it's prudent to check
7462 here anyway.
7463
7464 Fixes #802
7465 Closes #848
7466
7467 Viktor Szakats (14 Mar 2023)
7468 - appveyor.yml: choco install improvements [ci skip]
7469
7470 - avoid outputting 4000 log lines by hiding the progress bar.
7471 Reduces log size by 5x.
7472
7473 - decrease timeout (from the default 2700 seconds).
7474
7475 - omit unnecessary output.
7476
7477 Tested as part of #846
7478
7479 GitHub (14 Mar 2023)
7480 - [Jakob Egger brought this change]
7481
7482 build: update instructions for autoreconf (#847)
7483
7484 The "convenience script" talks about the "buildconf" file,
7485 which is no longer recommended.
7486
7487 - [Viktor Szakats brought this change]
7488
7489 win32: set HAVE_STRTOLL with MSVS 2013 and newer (#845)
7490
7491 As in curl:
7492 https://github.com/curl/curl/blob/7fa6e36583b52dd8f1e639b370c9a2849be81b54/lib/config-win32.h#L221
7493
7494 - [Viktor Szakats brought this change]
7495
7496 GNUmakefile: move HAVE_STRTOLL to libssh2_config.h [ci skip] (#844)
7497
7498 - [Viktor Szakats brought this change]
7499
7500 src: silence unused variable warnings (#843)
7501
7502 Viktor Szakats (13 Mar 2023)
7503 - GNUmakefile: add wolfSSL support + major rework
7504
7505 - add wolfSSL support.
7506 - reduce size and redundant logic.
7507 - fix a bunch of small issues.
7508 - rework configuration, now with: `CC`, `AR`, `RC`, `TRIPLET`, `CFLAGS`,
7509 `CPPFLAGS`, `LDFLAGS`, `RCFLAGS`, `LIBS`, `LIBSSH2_DLL_SUFFIX`,
7510 `LIBSSH2_LDFLAGS_LIB`, `LIBSSH2_LDFLAGS_BIN` (and more).
7511 - merge examples build into the main Makefile.
7512 - relative dependency paths are now the same for building libssh2 or
7513 examples.
7514 - drop detection for obsolete OpenSSL versions (can be configure via new
7515 `OPENSSL_LIBS`).
7516 - merge dev/dist distribution zip options.
7517 - build libssh2 with `-DHAVE_STRTOLL`.
7518 - tidy-up.
7519 - build examples in static mode by default (use `DYN` to build them in
7520 shared mode).
7521 - drop forced (in non-debug mode) `-O2`.
7522 - drop Win9x support.
7523 - deprecate `ARCH` in favour of custom options and `TRIPLET`.
7524 - drop Windows resources from examples for simplicity
7525 - drop `WITH_ZLIB`. Default `ZLIB_PATH` to enable zlib support.
7526 - drop `LIBSSH2_DLL_A_SUFFIX`, use standard value `.dll` (as in
7527 `libssh2.dll.a`).
7528 - always link `bcrypt` (for LibreSSL and OpenSSL) and `crypt32`
7529 (for wolfSSL).
7530 - unhide executed build commands.
7531 - fix mbedTLS `lib` path
7532 - drop specific options to force static linking. Custom options seems
7533 a better way for this.
7534 - based on similar work made for curl:
7535 https://github.com/curl/curl/commit/a8861b6ccdd7ca35b6115588a578e36d765c9e38
7536
7537 Closes #842
7538
7539 GitHub (13 Mar 2023)
7540 - [Viktor Szakats brought this change]
7541
7542 wincng: fix memory leak in libssh2_dh_key_pair() (#829)
7543
7544 Fixes #722
7545
7546 - [Viktor Szakats brought this change]
7547
7548 src: C89-compliant _libssh2_debug() macro (#831)
7549
7550 Before this patch, with debug logging disabled, libssh2 code used a
7551 variadic macro to catch `_libssh2_debug()` calls, and convert them to
7552 no-ops. In certain conditions, it used an empty inline function instead.
7553
7554 Variadic macro is a C99 feature. It means that depending on compiler,
7555 and build settings, it littered the build log with warnings about this.
7556
7557 The new solution uses the trick of passing the variable arg list as a
7558 single argument and pass that down to the debug function with a regular
7559 macro. When disabled, another regular C89-compatible macro converts it
7560 to a no-op.
7561
7562 This makes inlining, C99 variadic macros and maintaining the conditions
7563 for each unnecessary and also makes the codebase compile more
7564 consistently, e.g. with forced C standards and/or picky warnings.
7565
7566 TL;DR: It makes this feature C89-compliant.
7567
7568 - [Viktor Szakats brought this change]
7569
7570 openssl: fix possible compiler warning in macro condition (#839)
7571
7572 Building with wolfSSL or pre-OpenSSL v1.1.1 triggered it.
7573
7574 ```
7575 ../src/openssl.h:130:5: warning: 'LIBRESSL_VERSION_NUMBER' is not defined, evaluates to 0 [-Wundef]
7576 LIBRESSL_VERSION_NUMBER >= 0x3070000fL
7577 ^
7578 ```
7579
7580 Regression from 2e2812dde8c1fc9b48eca592823770ab2e601f7a
7581
7582 - [Viktor Szakats brought this change]
7583
7584 GNUmakefile: cleanups [ci skip] (#840)
7585
7586 - indent
7587 - sync `test/GNUmakefile` with main
7588 - delete `RANLIB`
7589 - use `else if`
7590 - use more `?=`
7591 - use ASCII-7 copyright symbol (in test)
7592
7593 - [Viktor Szakats brought this change]
7594
7595 win32: convert tabs to spaces [ci skip] (#838)
7596
7597 Also strip stray newlines from `win32/rules.mk`.
7598
7599 - [Viktor Szakats brought this change]
7600
7601 ci: retry choco install on appveyor (#837)
7602
7603 Trying to mitigate occasional intermittent failures while installing
7604 docker.
7605
7606 Ref: https://ci.appveyor.com/project/libssh2org/libssh2/builds/46460704/job/g3t7bro6ta6n3pk6#L52
7607
7608 - [Viktor Szakats brought this change]
7609
7610 cmake: drop unnecessary exception for warmup build (#835)
7611
7612 - [Viktor Szakats brought this change]
7613
7614 cmake: reflect minimum version in docs (#834)
7615
7616 Follow-up to 505ea626b6e125b7ce15caf453b522192008a884
7617
7618 - [Viktor Szakats brought this change]
7619
7620 cmake: add wolfSSL support to tests (#833)
7621
7622 wolfSSL supports building with zlib as a dependency, that's the reason
7623 for the ZLIB logic in the patch.
7624
7625 Also add it to `docs/INSTALL_CMAKE.md` and to the help text in
7626 `src/CMakeLists.txt`.
7627
7628 Running tests not actually tested.
7629
7630 Follow-up to 9f217a17f6f3c2047c4a1668a5c037a75a02abfd
7631
7632 Ref: #817
7633
7634 - [Viktor Szakats brought this change]
7635
7636 tests: workaround for intermittent first test failures (#832)
7637
7638 Flakiness got continously worse these last days. It didn't seem related
7639 to recent commits. Flakiness also picked up in GitHub CI runs, something
7640 rarely seen before. Manual restart consistently fixed them.
7641
7642 The repeating pattern was the _first_ test (`test_hostkey`) failing,
7643 with `libssh2_session_handshake failed (-13): Failed getting banner`.
7644 Failures came after a lengthy wait, suggesting a timeout.
7645
7646 I then reversed the order of the first two tests, and it turned out that
7647 the _first_ test failed again (`test_hostkey_hash`). Also pointing to a
7648 timeout issue.
7649
7650 Then I added a dummy test to "warm up" whatever needs warming up in the
7651 layers of CI + Docker + ssh server and their interconnects. This helped,
7652 and GitHub CI tests run without failure right for the first time.
7653 AppVeyor CI also improved a little.
7654
7655 This patch adds a new first test called `test_warmup`, that creates a
7656 new libssh2 session, and exits with success even if that attempt failed.
7657
7658 A stop-gap solution at best, and there is no guarantee it will continue
7659 to fix this or similar future issues, but it's also untenable to have
7660 almost every CI run fail for intermittent reasons.
7661
7662 In some [1] cases [2] it's not the first test failing intermittently.
7663 That's a different issue, and this patch doesn't fix it.
7664
7665 [1] #804
7666 [2] https://ci.appveyor.com/project/libssh2org/libssh2/builds/46440828/job/8rej6cq6itg7vc4w#L500
7667
7668 - [Viktor Szakats brought this change]
7669
7670 cmake: detect HAVE_SNPRINTF for tests (#830)
7671
7672 Turns out `test_keyboard_interactive_auth_info_request.c` requires
7673 `src/libssh2_priv.h`, which in turn requires a correctly set
7674 `HAVE_SNPRINTF`.
7675
7676 Follow-up to 4cdf785cd313c3272d04c2ef7458a35d44533d8b.
7677
7678 - [Viktor Szakats brought this change]
7679
7680 cmake: unset forced CMAKE_C_STANDARD 90 (#822)
7681
7682 Added in cf80f2f4b5255cc85a04ee43b27a29c678c1edb1 (on 2016-08-14),
7683 with the title "Basic dockerised test suite".
7684
7685 It's not clear why a C standard was explicitly set, but a side-effect
7686 of this is that CMake-built binaries diverged from ones built with
7687 autotools or GNU Make (using the same compiler and configuration).
7688
7689 Another issue is that this may introduce ABI incompatibility with
7690 binaries built with a different C standard flag, e.g. the C compiler
7691 default or one used for other components of a final app.
7692
7693 Seems unlikely, but if our tests require this option, we should set it
7694 for the CI builds only?
7695
7696 - [Viktor Szakats brought this change]
7697
7698 example: silence MSVS 2013 C4127 warnings (#828)
7699
7700 - [Viktor Szakats brought this change]
7701
7702 cmake: reposition ws2_32 to make binutils ld work again (#827)
7703
7704 This restores socket libs to their pre-regression positions.
7705
7706 Without this, `ld` doesn't find `ws2_32` symbols when referenced
7707 from TLS libs.
7708
7709 Regression from 31fb8860dbaae3e0b7d38f2a647ee527b4b2a95f
7710
7711 - [Viktor Szakats brought this change]
7712
7713 fix compiling with LIBSSH2_NO_CLEAR_MEMORY and OpenSSL (#825)
7714
7715 Regression from a0e424a51c27cc27af611ba20d134f9a9ae35273
7716
7717 Fixes #824
7718
7719 - [Viktor Szakats brought this change]
7720
7721 snprintf: add missing prototype for local replacement (#820)
7722
7723 Should fix these warnings with MSVS 2013 and older:
7724 `agent.c(294): warning C4013: '_libssh2_snprintf' undefined; assuming extern returning int`
7725
7726 Follow-up to 4cdf785cd313c3272d04c2ef7458a35d44533d8b.
7727
7728 - [Viktor Szakats brought this change]
7729
7730 build: set _FILE_OFFSET_BITS=64 for mingw-w64 (#821)
7731
7732 autotools builds already did auto-detect and set this mingw-specific
7733 macro, but CMake and GNU Make builds did not. This patch fixes that.
7734
7735 Necessary for `src/scp.c`.
7736
7737 - [Viktor Szakats brought this change]
7738
7739 cmake: add os400qc3.c to SOURCES (#826)
7740
7741 This re-syncs the list of compiled objects in cmake builds with
7742 non-cmake builds.
7743
7744 Follow-up to 16619a8eddec35bb8582d1c334db0fc13b0817c4.
7745
7746 - [Viktor Szakats brought this change]
7747
7748 build: silence bogus C4127 warnings with MSVS 2013 and earlier (#819)
7749
7750 E.g.:
7751 `channel.c(370): warning C4127: conditional expression is constant`
7752 Ref:
7753 https://ci.appveyor.com/project/libssh2org/libssh2/builds/46437333/job/5rak1vcl9hue31ei#L190
7754
7755 - [Viktor Szakats brought this change]
7756
7757 cmake: use only needed socket libs when checking non-blocking sockets (#816)
7758
7759 Based on patch by Christian Beier.
7760
7761 Fixes #694
7762 Closes #712
7763
7764 - [Viktor Szakats brought this change]
7765
7766 cmake: update openssl dll list (#818)
7767
7768 Add OpenSSL 3 and versionless DLL names. Also modernize warning messages
7769 and variable names.
7770
7771 Do we need the OpenSSL-Windows-specific check and the related
7772 `RUNTIME_DEPENDENCIES` feature? The list of OpenSSL DLLs was out of date
7773 for 1.5 years without anybody noticing. Keeping it fresh is a chore and
7774 copying around DLL dependencies rarely helps as much as expected. This
7775 check also results in unuseful warnings in certain build scenarios, e.g.
7776 when linking to OpenSSL statically.
7777
7778 - [Viktor Szakats brought this change]
7779
7780 cmake: add wolfSSL support (#817)
7781
7782 Implement wolfSSL support for libssh2 when building with CMake.
7783
7784 Configuration example from curl-for-win:
7785 ```
7786 -DCRYPTO_BACKEND=wolfSSL
7787 -DWOLFSSL_LIBRARY=/path-to/wolfssl/lib/libwolfssl.a
7788 -DWOLFSSL_INCLUDE_DIR=/path-to/wolfssl/include
7789 ```
7790
7791 Module `cmake/Findwolfssl.cmake` copied from:
7792 https://github.com/ngtcp2/ngtcp2/blob/e4d920c4b7a350d63b6978c68b216b76faa12635/cmake/Findwolfssl.cmake
7793 via commit:
7794 https://github.com/ngtcp2/ngtcp2/commit/296396d3730b721ad97f9de22f525400f8524c0e
7795 by Stefan Eissing
7796
7797 - [Viktor Szakats brought this change]
7798
7799 cmake: restore non-Windows socket lib detection (#815)
7800
7801 I mistakenly pruned some non-Windows logic, also missing the fact that
7802 our local `check_function_exists_may_need_library()` set the `NEED_*`
7803 variables. Oddly, only `src` imported this function, yet also `examples`
7804 and `tests` called it indirectly. The referenced `HAVE_SOCKET` /
7805 `HAVE_INET_ADDR` variables might be coming from an upstream CMake
7806 project? Leaving those there also, just in case.
7807
7808 Regression from 31fb8860dbaae3e0b7d38f2a647ee527b4b2a95f
7809
7810 Viktor Szakats (7 Mar 2023)
7811 - build: more fixes and tidy-up (mostly for Windows)
7812
7813 - cmake: always link `ws2_32` on Windows. Also add it to `libssh2.pc`.
7814
7815 Fixes #745
7816
7817 - agent: fix gcc compiler warning:
7818 `src/agent.c:296:35: warning: 'snprintf' output truncated before the last format character [-Wformat-truncation=]`
7819
7820 - autotools: fix `EVP_aes_128_ctr` detection with binutils `ld`
7821
7822 The prerequisite for a successful detection is setting
7823 `LIBS=-lbcrypt` if the chosen openssl-compatible library requires
7824 it, e.g. libressl, or quictls/openssl built with
7825 `-DUSE_BCRYPTGENRANDOM`.
7826
7827 With llvm `lld`, detection works out of the box. With binutils `ld`,
7828 it does not. The reason is `ld`s world-famous pickiness with lib
7829 order.
7830
7831 To fix it, we pass all custom libs before and after the TLS libs.
7832 This ugly hack makes `ld` happy and detection succeed.
7833
7834 - agent: fix Windows-specific warning:
7835 `src/agent.c:318:10: warning: implicit conversion loses integer precision: 'LRESULT' (aka 'long long') to 'int' [-Wshorten-64-to-32]`
7836
7837 - src: fix llvm/clang compiler warning:
7838 `src/libssh2_priv.h:987:28: warning: variadic macros are a C99 feature [-Wvariadic-macros]`
7839
7840 - src: support `inline` with `__GNUC__` (llvm/clang and gcc), fixing:
7841 ```
7842 src/libssh2_priv.h:990:8: warning: extension used [-Wlanguage-extension-token]
7843 static inline void
7844 ^
7845 ```
7846
7847 - blowfish: support `inline` keyword with MSVC.
7848
7849 Also switch to `__inline__` (from `__inline`) for `__GNUC__`:
7850 https://gcc.gnu.org/onlinedocs/gcc/Inline.html
7851 https://clang.llvm.org/docs/UsersManual.html#differences-between-various-standard-modes
7852
7853 - example/test: fix MSVC compiler warnings:
7854
7855 - `example\direct_tcpip.c(209): warning C4244: 'function': conversion from 'unsigned int' to 'u_short', possible loss of data`
7856 - `tests\session_fixture.c(96): warning C4013: 'getcwd' undefined; assuming extern returning int`
7857 - `tests\session_fixture.c(100): warning C4013: 'chdir' undefined; assuming extern returning int`
7858
7859 - delete unused macros:
7860 - `HAVE_SOCKET`
7861 - `HAVE_INET_ADDR`
7862 - `NEED_LIB_NSL`
7863 - `NEED_LIB_SOCKET`
7864 - `HAVE_NTSTATUS_H`
7865 - `HAVE_NTDEF_H`
7866
7867 - build: delete stale zlib/openssl version numbers from path defaults.
7868
7869 - cmake: convert tabs to spaces, add newline at EOFs.
7870
7871 Closes #811
7872
7873 - cmake: make `test_read` runs cross-build-friendly
7874
7875 Improve tests added in 7487dcf4b4ddae54b2a850737789b57b4251b0ae by
7876 running `test_read` commands directly. This makes external shell/batch
7877 files unnecessary, and is friendlier with cross-builds and when run
7878 from non-default shells, like MSYS2.
7879
7880 Also extend CRYPT/MAC test error messages with the CRYPT/MAC name.
7881
7882 External runner shell scripts kept for future use.
7883
7884 Closes #814
7885
7886 - src: enable clear memory on all platforms
7887
7888 - convert `_libssh2_explicit_zero()` to macro. This allows inlining
7889 where supported (e.g. `SecureZeroMemory()`).
7890
7891 - replace `SecureZeroMemory()` (in `wincng.c`) and
7892 `LIBSSH2_CLEAR_MEMORY`-guarded `memset()` (in `os400qc3.c`) with
7893 `_libssh2_explicit_zero()` macro.
7894
7895 - delete `LIBSSH2_CLEAR_MEMORY` guards, which enables secure-zeroing
7896 universally.
7897
7898 - add `LIBSSH2_NO_CLEAR_MEMORY` option to disable secure-zeroing.
7899
7900 - while here, delete double/triple inclusion of `misc.h`.
7901 `libssh2_priv.h` included it already.
7902
7903 Closes #810
7904
7905 - cmake: bump minimum version to 3.1 (from 2.8.12)
7906
7907 This allows to delete some fallback code.
7908
7909 CMake release dates:
7910 - 2014-12-15: 3.1
7911 - 2013-10-07: 2.8.12
7912
7913 Closes #813
7914
7915 - snprintf: unify fallback logic
7916
7917 Before this patch, the `snprintf()` fallback logic for envs not
7918 supporting this function (i.e. Visual Studio 2013 and older) varied
7919 depending on build tool, and used different techniques in examples,
7920 tests and libssh2 itself.
7921
7922 This patch aims to apply a common logic to libssh2 and examples/tests.
7923
7924 - libssh2: use local `snprintf()` fallback with all build tools.
7925
7926 We already had a local implementation, but only with CMake. Move that
7927 to the library as `_libssh2_snprintf()`, and map `snprintf()` to it
7928 when `HAVE_SNPRINTF` is not set.
7929
7930 Also change the length type from `int` to `size_t`, and fix
7931 formatting.
7932
7933 - set or detect `HAVE_SNPRINTF` in non-CMake builds.
7934
7935 Detect in autotools. Keep existing logic in `win32/libssh2_config.h`.
7936 Always set for OS/400, NetWare and VMS, keeping existing behaviour.
7937 (OS/400 builds use a different local implementation)
7938
7939 - examples/tests: drop the CMake-specific fallback logic and map
7940 `snprintf()` to `_snprintf()` for old MSVC versions, like we did
7941 before with other build tools. This is unsafe, but should be fine for
7942 these uses.
7943
7944 - `win32/libssh2_config.h`: make it easier to read.
7945
7946 Closes #812
7947
7948 - cmake: build fixes with OpenSSL/LibreSSL on Windows
7949
7950 - Link `bcrypt` for newer (non-fork) OpenSSL.
7951
7952 - Link `bcrypt` and `ws2_32` when using (non-fork) OpenSSL or LibreSSL,
7953 to allow `Looking for EVP_aes_128_ctr` detecting this feature.
7954
7955 With the feature available, but not found by CMake, build failed with:
7956 `openssl.c:636:21: error: incompatible integer to pointer conversion assigning to 'EVP_CIPHER *' (aka 'struct evp_cipher_st *') from 'int' [-Wint-conversion]`
7957
7958 Closes #809
7959
7960 - build fixes and improvements (mostly for Windows)
7961
7962 - in `hostkey.c` check the result of `libssh2_sha256_init()` and
7963 `libssh2_sha512_init()` calls. This avoid the warning that we're
7964 ignoring the return values.
7965
7966 - fix code using `int` (or `SOCKET`) for sockets. Use libssh2's
7967 dedicated `libssh2_socket_t` and `LIBSSH2_INVALID_SOCKET` instead.
7968
7969 - fix compiler warnings due to `STATUS_*` macro redefinitions between
7970 `ntstatus.h` / `winnt.h`. Solve it by manually defining the single
7971 `STATUS` value we need from `ntstatus.h` and stop including the whole
7972 header.
7973 Fixes #733
7974
7975 - improve Windows UWP/WinRT builds by detecting it with code copied
7976 from the curl project. Then excluding problematic libssh2 parts
7977 according to PR by Dmitry Kostjučenko.
7978 Fixes #734
7979
7980 - always use `SecureZeroMemory()` on Windows.
7981
7982 We can tweak this if not found or not inlined by a C compiler which
7983 we otherwise support. Same if it causes issues with UWP apps.
7984
7985 Ref: https://learn.microsoft.com/en-us/previous-versions/windows/desktop/legacy/aa366877(v=vs.85)
7986 Ref: https://learn.microsoft.com/en-us/windows-hardware/drivers/ddi/wdm/nf-wdm-rtlsecurezeromemory
7987
7988 - always enable `LIBSSH2_CLEAR_MEMORY` on Windows. CMake and
7989 curl-for-win builds already did that. Delete `SecureZeroMemory()`
7990 detection from autotools' WinCNG backend logic, that this
7991 setting used to depend on.
7992
7993 TODO: Enable it for all platforms in a separate PR.
7994 TODO: For clearing buffers in WinCNG, call `_libssh2_explicit_zero()`,
7995 insead of a local function or explicit `SecureZeroMemory()`.
7996
7997 - Makefile.inc: move `os400qc3.h` to `HEADERS`. This fixes
7998 compilation on non-unixy platforms. Recent regression.
7999
8000 - `libssh2.rc`: replace copyright with plain ASCII, as in curl.
8001
8002 Ref: curl/curl@1ca62bb
8003 Ref: curl/curl#7765
8004 Ref: curl/curl#7776
8005
8006 - CMake fixes and improvements:
8007
8008 - enable warnings with llvm/clang.
8009 - enable more comprehensive warnings with gcc and llvm/clang.
8010 Logic copied from curl:
8011 https://github.com/curl/curl/blob/233810bb5f6c5e7bedfc10bdd36607b958c0cfe4/CMakeLists.txt#L131-L148
8012 - fix `Policy CMP0080` CMake warning by deleting that reference.
8013 - add `ENABLE_WERROR` (default: `OFF`) option. Ported from curl.
8014 - add `PICKY_COMPILER` (default: `ON`) option, as known from curl.
8015
8016 It controls both the newly added picky warnings for llvm/clang and
8017 gcc, and also the pre-existing ones for MSVC.
8018
8019 - `win32/GNUmakefile` fixes and improvements:
8020
8021 - delete `_AMD64_` and add missing `-m64` for x64 builds under test.
8022 - add support for `ARCH=custom`.
8023 It disables hardcoded Intel 64-bit and Intel 32-bit options,
8024 allowing ARM64 builds.
8025 - add support for `LIBSSH2_RCFLAG_EXTRAS`.
8026 To pass custom options to windres, e.g. in ARM64 builds.
8027 - add support for `LIBSSH2_RC`. To override `windres`.
8028 - delete support for Metrowerks C. Last released in 2004.
8029
8030 - `win32/libssh2_config.h`: delete unnecessary socket #includes
8031
8032 `src/libssh2_priv.h` includes `winsock2.h` and `ws2tcpip.h` further
8033 down the line, triggered by `HAVE_WINSOCK2_H`.
8034
8035 `mswsock.h` does not seem to be necessary anymore.
8036
8037 Double-including these (before `windows.h`) caused compiler failures
8038 when building against BoringSSL and warnings with LibreSSL. We could
8039 work this around by passing `-DNOCRYPT`. Deleting the duplicates
8040 fixes these issues.
8041
8042 Timeline:
8043 2013: c910cd382dfa07fed2adaabf688af9e4a084fa1d deleted `mswsock.h` from `src/libssh2_priv.h`
8044 2008: 8c43bc52b1e3de2c8fc7899a80aec0e98de4e2d8 added `winsock2.h` and `ws2tcpip.h` to `src/libssh2_priv.h`
8045 2005: dc4bb1af967d2c53e90349f2f37324c622e714f5 added the now deleted #includes
8046
8047 - delete or replace `LIBSSH2_WIN32` with `WIN32`.
8048
8049 - replace hand-rolled `HAVE_WINDOWS_H` macro with `WIN32`. Also delete
8050 its detections/definitions.
8051
8052 - delete unused `LIBSSH2_DARWIN` macro.
8053
8054 - delete unused `writev()` Windows implementation
8055
8056 There is no reference to `writev()` since 2007-02-02, commit
8057 9d55db6501aa4e21f0858cf36cdc2ddc11b96e83.
8058
8059 - fix a bunch of MSVC / llvm/clang / gcc compiler warnings:
8060
8061 - `warning C4100: '...': unreferenced formal parameter`
8062 - using value of undefined PP macro `LIBSSH2DEBUG`
8063 - missing void from function definition
8064 - `if()` block missing in non-debug builds
8065 - unreferenced variable in non-debug builds
8066 - `warning: must specify at least one argument for '...' parameter of variadic macro [-Wgnu-zero-variadic-macro-arguments]`
8067 in `_libssh2_debug()`
8068 - `warning C4295: 'ciphertext' : array is too small to include a terminating null character`
8069 - `warning C4706: assignment within conditional expression`
8070 - `warning C4996: 'inet_addr': Use inet_pton() or InetPton() instead or
8071 define _WINSOCK_DEPRECATED_NO_WARNINGS to disable deprecated API warnings`
8072 By suppressning it. Would be best to use inet_pton() as suggested.
8073 On Windows this needs Vista though.
8074 - `warning C4152: nonstandard extension, function/data pointer conversion in expression`
8075 (silenced locally)
8076 - `warning C4068: unknown pragma`
8077
8078 Ref: https://ci.appveyor.com/project/libssh2org/libssh2/builds/46354480/job/j7d0m34qgq8rag5w
8079
8080 Closes #808
8081
8082 Dan Fandrich (1 Mar 2023)
8083 - Add tests to check individual crypt & HMAC methods
8084
8085 One specific crypt or hmac method is requested to be negotiated, then
8086 several MB of data is transferred.
8087
8088 - Add test to read lots of data over a channel
8089
8090 Connects to the ssh server then downloads several MB of data. This
8091 tests the data transfer path as well as boundary cases in packet
8092 handling as data is split into smaller SSH blocks.
8093
8094 GitHub (27 Feb 2023)
8095 - [Will Cosgrove brought this change]
8096
8097 Disable deprecated warnings for OpenSSL 3 #805 (#806)
8098
8099 Disable deprecated warnings (for now) when building against OpenSSL 3 for a clean build.
8100
8101 Reported:
8102 Daniel Stenberg
8103
8104 Dan Fandrich (24 Feb 2023)
8105 - Fix a couple of warnings of errors in MSVC builds
8106
8107 Two warnings (in tests & examples) in particular would cause problems:
8108 bad format causing invalid data output or a bad chdir due to out of
8109 scope buffer use.
8110
8111 - tests: Support running tests in out-of-tree builds
8112
8113 Various files are found by referencing the srcdir environment variable
8114 in that case.
8115
8116 Closes #801
8117
8118 - Improve the ssh2 example program to run a command
8119
8120 This performs better as an example since it shows more working code, and
8121 in the simplest possible way. It also turns the program into an actually
8122 useful tool out of the box, able to run an arbitrary command (with one
8123 restriction) on a remote machine and return the response, without
8124 needing to touch the source.
8125
8126 Closes #800
8127
8128 GitHub (14 Feb 2023)
8129 - [Will Cosgrove brought this change]
8130
8131 Add NULL session check to _libssh2_error_flags() (#796)
8132
8133 Don't dereference null if a null session happens to make it into _libssh2_error_flags()
8134
8135 Dan Fandrich (7 Feb 2023)
8136 - Reorder AES crypt methods so stronger ones are first
8137
8138 This make it more likely that a stronger one will be negotiated rather
8139 than a weaker variant.
8140
8141 - CI: update uses: dependencies to the latest versions
8142
8143 We were seeing some deprecation warning messages on some of the older
8144 ones.
8145
8146 - transport.c: Add some comments
8147
8148 - Add missing files to automake makefiles & build tests
8149
8150 Many files have been added to the cmake build files but not the automake
8151 ones in recent years. Missing ones have been added so automake "make
8152 dist" will now create a usable tar ball.
8153
8154 The integration tests using Docker are now built with automake as well
8155 (with "make check"). They are not run yet since they aren't working yet
8156 on Linux.
8157
8158 - tests: Fix gcc compile warnings
8159
8160 These were mostly due to missing and non-ANSI prototypes.
8161
8162 - Enable trace debugging in example/ssh2
8163
8164 This is intended to be a test program, so debugging is likely to be
8165 useful by default.
8166
8167 - Improve example/ssh2 to allow unmodified use of public key auth
8168
8169 The previous hard-coded key file paths were not valid for normal users.
8170 Make the paths relative to the user's home directory instead so they
8171 can work out of the box. Add a banner showing what connection will be
8172 attempted to make it easier for the user to see what is being attempted.
8173 Enable trace debugging since this is designed as a test program.
8174
8175 GitHub (13 Dec 2022)
8176 - [Viktor Szakats brought this change]
8177
8178 openssl.h: enable ed25519 for LibreSSL 3.7.0 (#778)
8179
8180 This brings LibreSSL libssh2 builds on par with OpenSSL.
8181
8182 Dan Fandrich (5 Dec 2022)
8183 - configure.ac: check for sys/param.h
8184
8185 This file is required by glibc for the test suite.
8186
8187 GitHub (12 Nov 2022)
8188 - [Viktor Szakats brought this change]
8189
8190 tests: add option to run tests without docker (#762)
8191
8192 via `export OPENSSH_NO_DOCKER=1`.
8193
8194 SSH server host can be set via:
8195 `export OPENSSH_SERVER_HOST=127.0.0.1`
8196
8197 SSH server port via existing:
8198 `export OPENSSH_SERVER_PORT=4711`
8199
8200 This requires more work to be usable out of the box. The necessery sshd
8201 config is (partly) embedded into `tests/openssh_server/Dockerfile`.
8202
8203 After this patch, it is possible to run tests in envs where docker is
8204 not installed or not available, by running a preconfigured,
8205 non-containerized sshd.
8206
8207 - [Michael Buckley brought this change]
8208
8209 Skip leading \r and \n characters in banner_receive() (#769)
8210
8211 Fixes #768
8212
8213 Credit:
8214 Michael Buckley
8215
8216 - [Zenju brought this change]
8217
8218 Fixed error handling of _libssh2_packet_requirev callers (#767)
8219
8220 Notes:
8221
8222 some callers of _libssh2_packet_requirev() fail to set _libssh2_error().
8223 This creates the situation where e.g. libssh2_session_handshake() fails, but libssh2_session_last_error() confusingly returns LIBSSH2_ERROR_NONE.
8224
8225 Credit:
8226 Zenju
8227
8228 - [Will Cosgrove brought this change]
8229
8230 Revert usage of EVP_CipherUpdate #764 #739 (#765)
8231
8232 Revert usage of EVP_CipherUpdate from wolfSSL PR to fix #764 #739.
8233
8234 - [Will Cosgrove brought this change]
8235
8236 Fix regression with rsa_sha2_verify #758 (#763)
8237
8238 Fixes comparison with the result value coming from `mbedtls_rsa_pkcs1_verify`. Success is 0, not 1.
8239
8240 Marc Hoersken (24 Oct 2022)
8241 - CI: fix AppVeyor status failing for starting jobs
8242
8243 Viktor Szakats (24 Oct 2022)
8244 - delete cast5 - null-cipher mapping
8245
8246 - more feature guard cleanup
8247
8248 - indent
8249
8250 - formatting
8251
8252 - fold long lines
8253
8254 - cleanup
8255
8256 - temporarily silence checksrc
8257
8258 - add mbedTLS 3.x support
8259
8260 Make libssh2 compile cleanly with mbedTLS 3.x and later.
8261
8262 This patch makes use of `MBEDTLS_PRIVATE()`, which is not the
8263 recommended, future-proof way to access mbedTLS data structures. This
8264 method may break with a minor upgrade, according to the authors. This
8265 is also the method used by libcurl.
8266
8267 Also:
8268
8269 - Fix a potentially uninitialized variable in
8270 `libssh2_mbedtls_rsa_sha2_sign()`. This happened in an error path,
8271 resulting in an unnecessary mbedTLS API call, with an uninitialized
8272 `md_type`.
8273
8274 - Bump mbedTLS version used in CI tests to 3.2.1.
8275
8276 Fixes #751
8277
8278 - tests: add option to enable all trace messages in fixture
8279
8280 via `export FIXTURE_TRACE_ALL=1`.
8281
8282 - win32/GNUmakefile: add mbedTLS support
8283
8284 via `export MBEDTLS_PATH=<mbedtls-root>`.
8285
8286 Marc Hoersken (21 Oct 2022)
8287 - CI: fix AppVeyor job links only working for most recent build
8288
8289 Ref: https://github.com/curl/curl/pull/9768#issuecomment-1286675916
8290 Reported-by: Daniel Stenberg
8291
8292 Follow up to #754
8293
8294 - CI: add missing permission section to AppVeyor status workflow
8295
8296 Follow up to #754
8297
8298 - Remove OSSFuzz integration which was replaced with CIFuzz (#756)
8299
8300 Confirmed-by: Max Dymond
8301
8302 - Rename workflow file appveyor.yml to appveyor_docker.yml
8303
8304 - Streamline names of CI workflow jobs
8305
8306 - [Jeroen Ooms brought this change]
8307
8308 Add CI for mingw-w64 via msys2 (#742)
8309
8310 Credit: Jeroen Ooms
8311
8312 - CI: report AppVeyor build status for each job (#754)
8313
8314 Also give each job on AppVeyor CI a human-readable name.
8315
8316 This aims to make job and therefore build failures more visible.
8317
8318 GitHub (29 Sep 2022)
8319 - [Michael Buckley brought this change]
8320
8321 Support for sk-ecdsa-sha2-nistp256 and sk-ssh-ed25519 keys, FIDO (#698)
8322
8323 Notes:
8324 Add support for [email protected] and [email protected] key exchange for FIDO auth using the OpenSSL backend. Stub API for other backends.
8325
8326 Credit:
8327 Michael Buckley
8328
8329 - [Y. Yang brought this change]
8330
8331 Fix DLL import library name (#711)
8332
8333 Notes:
8334 Fix DLL import library name
8335
8336 https://aur.archlinux.org/packages/mingw-w64-libssh2
8337 https://cmake.org/cmake/help/latest/prop_tgt/IMPORT_PREFIX.html
8338
8339 Credit:
8340 metab0t
8341 Y. Yang
8342
8343 - [skundu07 brought this change]
8344
8345 Add RSA-SHA2 support for the WinCNG backend (#736)
8346
8347 Notes:
8348 Added code to support RSA-SHA2 for WinCNG backend.
8349
8350 Credit:
8351 skundu07
8352
8353 - [Gabriel Smith brought this change]
8354
8355 sftp: Prevent files from being skipped if the output buffer is too small (#746)
8356
8357 Notes:
8358 LIBSSH2_ERROR_BUFFER_TOO_SMALL is returned if the buffer is too small
8359 to contain a returned directory entry. On this condition we jump to the
8360 label `end`. At this point the number of names left is decremented
8361 despite no name being returned.
8362
8363 As suggested in #714, this commit moves the error label after the
8364 decrement of `names_left`.
8365
8366 Fixes #714
8367
8368 Credit:
8369 Co-authored-by: Gabriel Smith <[email protected]>
8370
8371 - [bgermann brought this change]
8372
8373 Drop advertisement clause on Blowfish (#747)
8374
8375 Originally driven by https://github.com/pyca/bcrypt/issues/169, OpenBSD
8376 removed Niels Provos's BSD advertisement clause in version 7.1:
8377
8378 https://cvsweb.openbsd.org/cgi-bin/cvsweb/src/sys/lib/libsa/blowfish.c.diff?r1=1.1&r2=1.2
8379 https://cvsweb.openbsd.org/cgi-bin/cvsweb/src/sys/lib/libsa/blowfish.h.diff?r1=1.1&r2=1.2
8380
8381 This enables using libssh2 in GPL software.
8382
8383 - [zhaochongliu brought this change]
8384
8385 Support building with gcc < version 8
8386
8387 Files: CMakeLists.txt
8388
8389 Notes: don't use gcc arguments that don't exist in gcc versions lower than 8 if building with older gcc.
8390
8391 Credit:
8392 zhaochongliu
8393
8394 - [Miguel de Icaza brought this change]
8395
8396 Document the obscure LIBSSH2_ERROR_BAD_USE when writing to a channel (#713)
8397
8398 Document the obscure LIBSSH2_ERROR_BAD_USE when writing to a channel
8399
8400 Credit:
8401 Miguel de Icaza
8402
8403 - [Michael Buckley brought this change]
8404
8405 Don't erroneously log SSH_MSG_REQUEST_FAILURE packets from keepalive (#727)
8406
8407 Notes:
8408 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.
8409
8410 Credit:
8411 Michael Buckley
8412
8413 - [Ryan Kelley brought this change]
8414
8415 Updating docs for libssh2_channel_flush_ex (#728)
8416
8417 Notes:
8418 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.
8419
8420 Credit:
8421 Ryan Kelley
8422
8423 - [Sandeep Bansal brought this change]
8424
8425 Support RSA certificate authentication (#710)
8426
8427 * Adding support for signed RSA keys and unit test
8428
8429 Credit:
8430 Sandeep Bansal
8431
8432 Viktor Szakats (2 Jul 2022)
8433 - configure: add --disable-tests option
8434
8435 - cmake: do not add libssh2.rc to the static library
8436
8437 GitHub (23 May 2022)
8438 - [AyushiN brought this change]
8439
8440 Fixed typo #697 (#701)
8441
8442 Credit:
8443 AyushiN
8444
8445 - [Viktor Szakats brought this change]
8446
8447 Openssl: add support for LibreSSL 3.5.x (#700)
8448
8449 LibreSSL 3.5.0 made more structures opaque, so let's enable existing
8450 support for that when building against these LibreSSL versions.
8451
8452 Ref: https://ftp.openbsd.org/pub/OpenBSD/LibreSSL/libressl-3.5.0-relnotes.txt
8453
8454 Credit:
8455 Viktor Szakats
8456
8457 - [Michael Buckley brought this change]
8458
8459 Ensure KEX replies don't include extra bytes (#696)
8460
8461 Addresses #695
8462
8463 Credit:
8464 Michael Buckley, reported by Harry Sintonen
8465
8466 - [Zenju brought this change]
8467
8468 Fix buffer overflow during SSH_MSG_USERAUTH_BANNER (#693)
8469
8470 File: userauth.c
8471 Notes:
8472 This patch fixes application crashes due to heap corruption. Turns out the null terminator is written one byte outside of the allocated area.
8473 Credit:
8474 Zenju
8475
8476 - [Will Cosgrove brought this change]
8477
8478 Changed NULL check to avoid logic change
8479
8480 - [Will Cosgrove brought this change]
8481
8482 NULL check before calling session_handshake
8483
8484 - [Harry Sintonen brought this change]
8485
8486 Fix build since openssl 1.1.0 when ECDSA and/or RIPEMD are disabled (#666)
8487
8488 File: openssl.h
8489
8490 Notes:
8491 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.
8492
8493 Credit:
8494 Harry Sintonen
8495 Co-authored-by: Harry Sintonen <[email protected]>
8496
8497 - [gbaraldi brought this change]
8498
8499 Add RSA-SHA2 support for the mbedtls backend (#688)
8500
8501 File: mbedtls.c
8502
8503 Notes:
8504 * Add sha2 support for RSA key upgrading to mbedTLS backend
8505
8506 Credit:
8507 gbaraldi
8508
8509 Daniel Stenberg (21 Mar 2022)
8510 - misc/libssh2_copy_string: avoid malloc zero bytes
8511
8512 Avoids the inconsistent malloc return code for malloc(0)
8513
8514 Closes #686
8515
8516 Marc Hoersken (17 Mar 2022)
8517 - wincng: rename struct field referring to the DH private big number
8518
8519 Closes #684
8520
8521 - tests/openssh_fixture.c: print command after variable expansion
8522
8523 - CI: store and reuse OpenSSH Server docker image used for tests
8524
8525 Supersedes #588
8526 Fixes #665
8527 Closes #685
8528
8529 GitHub (26 Feb 2022)
8530 - [Will Cosgrove brought this change]
8531
8532 Added LibreSSL to crypto backend list
8533
8534 - [Will Cosgrove brought this change]
8535
8536 Added crypto backend list to template
8537
8538 Added OS version as well
8539
8540 - [Will Cosgrove brought this change]
8541
8542 Revert "Option to build both static and shared libraries (#547)" (#675)
8543
8544 This reverts commit b60dca8b6450a9729670986d2899cca54ccdbb6d.
8545
8546 #547 doesn't build clean anymore with the keyboard interactive changes.
8547
8548 - [berney brought this change]
8549
8550 Option to build both static and shared libraries (#547)
8551
8552 files: cmakelists.txt
8553
8554 Notes:
8555 * Option to build both static and shared libraries when using CMake
8556
8557 Credit:
8558 berney
8559
8560 - [xalopp brought this change]
8561
8562 Use modern API in userauth_keyboard_interactive() (#663)
8563
8564 Files: userauth_kbd_packet.c, userauth_kbd_packet.h, test_keyboard_interactive_auth_info_request.c, userauth.c
8565
8566 Notes:
8567 This refactors `SSH_MSG_USERAUTH_INFO_REQUEST` processing in `userauth_keyboard_interactive()` in order to improve robustness, correctness and readability or the code.
8568
8569 * Refactor userauth_keyboard_interactive to use new api for packet parsing
8570 * add unit test for userauth_keyboard_interactive_parse_response()
8571 * add _libssh2_get_boolean() and _libssh2_get_byte() utility functions
8572
8573 Credit:
8574 xalopp
8575
8576 - [xalopp brought this change]
8577
8578 Fix formatting in manual page (#667)
8579
8580 Fixed formatting of `LIBSSH2_ERROR_AUTHENTICATION_FAILED` in the errors section.
8581
8582 credit: xalopp
8583
8584 - [tihmstar brought this change]
8585
8586 NULL terminate server_sign_algorithms string (#669)
8587
8588 files: packet.c, libssh2_priv.h
8589
8590 notes:
8591 * Fix heap buffer overflow in _libssh2_key_sign_algorithm
8592
8593 When allocating `session->server_sign_algorithms` which is a `char*` is is important to also allocate space for the string-terminating null byte at the end and make sure the string is actually null terminated.
8594
8595 Without this fix, the `strchr()` call inside the `_libssh2_key_sign_algorithm` (line 1219) function will try to parse the string and go out of buffer on the last invocation.
8596
8597 Credit: tihmstar
8598 Co-authored-by: Will Cosgrove <[email protected]>
8599
8600 - [Will Cosgrove brought this change]
8601
8602 free RSA2 related memory (#664)
8603
8604 Free `server_sign_algorithms` and `sign_algo_prefs`.
8605
8606 - [Will Cosgrove brought this change]
8607
8608 Legacy Agent support for rsa2 key upgrading/downgrading #659 (#662)
8609
8610 Files: libssh2.h, agent.c, userauth.c
8611
8612 Notes:
8613 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.
8614
8615 Credit:
8616 Will Cosgrove (signed off by Michael Buckley)
8617
8618 - [Ian Hattendorf brought this change]
8619
8620 Support rsa-sha2 agent flags (#661)
8621
8622 File: agent.c
8623 Notes: implements rsa-sha2 flags used to tell the agent which signing algo to use.
8624 https://tools.ietf.org/id/draft-miller-ssh-agent-01.html#rfc.section.4.5.1
8625
8626 Credit:
8627 Ian Hattendorf
8628
8629 Daniel Stenberg (13 Jan 2022)
8630 - [Sunil Nimmagadda brought this change]
8631
8632 ssh: Add support for userauth banner.
8633
8634 The new libssh2_userauth_banner API allows to get an optional
8635 userauth banner sent with SSH_MSG_USERAUTH_BANNER packet by the
8636 server.
8637
8638 Closes #610
8639
8640 GitHub (6 Jan 2022)
8641 - [Michael Buckley brought this change]
8642
8643 Fix a memcmp errors in code that was changed from memmem to memcmp (#656)
8644
8645 Notes:
8646 Fixed supported algo prefs list check when upgrading rsa keys
8647
8648 Credit: Michael Buckley
8649
8650 - [Hayden Roche brought this change]
8651
8652 Add support for a wolfSSL crypto backend. (#629)
8653
8654 It uses wolfSSL's OpenSSL compatibility layer, so rather than introduce new
8655 wolfssl.h/c files, the new backend just reuses openssl.h/c. Additionally,
8656 replace EVP_Cipher() calls with EVP_CipherUpdate(), since EVP_Cipher() is not
8657 recommended.
8658
8659 Credit: Hayden Roche
8660
8661 - [Bastien Durel brought this change]
8662
8663 Runtime engine detection with libssh2_crypto_engine() (#643)
8664
8665 File:
8666 version.c, HACKING-CRYPTO, libssh2.h, libssh2_crypto_engine.3, makefile.
8667
8668 Notes:
8669 libssh2_crypto_engine() API to get crypto engine at runtime.
8670
8671 Credit: Bastien Durel
8672
8673 - [Will Cosgrove brought this change]
8674
8675 RSA SHA2 256/512 key upgrade support RFC 8332 #536 (#626)
8676
8677 Notes:
8678 * Host Key RSA 256/512 support #536
8679 * Client side key hash upgrading for RFC 8332
8680 * Support for server-sig-algs, ext-info-c server messages
8681 * Customizing preferred server-sig-algs via the preference LIBSSH2_METHOD_SIGN_ALGO
8682
8683 Credit: Anders Borum, Will Cosgrove
8684
8685 - [xalopp brought this change]
8686
8687 fix: use userauth name length to check memory boundaries for userauth name, fixes #653 (#654)
8688
8689 File: userauth.c
8690
8691 Notes:
8692 Fixes `userauth_kybd_auth_name_len` length check
8693
8694 Co-authored-by: Xaver Lopenstedt <[email protected]>
8695
8696 - [Daniel Stenberg brought this change]
8697
8698 agent: handle overly large comment lengths (#651)
8699
8700 Reported-by: Harry Sintonen
8701
8702 - [Daniel Stenberg brought this change]
8703
8704 userauth: check for too large userauth_kybd_auth_name_len (#650)
8705
8706 ... before using it.
8707
8708 Reported-by: MarcoPoloPie
8709 Fixes #649
8710
8711 Daniel Stenberg (17 Dec 2021)
8712 - .github/SECURITY.md: fix the URL
8713
8714 - .github/SECURITY.md: add security policy
8715
8716 GitHub (30 Nov 2021)
8717 - [Will Cosgrove brought this change]
8718
8719 hostkey_method_ssh_ed25519_init() check key bounds (#645)
8720
8721 * hostkey_method_ssh_ed25519_init() check key bounds
8722
8723 File: hostkey.c
8724
8725 Notes:
8726 Additional key length checking before calling _libssh2_ed25519_new_public()
8727
8728 Credit:
8729 Will Cosgrove
8730
8731 - [Will Cosgrove brought this change]
8732
8733 Fix error message in memory_read_privatekey #636
8734
8735 file: userauth.c
8736 note: fix error message
8737 credit:
8738 volund
8739
8740 - [cntrump brought this change]
8741
8742 Update maketgz for macOS (#543)
8743
8744 File:
8745 maketgz
8746
8747 Notes:
8748 Fix error on macOS: sed: -e: No such file or directory
8749
8750 Credit:
8751 cntrump
8752
8753 - [Jun Tseng brought this change]
8754
8755 CMake update minimum version to 2.8.12 (#639)
8756
8757 File:
8758 CMakeLists.txt
8759
8760 Notes:
8761 Following CMake's advice, Update the minimum required version.
8762
8763 Credit:
8764 Jun Tseng
8765
8766 Daniel Stenberg (8 Nov 2021)
8767 - [David Korczynski brought this change]
8768
8769 ci: Add CIFuzz integration
8770
8771 Notes:
8772 Add CIFuzz integration to run fuzzer using the OSS-Fuzz infrastructure
8773 at each PR.
8774
8775 Signed-off-by: David Korczynski <[email protected]>
8776 Closes #635
8777
8778 GitHub (26 Oct 2021)
8779 - [Uwe L. Korn brought this change]
8780
8781 Use libssh2_EXPORTS as an alternative to _WINDLL (#470)
8782
8783 Files: libssh2.h
8784
8785 Notes:
8786 `_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.
8787
8788 Credit:
8789 Uwe L. Korn
8790
8791 Viktor Szakats (1 Oct 2021)
8792 - windows: fix clang and WinCNG warnings
8793
8794 Fix these categories of warning:
8795
8796 - in `wincng.c` disagreement in signed/unsigned char when passing around
8797 the passphrase string:
8798 `warning: pointer targets in passing argument [...] differ in signedness [-Wpointer-sign]`
8799 Fixed by using `const unsigned char *` in all static functions and
8800 applying/updating casts as necessary.
8801
8802 - in each use of `libssh2_*_init()` macros where the result is not used:
8803 `warning: value computed is not used [-Wunused-value]`
8804 Fixed by using `(void)` casts.
8805
8806 - `channel.c:1171:7: warning: 'rc' may be used uninitialized in this function [-Wmaybe-uninitialized]`
8807 Fixed by initializing this variable with `LIBSSH2_ERROR_CHANNEL_UNKNOWN`.
8808 While there I replaced a few 0 literals with `LIBSSH2_ERROR_NONE`.
8809
8810 - in `sftp.c`, several of these two warnings:
8811 `warning: 'data' may be used uninitialized in this function [-Wmaybe-uninitialized]`
8812 `warning: 'data_len' may be used uninitialized in this function [-Wmaybe-uninitialized]`
8813 Fixed by initializing these variables with NULL and 0 respectively.
8814
8815 - Also removed the exec attribute from `wincng.h`.
8816
8817 Notes:
8818 - There are many pre-existing checksrc issues.
8819 - The `sftp.c` and `channel.c` warnings may apply to other platforms as well.
8820
8821 Closes #628
8822
8823 Daniel Stenberg (25 Sep 2021)
8824 - README: use www.libssh2.org for the license link
8825
8826 - libssh2.h: bump it to 1.10.1-dev
8827
8828 - mailing list: moved to lists.haxx.se
8829
8830 GitHub (2 Sep 2021)
8831 - [Laurent Stacul brought this change]
8832
8833 openssh_fixture.c: Fix openssh_server build not working (#616) (#620)
8834
8835 File: openssh_fixture.c
8836
8837 Notes:
8838 fixes too long of output lines building docker image
8839
8840 Credit:
8841 Laurent Stacul
8842
8843 - [Will Cosgrove brought this change]
8844
8845 openssh_fixture.c: fix warning (#621)
8846
8847 File: openssh_fixture.c
8848
8849 Notes:
8850 Fix `portable_sleep` return type warning
8851
8852 Credit:
8853 Will Cosgrove
8854
8855 - [Will Cosgrove brought this change]
8856
8857 Update CI to use latest Ubuntu #624 (#625)
8858
8859 File: ci.yml
8860
8861 Notes:
8862 Update CI to use latest Ubuntu #624
8863
8864 Also removed 32 bit building in the matrix.
8865
8866 Credit:
8867 Will Cosgrove
8868
8869 - [Will Cosgrove brought this change]
8870
8871 Update .gitignore
8872
8873 Add .DS_Store files for macOS
8874
8875 - [Laurent Stacul brought this change]
8876
8877 Makefile.am: Add missing key in case openssl > 1.1.0 (#617)
8878
8879 File: Makefile.am
8880
8881 Notes: fix missing test keys
8882
8883 Credit:
8884 Laurent Stacul
8885
8886 Version 1.10.0 (29 Aug 2021)
8887
8888 Daniel Stenberg (29 Aug 2021)
8889 - [Will Cosgrove brought this change]
8890
8891 updated docs for 1.10.0 release
8892
8893 Marc Hörsken (30 May 2021)
8894 - [Laurent Stacul brought this change]
8895
8896 [tests] Try several times to connect the ssh server
8897
8898 Sometimes, as the OCI container is run in detached mode, it is possible
8899 the actual server is not ready yet to handle SSH traffic. The goal of
8900 this PR is to try several times (max 3). The mechanism is the same as
8901 for the connection to the docker machine.
8902
8903 - [Laurent Stacul brought this change]
8904
8905 Remove openssh_server container on test exit
8906
8907 - [Laurent Stacul brought this change]
8908
8909 Allow the tests to run inside a container
8910
8911 The current tests suite starts SSH server as OCI container. This commit
8912 add the possibility to run the tests in a container provided that:
8913
8914 * the docker client is installed builder container
8915 * the host docker daemon unix socket has been mounted in the builder
8916 container (with, if needed, the DOCKER_HOST environment variable
8917 accordingly set, and the permission to write on this socket)
8918 * the builder container is run on the default bridge network, or the
8919 host network. This PR does not handle the case where the builder
8920 container is on another network.
8921
8922 Marc Hoersken (28 May 2021)
8923 - CI/appveyor: run SSH server for tests on GitHub Actions (#607)
8924
8925 No longer rely on DigitalOcean to host the Docker container.
8926
8927 Unfortunately we require a small dispatcher script that has
8928 access to a GitHub access token with scope repo in order to
8929 trigger the daemon workflow on GitHub Actions also for PRs.
8930
8931 This script is hosted by myself for the time being until GitHub
8932 provides a tighter scope to trigger the workflow_dispatch event.
8933
8934 GitHub (26 May 2021)
8935 - [Will Cosgrove brought this change]
8936
8937 openssl.c: guards around calling FIPS_mode() #596 (#603)
8938
8939 Notes:
8940 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.
8941
8942 Credit:
8943 Will Cosgrove
8944
8945 - [Will Cosgrove brought this change]
8946
8947 configure.ac: don't undefine scoped variable (#594)
8948
8949 * configure.ac: don't undefine scoped variable
8950
8951 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.
8952
8953 * configure.ac: remove cygwin specific CFLAGS #598
8954
8955 Notes:
8956 Remove cygwin specific Win32 CFLAGS and treat the build like a posix build
8957
8958 Credit:
8959 Will Cosgrove, Brian Inglis
8960
8961 - [Laurent Stacul brought this change]
8962
8963 tests: Makefile.am: Add missing tests client keys in distribution tarball (#604)
8964
8965 Notes:
8966 Added missing test keys.
8967
8968 Credit:
8969 Laurent Stacul
8970
8971 - [Laurent Stacul brought this change]
8972
8973 Makefile.am: Add missing test keys in the distribution tarball (#601)
8974
8975 Notes:
8976 Fix tests missing key to build the OCI image
8977
8978 Credit:
8979 Laurent Stacul
8980
8981 Daniel Stenberg (16 May 2021)
8982 - dist: add src/agent.h
8983
8984 Fixes #597
8985 Closes #599
8986
8987 GitHub (12 May 2021)
8988 - [Will Cosgrove brought this change]
8989
8990 packet.c: Reset read timeout after received a packet (#576) (#586)
8991
8992 File:
8993 packet.c
8994
8995 Notes:
8996 Attempt keyboard interactive login (Azure AD 2FA login) and use more than 60 seconds to complete the login, the connection fails.
8997
8998 The _libssh2_packet_require function does almost the same as _libssh2_packet_requirev but this function sets state->start = 0 before returning.
8999
9000 Credit:
9001 teottin, Co-authored-by: Tor Erik Ottinsen <[email protected]>
9002
9003 - [kkoenig brought this change]
9004
9005 Support ECDSA certificate authentication (#570)
9006
9007 Files: hostkey.c, userauth.c, test_public_key_auth_succeeds_with_correct_ecdsa_key.c
9008
9009 Notes:
9010 Support ECDSA certificate authentication
9011
9012 Add a test for:
9013 - Existing ecdsa basic public key authentication
9014 - ecdsa public key authentication with a signed public key
9015
9016 Credit:
9017 kkoenig
9018
9019 - [Gabriel Smith brought this change]
9020
9021 agent.c: Add support for Windows OpenSSH agent (#517)
9022
9023 Files: agent.c, agent.h, agent_win.c
9024
9025 Notes:
9026 * agent: Add support for Windows OpenSSH agent
9027
9028 The implementation was partially taken and modified from that found in
9029 the Portable OpenSSH port to Win32 by the PowerShell team, but mostly
9030 based on the existing Unix OpenSSH agent support.
9031
9032 https://github.com/PowerShell/openssh-portable
9033
9034 Regarding the partial transfer support implementation: partial transfers
9035 are easy to deal with, but you need to track additional state when
9036 non-blocking IO enters the picture. A tracker of how many bytes have
9037 been transfered has been placed in the transfer context struct as that's
9038 where it makes most sense. This tracker isn't placed behind a WIN32
9039 #ifdef as it will probably be useful for other agent implementations.
9040
9041 * agent: win32 openssh: Disable overlapped IO
9042
9043 Non-blocking IO is not currently supported by the surrounding agent
9044 code, despite a lot of the code having everything set up to handle it.
9045
9046 Credit:
9047 Co-authored-by: Gabriel Smith <[email protected]>
9048
9049 - [Zenju brought this change]
9050
9051 Fix detailed _libssh2_error being overwritten (#473)
9052
9053 Files: openssl.c, pem.c, userauth.c
9054
9055 Notes:
9056 * Fix detailed _libssh2_error being overwritten by generic errors
9057 * Unified error handling
9058
9059 Credit:
9060 Zenju
9061
9062 - [Paul Capron brought this change]
9063
9064 Fix _libssh2_random() silently discarding errors (#520)
9065
9066 Notes:
9067 * Make _libssh2_random return code consistent
9068
9069 Previously, _libssh2_random was advertized in HACKING.CRYPTO as
9070 returning `void` (and was implemented that way in os400qc3.c), but that
9071 was in other crypto backends a lie; _libssh2_random is (a macro
9072 expanding) to an int-value expression or function.
9073
9074 Moreover, that returned code was:
9075 — 0 or success, -1 on error for the MbedTLS & WinCNG crypto backends
9076 But also:
9077 — 1 on success, -1 or 0 on error for the OpenSSL backend!
9078 – 1 on success, error cannot happen for libgcrypt!
9079
9080 This commit makes explicit that _libssh2_random can fail (because most of
9081 the underlying crypto functions can indeed fail!), and it makes its result
9082 code consistent: 0 on success, -1 on error.
9083
9084 This is related to issue #519 https://github.com/libssh2/libssh2/issues/519
9085 It fixes the first half of it.
9086
9087 * Don't silent errors of _libssh2_random
9088
9089 Make sure to check the returned code of _libssh2_random(), and
9090 propagates any failure.
9091
9092 A new LIBSSH_ERROR_RANDGEN constant is added to libssh2.h
9093 None of the existing error constants seemed fit.
9094
9095 This commit is related to d74285b68450c0e9ea6d5f8070450837fb1e74a7
9096 and to https://github.com/libssh2/libssh2/issues/519 (see the issue
9097 for more info.) It closes #519.
9098
9099 Credit:
9100 Paul Capron
9101
9102 - [Gabriel Smith brought this change]
9103
9104 ci: Remove caching of docker image layers (#589)
9105
9106 Notes:
9107 continued ci reliability work.
9108
9109 Credit:
9110 Gabriel Smith
9111
9112 - [Gabriel Smith brought this change]
9113
9114 ci: Speed up docker builds for tests (#587)
9115
9116 Notes:
9117 The OpenSSH server docker image used for tests is pre-built to prevent
9118 wasting time building it during a test, and unneeded rebuilds are
9119 prevented by caching the image layers.
9120
9121 Credit:
9122 Gabriel Smith
9123
9124 - [Will Cosgrove brought this change]
9125
9126 userauth.c: don't error if using keys without RSA (#555)
9127
9128 file: userauth.c
9129
9130 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
9131
9132 credit:
9133 Will Cosgrove
9134
9135 - [Marc brought this change]
9136
9137 openssl.c: Avoid OpenSSL latent error in FIPS mode (#528)
9138
9139 File:
9140 openssl.c
9141
9142 Notes:
9143 Avoid initing MD5 digest, which is not permitted in OpenSSL FIPS certified cryptography mode.
9144
9145 Credit:
9146 Marc
9147
9148 - [Laurent Stacul brought this change]
9149
9150 openssl.c: Fix EVP_Cipher interface change in openssl 3 #463
9151
9152 File:
9153 openssl.c
9154
9155 Notes:
9156 Fixes building with OpenSSL 3, #463.
9157
9158 The change is described there:
9159 https://github.com/openssl/openssl/commit/f7397f0d58ce7ddf4c5366cd1846f16b341fbe43
9160
9161 Credit:
9162 Laurent Stacul, reported by Sergei
9163
9164 - [Gabriel Smith brought this change]
9165
9166 openssh_fixture.c: Fix potential overwrite of buffer when reading stdout of command (#580)
9167
9168 File:
9169 openssh_fixture.c
9170 Notes:
9171 If reading the full output from the executed command took multiple
9172 passes (such as when reading multiple lines) the old code would read
9173 into the buffer starting at the some position (the start) every time.
9174 The old code only works if fgets updated p or had an offset parameter,
9175 both of which are not true.
9176
9177 Credit:
9178 Gabriel Smith
9179
9180 - [Gabriel Smith brought this change]
9181
9182 ci: explicitly state the default branch (#585)
9183
9184 Notes:
9185 It looks like the $default-branch macro only works in templates, not
9186 workflows. This is not explicitly stated anywhere except the linked PR
9187 comment.
9188
9189 https://github.com/actions/starter-workflows/pull/590#issuecomment-672360634
9190
9191 credit:
9192 Gabriel Smith
9193
9194 - [Gabriel Smith brought this change]
9195
9196 ci: Swap from Travis to Github Actions (#581)
9197
9198 Files: ci files
9199
9200 Notes:
9201 Move Linux CI using Github Actions
9202
9203 Credit:
9204 Gabriel Smith, Marc Hörsken
9205
9206 - [Mary brought this change]
9207
9208 libssh2_priv.h: add iovec on 3ds (#575)
9209
9210 file: libssh2_priv.h
9211 note: include iovec for 3DS
9212 credit: Mary Mstrodl
9213
9214 - [Laurent Stacul brought this change]
9215
9216 Tests: Fix unused variables warning (#561)
9217
9218 file: test_public_key_auth_succeeds_with_correct_ed25519_key_from_mem.c
9219
9220 notes: fixed unused vars
9221
9222 credit:
9223 Laurent Stacul
9224
9225 - [Viktor Szakats brought this change]
9226
9227 bcrypt_pbkdf.c: fix clang10 false positive warning (#563)
9228
9229 File: bcrypt_pbkdf.c
9230
9231 Notes:
9232 blf_enc() takes a number of 64-bit blocks to encrypt, but using
9233 sizeof(uint64_t) in the calculation triggers a warning with
9234 clang 10 because the actual data type is uint32_t. Pass
9235 BCRYPT_BLOCKS / 2 for the number of blocks like libc bcrypt(3)
9236 does.
9237
9238 Ref: https://github.com/openbsd/src/commit/04a2240bd8f465bcae6b595d912af3e2965856de
9239
9240 Fixes #562
9241
9242 Credit:
9243 Viktor Szakats
9244
9245 - [Will Cosgrove brought this change]
9246
9247 transport.c: release payload on error (#554)
9248
9249 file: transport.c
9250 notes: If the payload is invalid and there is an early return, we could leak the payload
9251 credit:
9252 Will Cosgrove
9253
9254 - [Will Cosgrove brought this change]
9255
9256 ssh2_client_fuzzer.cc: fixed building
9257
9258 The GitHub web editor did some funky things
9259
9260 - [Will Cosgrove brought this change]
9261
9262 ssh_client_fuzzer.cc: set blocking mode on (#553)
9263
9264 file: ssh_client_fuzzer.cc
9265
9266 notes: the session needs blocking mode turned on to avoid EAGAIN being returned from libssh2_session_handshake()
9267
9268 credit:
9269 Will Cosgrove, reviewed by Michael Buckley
9270
9271 - [Etienne Samson brought this change]
9272
9273 Add a LINT option to CMake (#372)
9274
9275 * ci: make style-checking available locally
9276
9277 * cmake: add a linting target
9278
9279 * tests: check test suite syntax with checksrc.pl
9280
9281 - [Will Cosgrove brought this change]
9282
9283 kex.c: kex_agree_instr() improve string reading (#552)
9284
9285 * kex.c: kex_agree_instr() improve string reading
9286
9287 file: kex.c
9288 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.
9289 credit:
9290 Will Cosgrove, reviewed by Michael Buckley
9291
9292 - [Will Cosgrove brought this change]
9293
9294 kex.c: use string_buf in ecdh_sha2_nistp (#551)
9295
9296 * kex.c: use string_buf in ecdh_sha2_nistp
9297
9298 file: kex.c
9299
9300 notes:
9301 use string_buf in ecdh_sha2_nistp() to avoid attempting to parse malformed data
9302
9303 - [Will Cosgrove brought this change]
9304
9305 kex.c: move EC macro outside of if check #549 (#550)
9306
9307 File: kex.c
9308
9309 Notes:
9310 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.
9311
9312 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.
9313
9314 Credit:
9315 Stefan-Ghinea
9316
9317 - [Tim Gates brought this change]
9318
9319 kex.c: fix simple typo, niumber -> number (#545)
9320
9321 File: kex.c
9322
9323 Notes:
9324 There is a small typo in src/kex.c.
9325
9326 Should read `number` rather than `niumber`.
9327
9328 Credit:
9329 Tim Gates
9330
9331 - [Tseng Jun brought this change]
9332
9333 session.c: Correct a typo which may lead to stack overflow (#533)
9334
9335 File: session.c
9336
9337 Notes:
9338 Seems the author intend to terminate banner_dup buffer, later, print it to the debug console.
9339
9340 Author:
9341 Tseng Jun
9342
9343 Marc Hoersken (10 Oct 2020)
9344 - wincng: fix random big number generation to match openssl
9345
9346 The old function would set the least significant bits in
9347 the most significant byte instead of the most significant bits.
9348
9349 The old function would also zero pad too much bits in the
9350 most significant byte. This lead to a reduction of key space
9351 in the most significant byte according to the following listing:
9352 - 8 bits reduced to 0 bits => eg. 2048 bits to 2040 bits DH key
9353 - 7 bits reduced to 1 bits => eg. 2047 bits to 2041 bits DH key
9354 - 6 bits reduced to 2 bits => eg. 2046 bits to 2042 bits DH key
9355 - 5 bits reduced to 3 bits => eg. 2045 bits to 2043 bits DH key
9356
9357 No change would occur for the case of 4 significant bits.
9358 For 1 to 3 significant bits in the most significant byte
9359 the DH key would actually be expanded instead of reduced:
9360 - 3 bits expanded to 5 bits => eg. 2043 bits to 2045 bits DH key
9361 - 2 bits expanded to 6 bits => eg. 2042 bits to 2046 bits DH key
9362 - 1 bits expanded to 7 bits => eg. 2041 bits to 2047 bits DH key
9363
9364 There is no case of 0 significant bits in the most significant byte
9365 since this would be a case of 8 significant bits in the next byte.
9366
9367 At the moment only the following case applies due to a fixed
9368 DH key size value currently being used in libssh2:
9369
9370 The DH group_order is fixed to 256 (bytes) which leads to a
9371 2047 bits DH key size by calculating (256 * 8) - 1.
9372
9373 This means the DH keyspace was previously reduced from 2047 bits
9374 to 2041 bits (while the top and bottom bits are always set), so the
9375 keyspace is actually always reduced from 2045 bits to 2039 bits.
9376
9377 All of this is only relevant for Windows versions supporting the
9378 WinCNG backend (Vista or newer) before Windows 10 version 1903.
9379
9380 Closes #521
9381
9382 Daniel Stenberg (28 Sep 2020)
9383 - libssh2_session_callback_set.3: explain the recv/send callbacks
9384
9385 Describe how to actually use these callbacks.
9386
9387 Closes #518
9388
9389 GitHub (23 Sep 2020)
9390 - [Will Cosgrove brought this change]
9391
9392 agent.c: formatting
9393
9394 Improved formatting of RECV_SEND_ALL macro.
9395
9396 - [Will Cosgrove brought this change]
9397
9398 CMakeLists.txt: respect install lib dir #405 (#515)
9399
9400 Files:
9401 CMakeLists.txt
9402
9403 Notes:
9404 Use CMAKE_INSTALL_LIBDIR directory
9405
9406 Credit: Arfrever
9407
9408 - [Will Cosgrove brought this change]
9409
9410 kex.c: group16-sha512 and group18-sha512 support #457 (#468)
9411
9412 Files: kex.c
9413
9414 Notes:
9415 Added key exchange group16-sha512 and group18-sha512. As a result did the following:
9416
9417 Abstracted diffie_hellman_sha256() to diffie_hellman_sha_algo() which is now algorithm agnostic and takes the algorithm as a parameter since we needed sha512 support. Unfortunately it required some helper functions but they are simple.
9418 Deleted diffie_hellman_sha1()
9419 Deleted diffie_hellman_sha1 specific macro
9420 Cleaned up some formatting
9421 Defined sha384 in os400 and wincng backends
9422 Defined LIBSSH2_DH_MAX_MODULUS_BITS to abort the connection if we receive too large of p from the server doing sha1 key exchange.
9423 Reorder the default key exchange list to match OpenSSH and improve security
9424
9425 Credit:
9426 Will Cosgrove
9427
9428 - [Igor Klevanets brought this change]
9429
9430 agent.c: Recv and send all bytes via network in agent_transact_unix() (#510)
9431
9432 Files: agent.c
9433
9434 Notes:
9435 Handle sending/receiving partial packet replies in agent.c API.
9436
9437 Credit: Klevanets Igor <[email protected]>
9438
9439 - [Daniel Stenberg brought this change]
9440
9441 Makefile.am: include all test files in the dist #379
9442
9443 File:
9444 Makefile.am
9445
9446 Notes:
9447 No longer conditionally include OpenSSL specific test files, they aren't run if we're not building against OpenSSL 1.1.x anyway.
9448
9449 Credit:
9450 Daniel Stenberg
9451
9452 - [Max Dymond brought this change]
9453
9454 Add support for an OSS Fuzzer fuzzing target (#392)
9455
9456 Files:
9457 .travis.yml, configure.ac, ossfuzz
9458
9459 Notes:
9460 This adds support for an OSS-Fuzz fuzzing target in ssh2_client_fuzzer,
9461 which is a cut down example of ssh2.c. Future enhancements can improve
9462 coverage.
9463
9464 Credit:
9465 Max Dymond
9466
9467 - [Sebastián Katzer brought this change]
9468
9469 mbedtls.c: ECDSA support for mbed TLS (#385)
9470
9471 Files:
9472 mbedtls.c, mbedtls.h, .travis.yml
9473
9474 Notes:
9475 This PR adds support for ECDSA for both key exchange and host key algorithms.
9476
9477 The following elliptic curves are supported:
9478
9479 256-bit curve defined by FIPS 186-4 and SEC1
9480 384-bit curve defined by FIPS 186-4 and SEC1
9481 521-bit curve defined by FIPS 186-4 and SEC1
9482
9483 Credit:
9484 Sebastián Katzer
9485
9486 Marc Hoersken (1 Sep 2020)
9487 - buildconf: exec autoreconf to avoid additional process (#512)
9488
9489 Also make buildconf exit with the return code of autoreconf.
9490
9491 Follow up to #224
9492
9493 - scp.c: fix indentation in shell_quotearg documentation
9494
9495 - wincng: make more use of new helper functions (#496)
9496
9497 - wincng: make sure algorithm providers are closed once (#496)
9498
9499 GitHub (10 Jul 2020)
9500 - [David Benjamin brought this change]
9501
9502 openssl.c: clean up curve25519 code (#499)
9503
9504 File: openssl.c, openssl.h, crypto.h, kex.c
9505
9506 Notes:
9507 This cleans up a few things in the curve25519 implementation:
9508
9509 - There is no need to create X509_PUBKEYs or PKCS8_PRIV_KEY_INFOs to
9510 extract key material. EVP_PKEY_get_raw_private_key and
9511 EVP_PKEY_get_raw_public_key work fine.
9512
9513 - libssh2_x25519_ctx was never used (and occasionally mis-typedefed to
9514 libssh2_ed25519_ctx). Remove it. The _libssh2_curve25519_new and
9515 _libssh2_curve25519_gen_k interfaces use the bytes. Note, if it needs
9516 to be added back, there is no need to roundtrip through
9517 EVP_PKEY_new_raw_private_key. EVP_PKEY_keygen already generated an
9518 EVP_PKEY.
9519
9520 - Add some missing error checks.
9521
9522 Credit:
9523 David Benjamin
9524
9525 - [Will Cosgrove brought this change]
9526
9527 transport.c: socket is disconnected, return error (#500)
9528
9529 File: transport.c
9530
9531 Notes:
9532 This is to fix #102, instead of continuing to attempt to read a disconnected socket, it will now error out.
9533
9534 Credit:
9535 TDi-jonesds
9536
9537 - [Will Cosgrove brought this change]
9538
9539 stale.yml
9540
9541 Increasing stale values.
9542
9543 Marc Hoersken (6 Jul 2020)
9544 - wincng: try newer DH API first, fallback to legacy RSA API
9545
9546 Avoid the use of RtlGetVersion or similar Win32 functions,
9547 since these depend on version information from manifests.
9548
9549 This commit makes the WinCNG backend first try to use the
9550 new DH algorithm API with the raw secret derivation feature.
9551 In case this feature is not available the WinCNG backend
9552 will fallback to the classic approach of using RSA-encrypt
9553 to perform the required modular exponentiation of BigNums.
9554
9555 The feature availability test is done during the first handshake
9556 and the result is stored in the crypto backends global state.
9557
9558 Follow up to #397
9559 Closes #484
9560
9561 - wincng: fix indentation of function arguments and comments
9562
9563 Follow up to #397
9564
9565 - [Wez Furlong brought this change]
9566
9567 wincng: use newer DH API for Windows 8.1+
9568
9569 Since Windows 1903 the approach used to perform DH kex with the CNG
9570 API has been failing.
9571
9572 This commit switches to using the `DH` algorithm provider to perform
9573 generation of the key pair and derivation of the shared secret.
9574
9575 It uses a feature of CNG that is not yet documented. The sources of
9576 information that I've found on this are:
9577
9578 * https://stackoverflow.com/a/56378698/149111
9579 * https://github.com/wbenny/mini-tor/blob/5d39011e632be8e2b6b1819ee7295e8bd9b7a769/mini/crypto/cng/dh.inl#L355
9580
9581 With this change I am able to successfully connect from Windows 10 to my
9582 ubuntu system.
9583
9584 Refs: https://github.com/alexcrichton/ssh2-rs/issues/122
9585 Fixes: https://github.com/libssh2/libssh2/issues/388
9586 Closes: https://github.com/libssh2/libssh2/pull/397
9587
9588 GitHub (1 Jul 2020)
9589 - [Zenju brought this change]
9590
9591 comp.c: Fix name clash with ZLIB macro "compress" (#418)
9592
9593 File: comp.c
9594
9595 Notes:
9596 * Fix name clash with ZLIB macro "compress".
9597
9598 Credit:
9599 Zenju
9600
9601 - [yann-morin-1998 brought this change]
9602
9603 buildsystem: drop custom buildconf script, rely on autoreconf (#224)
9604
9605 Notes:
9606 The buildconf script is currently required, because we need to copy a
9607 header around, because it is used both from the library and the examples
9608 sources.
9609
9610 However, having a custom 'buildconf'-like script is not needed if we can
9611 ensure that the header exists by the time it is needed. For that, we can
9612 just append the src/ directory to the headers search path for the
9613 examples.
9614
9615 And then it means we no longer need to generate the same header twice,
9616 so we remove the second one from configure.ac.
9617
9618 Now, we can just call "autoreconf -fi" to generate the autotools files,
9619 instead of relying on the canned sequence in "buildconf", since
9620 autoreconf has now long known what to do at the correct moment (future
9621 versions of autotools, automake, autopoint, autoheader etc... may
9622 require an other ordering, or other intermediate steps, etc...).
9623
9624 Eventually, get rid of buildconf now it is no longer needed. In fact, we
9625 really keep it for legacy, but have it just call autoreconf (and print a
9626 nice user-friendly warning). Don't include it in the release tarballs,
9627 though.
9628
9629 Update doc, gitignore, and travis-CI jobs accordingly.
9630
9631 Credit:
9632 Signed-off-by: "Yann E. MORIN" <[email protected]>
9633 Cc: Sam Voss <[email protected]>
9634
9635 - [Will Cosgrove brought this change]
9636
9637 libssh2.h: Update Diffie Hellman group values (#493)
9638
9639 File: libssh2.h
9640
9641 Notes:
9642 Update the min, preferred and max DH group values based on RFC 8270.
9643
9644 Credit:
9645 Will Cosgrove, noted from email list by Mitchell Holland
9646
9647 Marc Hoersken (22 Jun 2020)
9648 - travis: use existing Makefile target to run checksrc
9649
9650 - Makefile: also run checksrc on test source files
9651
9652 - tests: avoid use of deprecated function _sleep (#490)
9653
9654 - tests: avoid use of banned function strncat (#489)
9655
9656 - tests: satisfy checksrc regarding max line length of 79 chars
9657
9658 Follow up to 2764bc8e06d51876b6796d6080c6ac51e20f3332
9659
9660 - tests: satisfy checksrc with whitespace only fixes
9661
9662 checksrc.pl -i4 -m79 -ASIZEOFNOPAREN -ASNPRINTF
9663 -ACOPYRIGHT -AFOPENMODE tests/*.[ch]
9664
9665 - tests: add support for ports published via Docker for Windows
9666
9667 - tests: restore retry behaviour for docker-machine ip command
9668
9669 - tests: fix mix of declarations and code failing C89 compliance
9670
9671 - wincng: add and improve checks in bit counting function
9672
9673 - wincng: align bits to bytes calculation in all functions
9674
9675 - wincng: do not disable key validation that can be enabled
9676
9677 The modular exponentiation also works with key validation enabled.
9678
9679 - wincng: fix return value in _libssh2_dh_secret
9680
9681 Do not ignore return value of modular exponentiation.
9682
9683 - appveyor: build and run tests for WinCNG crypto backend
9684
9685 GitHub (1 Jun 2020)
9686 - [suryakalpo brought this change]
9687
9688 INSTALL_CMAKE.md: Update formatting (#481)
9689
9690 File: INSTALL_CMAKE.md
9691
9692 Notes:
9693 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.
9694
9695 credit:
9696 suryakalpo
9697
9698 Marc Hoersken (31 May 2020)
9699 - src: add new and align include guards in header files (#480)
9700
9701 Make sure all include guards exist and follow the same format.
9702
9703 - wincng: fix multiple definition of `_libssh2_wincng' (#479)
9704
9705 Add missing include guard and move global state
9706 from header to source file by using extern.
9707
9708 GitHub (28 May 2020)
9709 - [Will Cosgrove brought this change]
9710
9711 transport.c: moving total_num check from #476 (#478)
9712
9713 file: transport.c
9714
9715 notes:
9716 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.
9717
9718 credit:
9719 Will Cosgrove
9720
9721 - [lutianxiong brought this change]
9722
9723 transport.c: fix use-of-uninitialized-value (#476)
9724
9725 file:transport.c
9726
9727 notes:
9728 return error if malloc(0)
9729
9730 credit:
9731 lutianxiong
9732
9733 - [Dr. Koutheir Attouchi brought this change]
9734
9735 libssh2_sftp.h: Changed type of LIBSSH2_FX_* constants to unsigned long, fixes #474
9736
9737 File:
9738 libssh2_sftp.h
9739
9740 Notes:
9741 Error constants `LIBSSH2_FX_*` are only returned by `libssh2_sftp_last_error()` which returns `unsigned long`.
9742 Therefore these constants should be defined as unsigned long literals, instead of int literals.
9743
9744 Credit:
9745 Dr. Koutheir Attouchi
9746
9747 - [monnerat brought this change]
9748
9749 os400qc3.c: constify libssh2_os400qc3_hash_update() data parameter. (#469)
9750
9751 Files: os400qc3.c, os400qc3.h
9752
9753 Notes:
9754 Fixes building on OS400. #426
9755
9756 Credit:
9757 Reported-by: hjindra on github, dev by Monnerat
9758
9759 - [monnerat brought this change]
9760
9761 HACKING.CRYPTO: keep up to date with new crypto definitions from code. (#466)
9762
9763 File: HACKING.CRYPTO
9764
9765 Notes:
9766 This commit updates the HACKING.CRYPTO documentation file in an attempt to make it in sync with current code.
9767 New documented features are:
9768
9769 SHA384
9770 SHA512
9771 ECDSA
9772 ED25519
9773
9774 Credit:
9775 monnerat
9776
9777 - [Harry Sintonen brought this change]
9778
9779 kex.c: Add diffie-hellman-group14-sha256 Key Exchange Method (#464)
9780
9781 File: kex.c
9782
9783 Notes: Added diffie-hellman-group14-sha256 kex
9784
9785 Credit: Harry Sintonen <[email protected]>
9786
9787 - [Will Cosgrove brought this change]
9788
9789 os400qc3.h: define sha512 macros (#465)
9790
9791 file: os400qc3.h
9792 notes: fixes for building libssh2 1.9.x
9793
9794 - [Will Cosgrove brought this change]
9795
9796 os400qc3.h: define EC types to fix building #426 (#462)
9797
9798 File: os400qc3.h
9799 Notes: define missing EC types which prevents building
9800 Credit: hjindra
9801
9802 - [Brendan Shanks brought this change]
9803
9804 hostkey.c: Fix 'unsigned int'/'uint32_t' mismatch (#461)
9805
9806 File: hostkey.c
9807
9808 Notes:
9809 These types are the same size so most compilers are fine with it, but CodeWarrior (on classic MacOS) throws an ‘illegal implicit conversion’ error
9810
9811 Credit: Brendan Shanks
9812
9813 - [Thomas Klausner brought this change]
9814
9815 Makefile.am: Fix unportable test(1) operator. (#459)
9816
9817 file: Makefile.am
9818
9819 Notes:
9820 The POSIX comparison operator for test(1) is =; bash supports == but not even test from GNU coreutils does.
9821
9822 Credit:
9823 Thomas Klausner
9824
9825 - [Tseng Jun brought this change]
9826
9827 openssl.c: minor changes of coding style (#454)
9828
9829 File: openssl.c
9830
9831 Notes:
9832 minor changes of coding style and align preprocessor conditional for #439
9833
9834 Credit:
9835 Tseng Jun
9836
9837 - [Hans Meier brought this change]
9838
9839 openssl.c: Fix for use of uninitialized aes_ctr_cipher.key_len (#453)
9840
9841 File:
9842 Openssl.c
9843
9844 Notes:
9845 * Fix for use of uninitialized aes_ctr_cipher.key_len when using HAVE_OPAQUE_STRUCTS, regression from #439
9846
9847 Credit:
9848 Hans Meirer, Tseng Jun
9849
9850 - [Zenju brought this change]
9851
9852 agent.c: Fix Unicode builds on Windows (#417)
9853
9854 File: agent.c
9855
9856 Notes:
9857 Fixes unicode builds for Windows in Visual Studio 16.3.2.
9858
9859 Credit:
9860 Zenju
9861
9862 - [Hans Meier brought this change]
9863
9864 openssl.c: Fix use-after-free crash in openssl backend without memory leak (#439)
9865
9866 Files: openssl.c
9867
9868 Notes:
9869 Fixes memory leaks and use after free AES EVP_CIPHER contexts when using OpenSSL 1.0.x.
9870
9871 Credit:
9872 Hans Meier
9873
9874 - [Romain Geissler @ Amadeus brought this change]
9875
9876 Session.c: Fix undefined warning when mixing with LTO-enabled libcurl. (#449)
9877
9878 File: Session.c
9879
9880 Notes:
9881 With gcc 9, libssh2, libcurl and LTO enabled for all binaries I see this
9882 warning (error with -Werror):
9883
9884 vssh/libssh2.c: In function ‘ssh_statemach_act’:
9885 /data/mwrep/rgeissler/ospack/ssh2/BUILD/libssh2-libssh2-03c7c4a/src/session.c:579:9: error: ‘seconds_to_next’ is used uninitialized in this function [-Werror=uninitialized]
9886 579 | int seconds_to_next;
9887 | ^
9888 lto1: all warnings being treated as errors
9889
9890 Gcc normally issues -Wuninitialized when it is sure there is a problem,
9891 and -Wmaybe-uninitialized when it's not sure, but it's possible. Here
9892 the compiler seems to have find a real case where this could happen. I
9893 looked in your code and overall it seems you always check if the return
9894 code is non null, not often that it's below zero. I think we should do
9895 the same here. With this patch, gcc is fine.
9896
9897 Credit:
9898 Romain-Geissler-1A
9899
9900 - [Zenju brought this change]
9901
9902 transport.c: Fix crash with delayed compression (#443)
9903
9904 Files: transport.c
9905
9906 Notes:
9907 Fixes crash with delayed compression option using Bitvise server.
9908
9909 Contributor:
9910 Zenju
9911
9912 - [Will Cosgrove brought this change]
9913
9914 Update INSTALL_MAKE path to INSTALL_MAKE.md (#446)
9915
9916 Included for #429
9917
9918 - [Will Cosgrove brought this change]
9919
9920 Update INSTALL_CMAKE filename to INSTALL_CMAKE.md (#445)
9921
9922 Fixing for #429
9923
9924 - [Wallace Souza brought this change]
9925
9926 Rename INSTALL_CMAKE to INTALL_CMAKE.md (#429)
9927
9928 Adding Markdown file extension in order to Github render the instructions properly
9929
9930 Will Cosgrove (17 Dec 2019)
9931 - [Daniel Stenberg brought this change]
9932
9933 include/libssh2.h: fix comment: the known host key uses 4 bits (#438)
9934
9935 - [Zenju brought this change]
9936
9937 ssh-ed25519: Support PKIX + calc pubkey from private (#416)
9938
9939 Files: openssl.c/h
9940 Author: Zenju
9941 Notes:
9942 Adds support for PKIX key reading by fixing:
9943
9944 _libssh2_pub_priv_keyfile() is missing the code to extract the ed25519 public key from a given private key
9945
9946 _libssh2_ed25519_new_private_frommemory is only parsing the openssh key format but does not understand PKIX (as retrieved via PEM_read_bio_PrivateKey)
9947
9948 GitHub (15 Oct 2019)
9949 - [Will Cosgrove brought this change]
9950
9951 .travis.yml: Fix Chrome and 32 bit builds (#423)
9952
9953 File: .travis.yml
9954
9955 Notes:
9956 * Fix Chrome installing by using Travis build in directive
9957 * Update to use libgcrypt20-dev package to fix 32 bit builds based on comments found here:
9958 https://launchpad.net/ubuntu/xenial/i386/libgcrypt11-dev
9959
9960 - [Will Cosgrove brought this change]
9961
9962 packet.c: improved parsing in packet_x11_open (#410)
9963
9964 Use new API to parse data in packet_x11_open() for better bounds checking.
9965
9966 Will Cosgrove (12 Sep 2019)
9967 - [Michael Buckley brought this change]
9968
9969 knownhost.c: Double the static buffer size when reading and writing known hosts (#409)
9970
9971 Notes:
9972 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.
9973
9974 Credit:
9975 Michael Buckley
9976
9977 GitHub (4 Sep 2019)
9978 - [Will Cosgrove brought this change]
9979
9980 packet.c: improved packet parsing in packet_queue_listener (#404)
9981
9982 * improved bounds checking in packet_queue_listener
9983
9984 file: packet.c
9985
9986 notes:
9987 improved parsing packet in packet_queue_listener
9988
9989 - [Will Cosgrove brought this change]
9990
9991 packet.c: improve message parsing (#402)
9992
9993 * packet.c: improve parsing of packets
9994
9995 file: packet.c
9996
9997 notes:
9998 Use _libssh2_get_string API in SSH_MSG_DEBUG/SSH_MSG_DISCONNECT. Additional uint32 bounds check in SSH_MSG_GLOBAL_REQUEST.
9999
10000 - [Will Cosgrove brought this change]
10001
10002 misc.c: _libssh2_ntohu32 cast bit shifting (#401)
10003
10004 To quite overly aggressive analyzers.
10005
10006 Note, the builds pass, Travis is having some issues with Docker images.
10007
10008 - [Will Cosgrove brought this change]
10009
10010 kex.c: improve bounds checking in kex_agree_methods() (#399)
10011
10012 file: kex.c
10013
10014 notes:
10015 use _libssh2_get_string instead of kex_string_pair which does additional checks
10016
10017 Will Cosgrove (23 Aug 2019)
10018 - [Fabrice Fontaine brought this change]
10019
10020 acinclude.m4: add mbedtls to LIBS (#371)
10021
10022 Notes:
10023 This is useful for static builds so that the Libs.private field in
10024 libssh2.pc contains correct info for the benefit of pkg-config users.
10025 Static link with libssh2 requires this information.
10026
10027 Signed-off-by: Baruch Siach <[email protected]>
10028 [Retrieved from:
10029 https://git.buildroot.net/buildroot/tree/package/libssh2/0002-acinclude.m4-add-mbedtls-to-LIBS.patch]
10030 Signed-off-by: Fabrice Fontaine <[email protected]>
10031
10032 Credit:
10033 Fabrice Fontaine
10034
10035 - [jethrogb brought this change]
10036
10037 Generate debug info when building with MSVC (#178)
10038
10039 files: CMakeLists.txt
10040
10041 notes: Generate debug info when building with MSVC
10042
10043 credit:
10044 jethrogb
10045
10046 - [Panos brought this change]
10047
10048 Add agent forwarding implementation (#219)
10049
10050 files: channel.c, test_agent_forward_succeeds.c, libssh2_priv.h, libssh2.h, ssh2_agent_forwarding.c
10051
10052 notes:
10053 * Adding SSH agent forwarding.
10054 * Fix agent forwarding message, updated example.
10055 Added integration test code and cmake target. Added example to cmake list.
10056
10057 credit:
10058 pkittenis
10059
10060 GitHub (2 Aug 2019)
10061 - [Will Cosgrove brought this change]
10062
10063 Update EditorConfig
10064
10065 Added max_line_length = 80
10066
10067 - [Will Cosgrove brought this change]
10068
10069 global.c : fixed call to libssh2_crypto_exit #394 (#396)
10070
10071 * global.c : fixed call to libssh2_crypto_exit #394
10072
10073 File: global.c
10074
10075 Notes: Don't call `libssh2_crypto_exit()` until `_libssh2_initialized` count is down to zero.
10076
10077 Credit: seba30
10078
10079 Will Cosgrove (30 Jul 2019)
10080 - [hlefebvre brought this change]
10081
10082 misc.c : Add an EWOULDBLOCK check for better portability (#172)
10083
10084 File: misc.c
10085
10086 Notes: Added support for all OS' that implement EWOULDBLOCK, not only VMS
10087
10088 Credit: hlefebvre
10089
10090 - [Etienne Samson brought this change]
10091
10092 userauth.c: fix off by one error when loading public keys with no id (#386)
10093
10094 File: userauth.c
10095
10096 Credit:
10097 Etienne Samson
10098
10099 Notes:
10100 Caught by ASAN:
10101
10102 =================================================================
10103 ==73797==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x60700001bcf0 at pc 0x00010026198d bp 0x7ffeefbfed30 sp 0x7ffeefbfe4d8
10104 READ of size 69 at 0x60700001bcf0 thread T0
10105 2019-07-04 08:35:30.292502+0200 atos[73890:2639175] examining /Users/USER/*/libssh2_clar [73797]
10106 #0 0x10026198c in wrap_memchr (libclang_rt.asan_osx_dynamic.dylib:x86_64h+0x1f98c)
10107 #1 0x1000f8e66 in file_read_publickey userauth.c:633
10108 #2 0x1000f2dc9 in userauth_publickey_fromfile userauth.c:1513
10109 #3 0x1000f2948 in libssh2_userauth_publickey_fromfile_ex userauth.c:1590
10110 #4 0x10000e254 in test_userauth_publickey__ed25519_auth_ok publickey.c:69
10111 #5 0x1000090c3 in clar_run_test clar.c:260
10112 #6 0x1000038f3 in clar_run_suite clar.c:343
10113 #7 0x100003272 in clar_test_run clar.c:522
10114 #8 0x10000c3cc in main runner.c:60
10115 #9 0x7fff5b43b3d4 in start (libdyld.dylib:x86_64+0x163d4)
10116
10117 0x60700001bcf0 is located 0 bytes to the right of 80-byte region [0x60700001bca0,0x60700001bcf0)
10118 allocated by thread T0 here:
10119 #0 0x10029e053 in wrap_malloc (libclang_rt.asan_osx_dynamic.dylib:x86_64h+0x5c053)
10120 #1 0x1000b4978 in libssh2_default_alloc session.c:67
10121 #2 0x1000f8aba in file_read_publickey userauth.c:597
10122 #3 0x1000f2dc9 in userauth_publickey_fromfile userauth.c:1513
10123 #4 0x1000f2948 in libssh2_userauth_publickey_fromfile_ex userauth.c:1590
10124 #5 0x10000e254 in test_userauth_publickey__ed25519_auth_ok publickey.c:69
10125 #6 0x1000090c3 in clar_run_test clar.c:260
10126 #7 0x1000038f3 in clar_run_suite clar.c:343
10127 #8 0x100003272 in clar_test_run clar.c:522
10128 #9 0x10000c3cc in main runner.c:60
10129 #10 0x7fff5b43b3d4 in start (libdyld.dylib:x86_64+0x163d4)
10130
10131 SUMMARY: AddressSanitizer: heap-buffer-overflow (libclang_rt.asan_osx_dynamic.dylib:x86_64h+0x1f98c) in wrap_memchr
10132 Shadow bytes around the buggy address:
10133 0x1c0e00003740: fd fd fd fd fd fd fd fd fd fd fa fa fa fa fd fd
10134 0x1c0e00003750: fd fd fd fd fd fd fd fa fa fa fa fa 00 00 00 00
10135 0x1c0e00003760: 00 00 00 00 00 00 fa fa fa fa 00 00 00 00 00 00
10136 0x1c0e00003770: 00 00 00 fa fa fa fa fa fd fd fd fd fd fd fd fd
10137 0x1c0e00003780: fd fd fa fa fa fa fd fd fd fd fd fd fd fd fd fa
10138 =>0x1c0e00003790: fa fa fa fa 00 00 00 00 00 00 00 00 00 00[fa]fa
10139 0x1c0e000037a0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
10140 0x1c0e000037b0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
10141 0x1c0e000037c0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
10142 0x1c0e000037d0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
10143 0x1c0e000037e0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
10144 Shadow byte legend (one shadow byte represents 8 application bytes):
10145 Addressable: 00
10146 Partially addressable: 01 02 03 04 05 06 07
10147 Heap left redzone: fa
10148 Freed heap region: fd
10149 Stack left redzone: f1
10150 Stack mid redzone: f2
10151 Stack right redzone: f3
10152 Stack after return: f5
10153 Stack use after scope: f8
10154 Global redzone: f9
10155 Global init order: f6
10156 Poisoned by user: f7
10157 Container overflow: fc
10158 Array cookie: ac
10159 Intra object redzone: bb
10160 ASan internal: fe
10161 Left alloca redzone: ca
10162 Right alloca redzone: cb
10163 Shadow gap: cc
10164
10165 - [Thilo Schulz brought this change]
10166
10167 openssl.c : Fix use-after-free crash on reinitialization of openssl backend
10168
10169 file : openssl.c
10170
10171 notes :
10172 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
10173
10174 credit : Thilo Schulz
10175
10176 - [axjowa brought this change]
10177
10178 openssl.h : Use of ifdef where if should be used (#389)
10179
10180 File : openssl.h
10181
10182 Notes :
10183 LIBSSH2_ECDSA and LIBSSH2_ED25519 are always defined so the #ifdef
10184 checks would never be false.
10185
10186 This change makes it possible to build libssh2 against OpenSSL built
10187 without EC support.
10188
10189 Change-Id: I0a2f07c2d80178314dcb7d505d1295d19cf15afd
10190
10191 Credit : axjowa
10192
10193 - [Zenju brought this change]
10194
10195 Agent.c : Preserve error info from agent_list_identities() (#374)
10196
10197 Files : agent.c
10198
10199 Notes :
10200 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).
10201
10202 Credit :
10203 Zenju
10204
10205 - [Who? Me?! brought this change]
10206
10207 Channel.c: Make sure the error code is set in _libssh2_channel_open() (#381)
10208
10209 File : Channel.c
10210
10211 Notes :
10212 if _libssh2_channel_open() fails, set the error code.
10213
10214 Credit :
10215 mark-i-m
10216
10217 - [Orgad Shaneh brought this change]
10218
10219 Kex.c, Remove unneeded call to strlen (#373)
10220
10221 File : Kex.c
10222
10223 Notes :
10224 Removed call to strlen
10225
10226 Credit :
10227 Orgad Shaneh
10228
10229 - [Pedro Monreal brought this change]
10230
10231 Spelling corrections (#380)
10232
10233 Files :
10234 libssh2.h, libssh2_sftp.h, bcrypt_pbkdf.c, mbedtls.c, sftp.c, ssh2.c
10235
10236 Notes :
10237 * Fixed misspellings
10238
10239 Credit :
10240 Pedro Monreal
10241
10242 - [Sebastián Katzer brought this change]
10243
10244 Fix Potential typecast error for `_libssh2_ecdsa_key_get_curve_type` (#383)
10245
10246 Issue : #383
10247
10248 Files : hostkey.c, crypto.h, openssl.c
10249
10250 Notes :
10251 * Fix potential typecast error for `_libssh2_ecdsa_key_get_curve_type`
10252 * Rename _libssh2_ecdsa_key_get_curve_type to _libssh2_ecdsa_get_curve_type
10253
10254 Credit :
10255 Sebastián Katzer
10256
10257 GitHub (20 Jun 2019)
10258 - [Will Cosgrove brought this change]
10259
10260 bump copyright date
10261
10262 Version 1.9.0 (19 Jun 2019)
10263
10264 GitHub (19 Jun 2019)
10265 - [Will Cosgrove brought this change]
10266
10267 1.9 Formatting
10268
10269 - [Will Cosgrove brought this change]
10270
10271 1.9 Release notes
10272
10273 Will Cosgrove (17 May 2019)
10274 - [Alexander Curtiss brought this change]
10275
10276 libgcrypt.c : Fixed _libssh2_rsa_sha1_sign memory leak. (#370)
10277
10278 File: libgcrypt.c
10279
10280 Notes : Added calls to gcry_sexp_release to free memory allocated by gcry_sexp_find_token
10281
10282 Credit :
10283 Reporter : beckmi
10284 PR by: Alexander Curtiss
10285
10286 - [Orivej Desh brought this change]
10287
10288 libssh2_priv.h : Fix musl build warning on sys/poll.h (#346)
10289
10290 File : libssh2_priv.h
10291
10292 Notes :
10293 musl prints `redirecting incorrect #include <sys/poll.h> to <poll.h>`
10294 http://git.musl-libc.org/cgit/musl/commit/include/sys/poll.h?id=54446d730cfb17c5f7bcf57f139458678f5066cc
10295
10296 poll is defined by POSIX to be in poll.h:
10297 http://pubs.opengroup.org/onlinepubs/7908799/xsh/poll.html
10298
10299 Credit : Orivej Desh
10300
10301 GitHub (1 May 2019)
10302 - [Will Cosgrove brought this change]
10303
10304 kex.c : additional bounds checks in diffie_hellman_sha1/256 (#361)
10305
10306 Files : kex.c, misc.c, misc.h
10307
10308 Notes :
10309 Fixed possible out of bounds memory access when reading malformed data in diffie_hellman_sha1() and diffie_hellman_sha256().
10310
10311 Added _libssh2_copy_string() to misc.c to return an allocated and filled char buffer from a string_buf offset. Removed no longer needed s var in kmdhgGPshakex_state_t.
10312
10313 Will Cosgrove (26 Apr 2019)
10314 - [Tseng Jun brought this change]
10315
10316 sftp.c : sftp_bin2attr() Correct attrs->gid assignment (#366)
10317
10318 Regression with fix for #339
10319
10320 Credit : Tseng Jun
10321
10322 - [Tseng Jun brought this change]
10323
10324 kex.c : Correct type cast in curve25519_sha256() (#365)
10325
10326 GitHub (24 Apr 2019)
10327 - [Will Cosgrove brought this change]
10328
10329 transport.c : scope local total_num var (#364)
10330
10331 file : transport.c
10332 notes : move local `total_num` variable inside of if block to prevent scope access issues which caused #360.
10333
10334 Will Cosgrove (24 Apr 2019)
10335 - [doublex brought this change]
10336
10337 transport.c : fixes bounds check if partial packet is read
10338
10339 Files : transport.c
10340
10341 Issue : #360
10342
10343 Notes :
10344 'p->total_num' instead of local value total_num when doing bounds check.
10345
10346 Credit : Doublex
10347
10348 GitHub (23 Apr 2019)
10349 - [Will Cosgrove brought this change]
10350
10351 Editor config file for source files (#322)
10352
10353 Simple start to an editor config file when editing source files to make sure they are configured correctly.
10354
10355 - [Will Cosgrove brought this change]
10356
10357 misc.c : String buffer API improvements (#332)
10358
10359 Files : misc.c, hostkey.c, kex.c, misc.h, openssl.c, sftp.c
10360
10361 Notes :
10362 * 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.
10363
10364 _libssh2_check_length now returns 0 on success and -1 on failure to match the other string_buf functions. Added comment to _libssh2_check_length.
10365
10366 Credit : Will Cosgrove
10367
10368 Will Cosgrove (19 Apr 2019)
10369 - [doublex brought this change]
10370
10371 mbedtls.c : _libssh2_mbedtls_rsa_new_private_frommemory() allow private-key from memory (#359)
10372
10373 File : mbedtls.c
10374
10375 Notes: _libssh2_mbedtls_rsa_new_private_frommemory() fixes private-key from memory reading to by adding NULL terminator before parsing; adds passphrase support.
10376
10377 Credit: doublex
10378
10379 - [Ryan Kelley brought this change]
10380
10381 Session.c : banner_receive() from leaking when accessing non ssh ports (#356)
10382
10383 File : session.c
10384
10385 Release previous banner in banner_receive() if the session is reused after a failed connection.
10386
10387 Credit : Ryan Kelley
10388
10389 GitHub (11 Apr 2019)
10390 - [Will Cosgrove brought this change]
10391
10392 Formatting in agent.c
10393
10394 Removed whitespace.
10395
10396 - [Will Cosgrove brought this change]
10397
10398 Fixed formatting in agent.c
10399
10400 Quiet linter around a couple if blocks and pointer.
10401
10402 Will Cosgrove (11 Apr 2019)
10403 - [Zhen-Huan HWANG brought this change]
10404
10405 sftp.c : discard and reset oversized packet in sftp_packet_read() (#269)
10406
10407 file : sftp.c
10408
10409 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.
10410
10411 credit : Zhen-Huan HWANG
10412
10413 GitHub (11 Apr 2019)
10414 - [Will Cosgrove brought this change]
10415
10416 Add agent functions libssh2_agent_get_identity_path() and libssh2_agent_set_identity_path() (#308)
10417
10418 File : agent.c
10419
10420 Notes :
10421 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.
10422
10423 - [Will Cosgrove brought this change]
10424
10425 Simplified _libssh2_check_length (#350)
10426
10427 * Simplified _libssh2_check_length
10428
10429 misc.c : _libssh2_check_length()
10430
10431 Removed cast and improved bounds checking and format.
10432
10433 Credit : Yuriy M. Kaminskiy
10434
10435 - [Will Cosgrove brought this change]
10436
10437 _libssh2_check_length() : additional bounds check (#348)
10438
10439 Misc.c : _libssh2_check_length()
10440
10441 Ensure the requested length is less than the total length before doing the additional bounds check
10442
10443 Daniel Stenberg (25 Mar 2019)
10444 - misc: remove 'offset' from string_buf
10445
10446 It isn't necessary.
10447
10448 Closes #343
10449
10450 - sftp: repair mtime from e1ead35e475
10451
10452 A regression from e1ead35e4759 broke the SFTP mtime logic in
10453 sftp_bin2attr
10454
10455 Also simplified the _libssh2_get_u32/u64 functions slightly.
10456
10457 Closes #342
10458
10459 - session_disconnect: don't zero state, just clear the right bit
10460
10461 If we clear the entire field, the freeing of data in session_free() is
10462 skipped. Instead just clear the bit that risk making the code get stuck
10463 in the transport functions.
10464
10465 Regression from 4d66f6762ca3fc45d9.
10466
10467 Reported-by: dimmaq on github
10468 Fixes #338
10469 Closes #340
10470
10471 - libssh2_sftp.h: restore broken ABI
10472
10473 Commit 41fbd44 changed variable sizes/types in a public struct which
10474 broke the ABI, which breaks applications!
10475
10476 This reverts that change.
10477
10478 Closes #339
10479
10480 - style: make includes and examples code style strict
10481
10482 make travis and the makefile rule verify them too
10483
10484 Closes #334
10485
10486 GitHub (21 Mar 2019)
10487 - [Daniel Stenberg brought this change]
10488
10489 create a github issue template
10490
10491 Daniel Stenberg (21 Mar 2019)
10492 - stale-bot: activated
10493
10494 The stale bot will automatically mark stale issues (inactive for 90
10495 days) and if still untouched after 21 more days, close them.
10496
10497 See https://probot.github.io/apps/stale/
10498
10499 - libssh2_session_supported_algs.3: fix formatting mistakes
10500
10501 Reported-by: Max Horn
10502 Fixes #57
10503
10504 - [Zenju brought this change]
10505
10506 libssh2.h: Fix Error C2371 'ssize_t': redefinition
10507
10508 Closes #331
10509
10510 - travis: add code style check
10511
10512 Closes #324
10513
10514 - code style: unify code style
10515
10516 Indent-level: 4
10517 Max columns: 79
10518 No spaces after if/for/while
10519 Unified brace positions
10520 Unified white spaces
10521
10522 - src/checksrc.pl: code style checker
10523
10524 imported as-is from curl
10525
10526 Will Cosgrove (19 Mar 2019)
10527 - Merge branch 'MichaelBuckley-michaelbuckley-security-fixes'
10528
10529 - Silence unused var warnings (#329)
10530
10531 Silence warnings about unused variables in this test
10532
10533 - Removed unneeded > 0 check
10534
10535 When checking `userauth_kybd_num_prompts > 100` we don't care if it's also above zero.
10536
10537 - [Matthew D. Fuller brought this change]
10538
10539 Spell OpenSS_H_ right when talking about their specific private key (#321)
10540
10541 Good catch, thanks.
10542
10543 GitHub (19 Mar 2019)
10544 - [Will Cosgrove brought this change]
10545
10546 Silence unused var warnings (#329)
10547
10548 Silence warnings about unused variables in this test
10549
10550 Michael Buckley (19 Mar 2019)
10551 - Fix more scope and printf warning errors
10552
10553 - Silence unused variable warning
10554
10555 GitHub (19 Mar 2019)
10556 - [Will Cosgrove brought this change]
10557
10558 Removed unneeded > 0 check
10559
10560 When checking `userauth_kybd_num_prompts > 100` we don't care if it's also above zero.
10561
10562 Will Cosgrove (19 Mar 2019)
10563 - [Matthew D. Fuller brought this change]
10564
10565 Spell OpenSS_H_ right when talking about their specific private key (#321)
10566
10567 Good catch, thanks.
10568
10569 Michael Buckley (18 Mar 2019)
10570 - Fix errors identified by the build process
10571
10572 - Fix casting errors after merge
10573
10574 GitHub (18 Mar 2019)
10575 - [Michael Buckley brought this change]
10576
10577 Merge branch 'master' into michaelbuckley-security-fixes
10578
10579 Michael Buckley (18 Mar 2019)
10580 - Move fallback SIZE_MAX and UINT_MAX to libssh2_priv.h
10581
10582 - Fix type and logic issues with _libssh2_get_u64
10583
10584 Daniel Stenberg (17 Mar 2019)
10585 - examples: fix various compiler warnings
10586
10587 - lib: fix various compiler warnings
10588
10589 - session: ignore pedantic warnings for funcpointer <=> void *
10590
10591 - travis: add a build using configure
10592
10593 Closes #320
10594
10595 - configure: provide --enable-werror
10596
10597 - appveyor: remove old builds that mostly cause failures
10598
10599 ... and only run on master branch.
10600
10601 Closes #323
10602
10603 - cmake: add two missing man pages to get installed too
10604
10605 Both libssh2_session_handshake.3 and
10606 libssh2_userauth_publickey_frommemory.3 were installed by the configure
10607 build already.
10608
10609 Reported-by: Arfrever on github
10610 Fixes #278
10611
10612 - include/libssh2.h: warning: "_WIN64" is not defined, evaluates to 0
10613
10614 We don't use #if for defines that might not be defined.
10615
10616 - pem: //-comments are not allowed
10617
10618 Will Cosgrove (14 Mar 2019)
10619 - [Daniel Stenberg brought this change]
10620
10621 userauth: fix "Function call argument is an uninitialized value" (#318)
10622
10623 Detected by scan-build.
10624
10625 - fixed unsigned/signed issue
10626
10627 Daniel Stenberg (15 Mar 2019)
10628 - session_disconnect: clear state
10629
10630 If authentication is started but not completed before the application
10631 gives up and instead wants to shut down the session, the '->state' field
10632 might still be set and thus effectively dead-lock session_disconnect.
10633
10634 This happens because both _libssh2_transport_send() and
10635 _libssh2_transport_read() refuse to do anything as long as state is set
10636 without the LIBSSH2_STATE_KEX_ACTIVE bit.
10637
10638 Reported in curl bug https://github.com/curl/curl/issues/3650
10639
10640 Closes #310
10641
10642 Will Cosgrove (14 Mar 2019)
10643 - Release notes from 1.8.1
10644
10645 Michael Buckley (14 Mar 2019)
10646 - Use string_buf in sftp_init().
10647
10648 - Guard against out-of-bounds reads in publickey.c
10649
10650 - Guard against out-of-bounds reads in session.c
10651
10652 - Guard against out-of-bounds reads in userauth.c
10653
10654 - Use LIBSSH2_ERROR_BUFFER_TOO_SMALL instead of LIBSSH2_ERROR_OUT_OF_BOUNDARY in sftp.c
10655
10656 - Additional bounds checking in sftp.c
10657
10658 - Additional length checks to prevent out-of-bounds reads and writes in _libssh2_packet_add(). https://libssh2.org/CVE-2019-3862.html
10659
10660 - Add a required_size parameter to sftp_packet_require et. al. to require callers of these functions to handle packets that are too short. https://libssh2.org/CVE-2019-3860.html
10661
10662 - Check the length of data passed to sftp_packet_add() to prevent out-of-bounds reads.
10663
10664 - Prevent zero-byte allocation in sftp_packet_read() which could lead to an out-of-bounds read. https://libssh2.org/CVE-2019-3858.html
10665
10666 - Sanitize padding_length - _libssh2_transport_read(). https://libssh2.org/CVE-2019-3861.html
10667
10668 This prevents an underflow resulting in a potential out-of-bounds read if a server sends a too-large padding_length, possibly with malicious intent.
10669
10670 - Defend against writing beyond the end of the payload in _libssh2_transport_read().
10671
10672 - Defend against possible integer overflows in comp_method_zlib_decomp.
10673
10674 GitHub (14 Mar 2019)
10675 - [Will Cosgrove brought this change]
10676
10677 Security fixes (#315)
10678
10679 * Bounds checks
10680
10681 Fixes for CVEs
10682 https://www.libssh2.org/CVE-2019-3863.html
10683 https://www.libssh2.org/CVE-2019-3856.html
10684
10685 * Packet length bounds check
10686
10687 CVE
10688 https://www.libssh2.org/CVE-2019-3855.html
10689
10690 * Response length check
10691
10692 CVE
10693 https://www.libssh2.org/CVE-2019-3859.html
10694
10695 * Bounds check
10696
10697 CVE
10698 https://www.libssh2.org/CVE-2019-3857.html
10699
10700 * Bounds checking
10701
10702 CVE
10703 https://www.libssh2.org/CVE-2019-3859.html
10704
10705 and additional data validation
10706
10707 * Check bounds before reading into buffers
10708
10709 * Bounds checking
10710
10711 CVE
10712 https://www.libssh2.org/CVE-2019-3859.html
10713
10714 * declare SIZE_MAX and UINT_MAX if needed
10715
10716 - [Will Cosgrove brought this change]
10717
10718 fixed type warnings (#309)
10719
10720 - [Will Cosgrove brought this change]
10721
10722 Bumping version number for pending 1.8.1 release
10723
10724 Will Cosgrove (4 Mar 2019)
10725 - [Daniel Stenberg brought this change]
10726
10727 _libssh2_string_buf_free: use correct free (#304)
10728
10729 Use LIBSSH2_FREE() here, not free(). We allow memory function
10730 replacements so free() is rarely the right choice...
10731
10732 GitHub (26 Feb 2019)
10733 - [Will Cosgrove brought this change]
10734
10735 Fix for building against libreSSL #302
10736
10737 Changed to use the check we use elsewhere.
10738
10739 - [Will Cosgrove brought this change]
10740
10741 Fix for when building against LibreSSL #302
10742
10743 Will Cosgrove (25 Feb 2019)
10744 - [gartens brought this change]
10745
10746 docs: update libssh2_hostkey_hash.3 [ci skip] (#301)
10747
10748 GitHub (21 Feb 2019)
10749 - [Will Cosgrove brought this change]
10750
10751 fix malloc/free mismatches #296 (#297)
10752
10753 - [Will Cosgrove brought this change]
10754
10755 Replaced malloc with calloc #295
10756
10757 - [Will Cosgrove brought this change]
10758
10759 Abstracted OpenSSL calls out of hostkey.c (#294)
10760
10761 - [Will Cosgrove brought this change]
10762
10763 Fix memory dealloc impedance mis-match #292 (#293)
10764
10765 When using ed25519 host keys and a custom memory allocator.
10766
10767 - [Will Cosgrove brought this change]
10768
10769 Added call to OpenSSL_add_all_digests() #288
10770
10771 For OpenSSL 1.0.x we need to call OpenSSL_add_all_digests().
10772
10773 Will Cosgrove (12 Feb 2019)
10774 - [Zhen-Huan HWANG brought this change]
10775
10776 SFTP: increase maximum packet size to 256K (#268)
10777
10778 to match implementations like OpenSSH.
10779
10780 - [Zenju brought this change]
10781
10782 Fix https://github.com/libssh2/libssh2/pull/271 (#284)
10783
10784 GitHub (16 Jan 2019)
10785 - [Will Cosgrove brought this change]
10786
10787 Agent NULL check in shutdown #281
10788
10789 Will Cosgrove (15 Jan 2019)
10790 - [Adrian Moran brought this change]
10791
10792 mbedtls: Fix leak of 12 bytes by each key exchange. (#280)
10793
10794 Correctly free ducts by calling _libssh2_mbedtls_bignum_free() in dtor.
10795
10796 - [alex-weaver brought this change]
10797
10798 Fix error compiling on Win32 with STDCALL=ON (#275)
10799
10800 GitHub (8 Nov 2018)
10801 - [Will Cosgrove brought this change]
10802
10803 Allow default permissions to be used in sftp_mkdir (#271)
10804
10805 Added constant LIBSSH2_SFTP_DEFAULT_MODE to use the server default permissions when making a new directory
10806
10807 Will Cosgrove (13 Sep 2018)
10808 - [Giulio Benetti brought this change]
10809
10810 openssl: fix dereferencing ambiguity potentially causing build failure (#267)
10811
10812 When dereferencing from *aes_ctr_cipher, being a pointer itself,
10813 ambiguity can occur; fixed possible build errors.
10814
10815 Viktor Szakats (12 Sep 2018)
10816 - win32/GNUmakefile: define HAVE_WINDOWS_H
10817
10818 This macro was only used in test/example code before, now it is
10819 also used in library code, but only defined automatically by
10820 automake/cmake, so let's do the same for the standalone win32
10821 make file.
10822
10823 It'd be probably better to just rely on the built-in _WIN32 macro
10824 to detect the presence of windows.h though. It's already used
10825 in most of libssh2 library code. There is a 3rd, similar macro
10826 named LIBSSH2_WIN32, which might also be replaced with _WIN32.
10827
10828 Ref: https://github.com/libssh2/libssh2/commit/8b870ad771cbd9cd29edbb3dbb0878e950f868ab
10829 Closes https://github.com/libssh2/libssh2/pull/266
10830
10831 Marc Hoersken (2 Sep 2018)
10832 - Fix conditional check for HAVE_DECL_SECUREZEROMEMORY
10833
10834 "Unlike the other `AC_CHECK_*S' macros, when a symbol is not declared,
10835 HAVE_DECL_symbol is defined to `0' instead of leaving HAVE_DECL_symbol
10836 undeclared. When you are sure that the check was performed,
10837 use HAVE_DECL_symbol in #if."
10838
10839 Source: autoconf documentation for AC_CHECK_DECLS.
10840
10841 - Fix implicit declaration of function 'SecureZeroMemory'
10842
10843 Include window.h in order to use SecureZeroMemory on Windows.
10844
10845 - Fix implicit declaration of function 'free' by including stdlib.h
10846
10847 GitHub (27 Aug 2018)
10848 - [Will Cosgrove brought this change]
10849
10850 Use malloc abstraction function in pem parse
10851
10852 Fix warning on WinCNG build.
10853
10854 - [Will Cosgrove brought this change]
10855
10856 Fixed possible junk memory read in sftp_stat #258
10857
10858 - [Will Cosgrove brought this change]
10859
10860 removed INT64_C define (#260)
10861
10862 No longer used.
10863
10864 - [Will Cosgrove brought this change]
10865
10866 Added conditional around engine.h include
10867
10868 Will Cosgrove (6 Aug 2018)
10869 - [Alex Crichton brought this change]
10870
10871 Fix OpenSSL link error with `no-engine` support (#259)
10872
10873 This commit fixes linking against an OpenSSL library that was compiled with
10874 `no-engine` support by bypassing the initialization routines as they won't be
10875 available anyway.
10876
10877 GitHub (2 Aug 2018)
10878 - [Will Cosgrove brought this change]
10879
10880 ED25519 Key Support #39 (#248)
10881
10882 OpenSSH Key and ED25519 support #39
10883 Added _libssh2_explicit_zero() to explicitly zero sensitive data in memory #120
10884
10885 * ED25519 Key file support - Requires OpenSSL 1.1.1 or later
10886 * OpenSSH Key format reading support - Supports RSA/DSA/ECDSA/ED25519 types
10887 * New string buffer reading functions - These add build-in bounds checking and convenance methods. Used for OpenSSL PEM file reading.
10888 * Added new tests for OpenSSH formatted Keys
10889
10890 - [Will Cosgrove brought this change]
10891
10892 ECDSA key types are now explicit (#251)
10893
10894 * ECDSA key types are now explicit
10895
10896 Issue was brough up in pull request #248