Commit graph

1344 commits

Author SHA1 Message Date
Viktor Szakats
066478f634
src: add curlx_memzero() to clear buffers securely
To safely zero memory, introduce `curlx_memzero()`, and map it to
`memset_s()` (C11) or `memset_explicit()` (C23) if auto-detected, or
`explicit_bzero()` or `explicit_memset()` for platforms opted-in, or
fall back to a local workaround if all unavailable. On Windows, always
use `SecureZeroMemory()`, or `SecureZeroMemory2()` with Visual Studio
and Windows SDK 10.0.26100.0+.

Details above are experimental and may change if they cause issues.

Also add macros/functions that zero memory before freeing a buffer:
- `curlx_safefreezero()`: for buffers with size.
- `curlx_safefreezeroz()`: for null-terminated buffers.
- `curlx_freezero()`: for buffers with size.
- `curlx_freezeroz()`: for null-terminated buffers.

`curlx_memzero()` must not be passed a NULL pointer because in some
implementations it is undefined behavior.

Also:
- curl_sha512_256: Replace hard-wired `explicit_memset()` call with new
  `curlx_memzero()`.

Refs:
https://en.cppreference.com/c/string/byte/memset
https://man7.org/linux/man-pages/man3/explicit_bzero.3.html
https://man.freebsd.org/cgi/man.cgi?query=explicit_bzero
https://man.netbsd.org/NetBSD-7.2/explicit_memset.3
https://learn.microsoft.com/previous-versions/windows/desktop/legacy/aa366877(v=vs.85)
https://learn.microsoft.com/windows/win32/memory/winbase-securezeromemory2
https://learn.microsoft.com/cpp/overview/compiler-versions
https://learn.microsoft.com/windows/apps/windows-sdk/downloads
https://jtsoya539.github.io/windows-sdk-versions/

Credits-to: Daniel Gustafsson
Credits-to: Will Cosgrove and co-authors in libssh2
Ref: #13589 (original attempt)
Ref: #21588

Closes #21598
2026-05-16 00:26:46 +02:00
Viktor Szakats
eb9b253d66
libssh: add support for SHA256 host public keys
Reported-by: Joshua Rogers
Fixes #21605

Closes #21607
2026-05-15 11:49:06 +02:00
Viktor Szakats
ef068fc8b7
GHA: pin containers to hash (where missing)
Fixing this with zizmor v1.25.0:
```
error[unpinned-images]: unpinned image references
  --> .github/workflows/linux-old.yml:59:5
59 |     container: 'debian:stretch'
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^ container image is not pinned to a SHA256 hash
   = help: audit documentation -> https://docs.zizmor.sh/audits/#unpinned-images
[...]
```
Ref: https://github.com/curl/curl/actions/runs/25890035949/job/76090925291?pr=21618

Sadly there is no automatic mechanism to bump them..

Also:
- replace `debian-stretch` with its slim variant.
- bump one of the two Alpine jobs from 3.20 to 3.23.4.

Closes #21619
2026-05-15 01:37:39 +02:00
Viktor Szakats
db5d888673
GHA: explicitly brew update before brew install with Linuxbrew
Fixing:
```
==> Installing openssl@3 dependency: ca-certificates
==> Pouring ca-certificates--2026-05-14.all.bottle.tar.gz
Error: undefined method '[]' for nil
/home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/utils/bottles.rb:127:in 'Utils::Bottles.load_tab'
/home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/formula_installer.rb:1507:in 'FormulaInstaller#pour'
[...]
/home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/brew.rb:114:in '<main>'
You have disabled automatic updates and have not updated today.
Do not report this issue until you've run `brew update` and tried again.
Error: Process completed with exit code 1.
```
Ref: https://github.com/curl/curl/actions/runs/25859030402/job/75984082148?pr=21607

Dropping `HOMEBREW_NO_AUTO_UPDATE=1` was not enough to fix it.

Closes #21608
2026-05-14 14:26:43 +02:00
Daniel Stenberg
a32a2b0b77
GHA: (re-)enable SMB in a few builds
Closes #21564
2026-05-12 14:53:48 +02:00
Viktor Szakats
01f08dc4eb
gnutls: fix more nettle 4+ compatibility issues
- disable DES with nettle 4. It no longer supports it.
  ```
  lib/curl_ntlm_core.c:67:12: fatal error: 'nettle/des.h' file not found
     67 | #  include <nettle/des.h>
        |            ^~~~~~~~~~~~~~
  ```

- fix MD4 support with nettle 4.
  ```
  lib/md4.c:178:36: error: too many arguments to function call, expected 2, have 3
    178 |   md4_digest(ctx, MD4_DIGEST_SIZE, digest);
        |   ~~~~~~~~~~                       ^~~~~~
  ```

- fix unused argument compiler warning:
  ```
  lib/vtls/gtls.c:2267:39: error: unused parameter 'sha256len' [clang-diagnostic-unused-parameter,-warnings-as-errors]
  2267 |                                size_t sha256len)
       |                                       ^
  ```
  Ref: https://github.com/curl/curl/actions/runs/25710321195/job/75488970143?pr=21557

- GHA/macos: stop enabling NTLM in the GnuTLS job.
  It no longer builds due to missing DES support in nettle 4.
  ```
  lib/curl_ntlm_core.c:90:4: error: "cannot compile NTLM support without a crypto library with DES."
     90 | #  error "cannot compile NTLM support without a crypto library with DES."
        |    ^
  ```
  Ref: https://github.com/curl/curl/actions/runs/25710321195/job/75488970170?pr=21557

Follow-up to cfadbaa133 #21169

Closes #21557
2026-05-12 05:33:08 +02:00
Viktor Szakats
b582a936dd
GHA/linux: build local wolfSSL opensslextra with --enable-ed25519
For use with RFC 9421 HTTP Message Signatures support.

Ref: https://github.com/curl/curl/pull/21239/files#r3222322908
Ref: #21239

Closes #21555
2026-05-12 04:26:33 +02:00
Viktor Szakats
4815070794
tidy-up: sort TLS backends, distros, alphabetically
Also:
- replace stray [Rr]ustls-ffi with Rustls for consistency.
- add AWS-LC to a couple of lists where missing.

Closes #21481
2026-05-11 11:57:25 +02:00
renovate[bot]
67ce672842
GHA: update awslabs/aws-lc to v1.73.0
Closes #21542
2026-05-10 23:22:45 +02:00
renovate[bot]
1698a3f857
GHA: update google/boringssl to v0.20260508.0
Closes #21537
2026-05-08 16:46:42 +02:00
Daniel Stenberg
80214dca6b
GHA: verify function-lengths
No production code function is allowed to be longer than 500 lines.

The lib/setopt.c:setopt_cptr function is currently exempt, as a single
exception until we make it smaller.

Closes #21492
2026-05-05 16:26:44 +02:00
dependabot[bot]
47755c4e69
GHA: bump actions and pips
- update action `actions/cache` from 5.0.4 to 5.0.5
- update action `actions/upload-artifact` from 7.0.0 to 7.0.1
- update action `github/codeql-action` from 4.32.4 to 4.35.2
- update action `msys2/setup-msys2` from 2.31.0 to 2.31.1

- update pip `filelock` from 3.25.2 to 3.29.0
- update pip `impacket` to 0.13.0
- update pip `ruff` from 0.15.10 to 0.15.12

Closes #21483
Closes #21482
2026-05-01 21:19:22 +02:00
Viktor Szakats
ceaa5dfba0
GHA/curl-for-win: switch riscv job to debian:stable (testing broke)
```
The following packages have unmet dependencies:
[...]
E: Unable to satisfy dependencies. Reached two conflicting assignments:
   1. musl-dev:amd64=1.2.5-3+b1 is selected for install
   2. musl-dev:amd64 is not selected for install because:
      1. musl-dev:riscv64=1.2.5-3 is selected for install
      2. musl-dev:amd64 Breaks musl-dev:riscv64 (!= 1.2.5-3+b1)
```
Ref: https://github.com/curl/curl/actions/runs/25168601672/job/73785600341#step:3:154

Closes #21475
2026-04-30 16:14:13 +02:00
Viktor Szakats
ddb30354f6
GHA/linux: work around Linuxbrew install failure
Root cause unknown, it appeared today without any local change:
```
==> Installing dependencies for libssh2: openssl@3 and zlib-ng-compat
==> Installing libssh2 dependency: openssl@3
==> Pouring openssl@3--3.6.2.x86_64_linux.bottle.tar.gz
Error: A `brew install openssl@4 libssh2 libngtcp2 libnghttp3 c-ares` process has already locked /home/linuxbrew/.linuxbrew/Cellar/openssl@4.
Please wait for it to finish or terminate it to continue.
Error: Process completed with exit code 1.
```
Ref: https://github.com/curl/curl/actions/runs/25129061781/job/73650161844?pr=21468#step:2:407

Last known good run: https://github.com/curl/curl/actions/runs/25038989485/job/73337289504

Ref: 1fbffe7f08 #21379

Closes #21469
2026-04-29 22:12:35 +02:00
Viktor Szakats
931ac3085a
GHA/checksrc: switch to zizmor --persona option
Closes #21457
2026-04-27 15:07:03 +02:00
Viktor Szakats
701cd4cfc3
tidy-up: git options, ECH, HTTP/3 documentation
- prefer `--branch` over `-b`, where missing.
- add `--depth 1` where missing.
- sync option order between docs and GHA.
- bump quiche and rustls-ffi versions in documentation.
- ECH.md: update for OpenSSL 4.

Closes #21447
2026-04-25 13:59:20 +02:00
Viktor Szakats
f9d3f00c98
GHA/windows: bump stunnel to 5.78
Closes #21443
2026-04-25 08:35:45 +02:00
Viktor Szakats
41f3f94d91
sshserver.pl: add option to enable KEX algorithms in sshd
Necessary when the libssh2/libssh client library does not support KEX
algos offered by default by the OpenSSH server. E.g. libssh2 with WinCNG
combined with OpenSSH 10+.

Also: use this option in GHA/windows.

Follow-up to 3b8bb1a86a #21219
Follow-up to c98d0a2e9a #21220

Closes #21438
2026-04-24 17:09:21 +02:00
Viktor Szakats
7c0a8fc210
GHA/windows: disable ssh-ed25519 hostkey in libssh2-wincng jobs
libssh2 built with the WinCNG crypto backend does not support ed25519
hostkeys.

Ref: #21438
Follow-up to acda4eae5e #21223

Closes #21439
2026-04-24 15:03:25 +02:00
Daniel McCarney
ed9083eba2
ci: update RUSTLS_VERSION 0.15.2 -> 0.15.3
Closes #21424
2026-04-23 20:24:53 +02:00
Viktor Szakats
e418b42c82
CI: set DO_NOT_TRACK=1
Closes #21420
2026-04-23 11:22:35 +02:00
Viktor Szakats
fd2a729a12
GHA/appveyor-status: disable gh tool telemetry
Ref: https://cli.github.com/telemetry

Closes #21418
2026-04-23 10:26:10 +02:00
Viktor Szakats
50ff4f2927
GHA: deprioritize Azure Ubuntu mirror
Due to year-long unreliability.

The default Ubuntu mirror works as fast as the Azure one when it's
working at its normal speed. And has HTTPS.

Also:
- replac the retry hack that turn out to not solve the problem.
- add timeouts to each download step to catch slowness early.

Follow-up to a5838847c4 #21181
Follow-up to 5172ba5475 #21107

Closes #21414
2026-04-22 19:38:56 +02:00
Viktor Szakats
ed3fea6087
GHA: delete all apt sources except ubuntu.sources
GitHub runners are getting new 3rd-party sources frequntly now, last
week `docker.list`, this week: `google-chrome.sources`. To avoid
playing catch up, allowlist the only one we use: `ubuntu.sources`. If
this is renamed, CI would break. Let's hope this happens much less
often than new sources.

Bug: https://github.com/curl/curl/pull/21414#issuecomment-4297788640

Follow-up to 3e0e2cc1ab #21344

Closes #21416
2026-04-22 18:22:33 +02:00
Viktor Szakats
85e825770a
GHA: bump test minimums (more)
Follow-up to 701a8319ec96c0b73c39e16c5db68dd758419c2 #21353

Closes #21382
2026-04-20 10:47:19 +02:00
Viktor Szakats
1fbffe7f08
GHA: use more OpenSSL 4, enable ECH in more jobs
for Linux and macOS.

Closes #21379
2026-04-20 02:53:24 +02:00
Viktor Szakats
9e38e06769
GHA: keep testing 3 as openssl-prev, bump mainline to 4
Ref: #21317
Ref: #21316

Closes #21376
2026-04-19 14:05:46 +02:00
renovate[bot]
23a06e1fb9
GHA: update dependency libressl/portable to v4.3.1
Closes #21365
2026-04-19 11:54:47 +02:00
Viktor Szakats
07e9f73f32
runtests: skip setting ed25519 SSH key format
`ssh-keygen -t ed25519` does not support PEM key format, and it
defaults to `RFC4716` which is what we want.

It affected GHA/windows tests that explicitly used ed25519 keys.

Also:
- GHA/windows: bump minimums to hopefully catch this early next time.
  1701a8319e #21353
- merge two Perl lines.

Reported-by: herbenderbler on github
Fixes #21360
Follow-up to acda4eae5e #21223

Closes #21374
2026-04-19 11:53:18 +02:00
renovate[bot]
fc7bd0704e
GHA: update dependency nghttp2/nghttp2 to v1.69.0
Closes #21375
2026-04-19 11:52:11 +02:00
Viktor Szakats
1701a8319e
GHA: bump required test minimums
Ref: https://testclutch.curl.se/static/reports/feature-matrix.html

Closes #21353
2026-04-17 13:10:43 +02:00
Viktor Szakats
3e0e2cc1ab
GHA: drop 3rd-party apt source docker.list
Seen on `ubuntu-slim` runners.

Also:
- extend to two jobs to `ls -l` package sources on both ubuntu-latest,
  ubuntu-24.04-arm, and ubuntu-slim.
- drop former stray apt source `ondrej-ubuntu-php-noble.sources`.
  It's no longer present on the image.

Closes #21344
2026-04-16 15:37:13 +02:00
renovate[bot]
0a6f815ff7
GHA/http3-linux: update dependency ngtcp2/ngtcp2 to v1.22.1
Closes #21343
2026-04-16 15:08:16 +02:00
Daniel McCarney
54cc65595d
ci: update RUSTLS_VERSION 0.15.1 -> 0.15.2
Closes #21333
2026-04-15 23:34:33 +02:00
Viktor Szakats
94f14c54b0
renovate: use standard bump formula for OpenSSL
Cherry-picked from #21317

Closes #21323
2026-04-15 10:17:33 +02:00
Viktor Szakats
36295347bc
GHA/linux: tidy up and extend address-sanitizer job options
Also tried `integer` which has hits, but too slow to be practical to run on
every commit.

Closes #20785
2026-04-14 23:39:42 +02:00
Viktor Szakats
880cd0c34b
GHA/non-native: bump cross-platform-actions to 1.0.0
Closes #21320
2026-04-14 23:30:55 +02:00
Viktor Szakats
2e5acc1b15
GHA/linux: rename mbedtls-prev env to align with Renovate
- rename version env to stay compatible with Renovate `matchStrings`.
- also switch to manual bumps.
  Bump rule was wrong, and deemed not worthy the complexity to fix.

Closes #21319
2026-04-14 18:54:23 +02:00
Viktor Szakats
7767b56862
GHA/http3-linux: bump OpenSSL 4 beta to final
Closes #21318
2026-04-14 18:54:23 +02:00
renovate[bot]
67795ff730
GHA: update dependency google/boringssl to v0.20260413.0
Closes #21310
2026-04-14 11:04:10 +02:00
Viktor Szakats
e0dd6eb4a4
tidy-up: miscellaneous
- examples: sync debug output printf masks.
- INSTALL-CMAKE.md: tidy up section for some options.
- curl_sha512_256: delete comment suggesting an optimization.
- vtls/keylog: scope a variable.
- vtls/openssl: make a source code URL a permalink.
- vtls/schannel: drop redundant parentheses.
- test1119.pl: robustify `$1` -> `$s`.
- sync arg names in comments to match the code.
- tidy up and minor fixes to comments.
- fix formatting/indenting/comment/newline/include nits.
- move `UNITTEST` protos next to definitions, sync their argument names.
- make variables static.
- add parentheses to Perl `open()` calls.
- drop unnecessary double quotes in Perl.
- clang-format.

Closes #21000
2026-04-14 01:08:32 +02:00
renovate[bot]
008aa2b38f
GHA: update awslabs/aws-lc to v1.71.0
Closes #21283
2026-04-10 08:21:48 +02:00
renovate[bot]
8a3de6c8ce
GHA: update dependency wolfSSL/wolfssl to v5.9.1
Closes #21272
2026-04-08 23:32:25 +02:00
Viktor Szakats
f82ed74ed6
GHA/linux: bump mbedTLS 3 to 3.6.5 (from 3.6.4), also verify hash
Also:
- fix incorrect version in cache id.
  Follow-up to 3a305831d1 #19077
- latest version 3.6.6 fails pytests. Seems similar to the v4.1.0
  regression.
  https://github.com/curl/curl/pull/21178
  https://github.com/Mbed-TLS/mbedtls/issues/10668

Closes #21262
2026-04-08 02:31:44 +02:00
renovate[bot]
44c19a2cce
GHA: update openssl/openssl to v3.6.2
Closes #21254
2026-04-07 16:09:51 +02:00
Viktor Szakats
ecd09257d8
GHA/curl-for-win: drop certdata dependency and GITHUB_TOKEN with it
`certdata` dependency requires accessing api.github.com for
a reproducible timestamp, which in turn requires a GitHub token to avoid
errors due to rate limiting. Avoid all this by omitting this dependency,
which isn't necessary for these build tests anyway.

The `zero` job already did not use `certdata`, but disable explicitly
anyway just in case.

Reported-by: James Fuller

Follow-up to 9514184977
Follow-up to 128c252975 #21105

Closes #21241
2026-04-06 18:49:13 +02:00
Viktor Szakats
596f685da5
GHA: autoreconf downloaded tarballs where missing
To avoid using pre-built `./configure` scripts.

Also: drop unrecognized nettle `./configure` option.

Closes #21240
2026-04-06 18:49:13 +02:00
Viktor Szakats
8b50c9d1cc
GHA/windows: enable more options in 32-bit jobs
c-ares, gnutls, libssh, openssl.

Closes #21227
2026-04-05 17:41:11 +02:00
Viktor Szakats
acda4eae5e
runtests: allow configuring SSH host/client key algorithm
via env `CURL_TEST_SSH_KEYALGO`, `rsa` (default), `ecdsa`, `ed25519`.

To ease debugging and testing and to make these code paths more
universal.

Closes #21223
2026-04-05 11:19:42 +02:00
Viktor Szakats
ec22ea2502
GHA/windows: restore libssh, fix to pass tests with 0.12.0
libssh 0.12.0 on Windows 64-bit Intel fails to connect to sshd (with SSH
state 30) when using the mlkem768x25519-sha256 KEX. (32-bit Intel, ARM64
and tested non-Windows platforms work fine.) Fix by disabling this KEX
for the libssh job.

I do not recommend libssh on Windows due to bugs an insecure behavior.

Also:
- fix libssh TFLAGS condition for mingw-w64.

Follow-up to e127f8ce84 #21204
Follow-up to fcf946e846 #21195

Closes #21199
2026-04-04 18:34:13 +02:00