]> git.ipfire.org Git - thirdparty/gnutls.git/log
thirdparty/gnutls.git
9 months agox509: fix incorrect handling in name constraints merging
chenjianhu [Fri, 1 Aug 2025 09:18:23 +0000 (17:18 +0800)] 
x509: fix incorrect handling in name constraints merging

As mentioned in commit ca573d65 ("x509: Fix asymmetry in name
constraints intersection", 2016-07-29), the
_gnutls_name_constraints_intersect function exhibited an
asymmetry in name constraints intersection behavior, specifically
manifested as:
1. Nodes of unique types in PERMITTED (absent in PERMITTED2) were
   preserved
2. Nodes of unique types in PERMITTED2 (absent in PERMITTED) were
   discarded

A 'used' flag was introduced, where if a node from PERMITTED2 was
   not used for the intersection, it would be copied to PERMITTED.

However,an unresolved edge case persisted:
- When 'removed.size > 0', the 'used' flag was unconditionally set
to 1
- This prevented copying of PERMITTED2 nodes with unique types

Signed-off-by: chenjianhu <chenjianhu@kylinos.cn>
Modified-by: Daiki Ueno <ueno@gnu.org>
9 months agoMerge branch 'wip/purdue-university1/malloc-check2' into 'master'
Daiki Ueno [Fri, 15 Aug 2025 02:57:14 +0000 (11:57 +0900)] 
Merge branch 'wip/purdue-university1/malloc-check2' into 'master'

Add check for memory allocation APIs to avoid NULL pointer dereference

See merge request gnutls/gnutls!2008

9 months agotests/key-usage-ecdhe-rsa.c: Add gnutls_free() to avoid memory leak
Jiasheng Jiang [Tue, 5 Aug 2025 14:21:19 +0000 (14:21 +0000)] 
tests/key-usage-ecdhe-rsa.c: Add gnutls_free() to avoid memory leak

Add gnutls_free() to free p if error occurs to avoid memory leak.

Fixes: b167cc373 ("tests: added checks on signature key usage violations")
Signed-off-by: Jiasheng Jiang <jiashengjiangcool@gmail.com>
9 months agoAdd check for memory allocation APIs to avoid NULL pointer dereference
Jiasheng Jiang [Tue, 5 Aug 2025 14:12:38 +0000 (14:12 +0000)] 
Add check for memory allocation APIs to avoid NULL pointer dereference

Add check for the return value of memory allocation APIs to avoid NULL
pointer dereference.

Signed-off-by: Jiasheng Jiang <jiashengjiangcool@gmail.com>
Modified-by: Daiki Ueno <ueno@gnu.org>
9 months agoMerge branch 'wip/twilfredo/record-size-tls-test' into 'master'
Daiki Ueno [Tue, 5 Aug 2025 10:50:37 +0000 (19:50 +0900)] 
Merge branch 'wip/twilfredo/record-size-tls-test' into 'master'

ext/max_record: add function to get max send size

See merge request gnutls/gnutls!2005

9 months agoext/max_record: add function to get max send size
Wilfred Mallawa [Mon, 7 Jul 2025 03:21:58 +0000 (13:21 +1000)] 
ext/max_record: add function to get max send size

Adds a new function to max_record library to extract
the endpoints maximum record send size. Which may have been negotiated
through the record_size_limit or the max_fragment_length extensions.

Signed-off-by: Wilfred Mallawa <wilfred.mallawa@wdc.com>
Modified-by: Daiki Ueno <ueno@gnu.org>
9 months agoMerge branch 'wip/purdue-university1/malloc-check' into 'master'
Daiki Ueno [Tue, 5 Aug 2025 03:18:24 +0000 (12:18 +0900)] 
Merge branch 'wip/purdue-university1/malloc-check' into 'master'

Add check for gnutls_{malloc,calloc,strdup}

See merge request gnutls/gnutls!2004

9 months ago.gitlab-ci.yml: bump cache version
Daiki Ueno [Mon, 4 Aug 2025 11:22:39 +0000 (20:22 +0900)] 
.gitlab-ci.yml: bump cache version

Signed-off-by: Daiki Ueno <ueno@gnu.org>
9 months agotests/psk-importer.c: Add check for gnutls_malloc to avoid potential NULL pointer...
Jiasheng Jiang [Sat, 2 Aug 2025 23:10:32 +0000 (23:10 +0000)] 
tests/psk-importer.c: Add check for gnutls_malloc to avoid potential NULL pointer dereference

Add check for the return value of gnutls_malloc() to avoid potential NULL pointer dereference.

Fixes: 4fe788cc1 ("psk: Add basic support for RFC 9258 external PSK importer interface")
Signed-off-by: Jiasheng Jiang <jiashengjiangcool@gmail.com>
9 months agosrc/pkcs11.c: Add check for gnutls_malloc and gnutls_strdup
Jiasheng Jiang [Mon, 4 Aug 2025 00:17:10 +0000 (00:17 +0000)] 
src/pkcs11.c: Add check for gnutls_malloc and gnutls_strdup

Add check for the return value of gnutls_malloc() and gnutls_strdup() to avoid potential NULL pointer dereference.
Fixes: 44541d17 ("p11tool: copy vendor query attributes when listing privkeys")
Signed-off-by: Jiasheng Jiang <jiashengjiangcool@gmail.com>
9 months agotests/suite/mini-record-timing.c: Add check for gnutls_malloc
Jiasheng Jiang [Mon, 4 Aug 2025 00:46:52 +0000 (00:46 +0000)] 
tests/suite/mini-record-timing.c: Add check for gnutls_malloc

Add check for the return value of gnutls_malloc() to avoid potential NULL pointer dereference.

Fixes: 75363e1f ("cbc-record-check.sh: introduced")
Signed-off-by: Jiasheng Jiang <jiashengjiangcool@gmail.com>
9 months agolib/pkcs11_privkey.c: Add check for gnutls_malloc
Jiasheng Jiang [Sat, 2 Aug 2025 16:07:59 +0000 (16:07 +0000)] 
lib/pkcs11_privkey.c: Add check for gnutls_malloc

Add check for the return value of gnutls_malloc() to avoid potential NULL pointer dereference.

Fixes: be560a813 ("Added gnutls_pkcs11_privkey_t and gnutls_privkey_t types. Those are an abstract private key type that can be used to sign/encrypt any private key of pkcs11,x509 or openpgp types. Added support for PKCS11 in gnutls-cli/gnutls-serv.")
Signed-off-by: Jiasheng Jiang <jiashengjiangcool@gmail.com>
9 months agolib/x509/x509_dn.c: Add check for gnutls_calloc
Jiasheng Jiang [Sat, 2 Aug 2025 15:50:49 +0000 (15:50 +0000)] 
lib/x509/x509_dn.c: Add check for gnutls_calloc

Add check for the return value of gnutls_calloc() to avoid potential NULL pointer dereference.

Fixes: 6c9dadf6c ("Moved the gnutls_x509_dn API functions to x509_dn.c")
Signed-off-by: Jiasheng Jiang <jiashengjiangcool@gmail.com>
9 months agolib/anon_cred.c: Add check for gnutls_calloc
Jiasheng Jiang [Sat, 2 Aug 2025 15:38:40 +0000 (15:38 +0000)] 
lib/anon_cred.c: Add check for gnutls_calloc

According to the comment above, add check for the return value of gnutls_calloc() and return an error code if it fails.

Fixes: 23efd9990 ("The Diffie Hellman parameters are now stored in the credentials structures. This will allow precomputation of signatures (for DHE cipher suites).")
Signed-off-by: Jiasheng Jiang <jiashengjiangcool@gmail.com>
10 months agoMerge branch 'wip/dueno/rekey' into 'master'
Daiki Ueno [Fri, 1 Aug 2025 09:58:06 +0000 (18:58 +0900)] 
Merge branch 'wip/dueno/rekey' into 'master'

key_update: rework the rekeying logic

Closes #1717

See merge request gnutls/gnutls!1990

10 months agoMerge branch 'wip/devkdas/esys-crypto-callback' into 'master'
Daiki Ueno [Fri, 1 Aug 2025 05:29:21 +0000 (14:29 +0900)] 
Merge branch 'wip/devkdas/esys-crypto-callback' into 'master'

build: check if Esys_SetCryptoCallbacks is available

Closes #1724

See merge request gnutls/gnutls!1996

10 months agokey_update: rework the rekeying logic
Daiki Ueno [Fri, 18 Jul 2025 22:08:24 +0000 (07:08 +0900)] 
key_update: rework the rekeying logic

While RFC 8446 4.6.3 says that the sender of a KeyUpdate message
should only update its sending key, the previous implementation
updated both the sending and receiving keys, preventing that any
application data interleaved being decrypted.

This splits the key update logic into 2 phases: when sending a
KeyUpdate, only update the sending key, and when receiving a
KeyUpdate, only update the receiving key.  In both cases, KeyUpdate
messages are encrypted/decrypted with the old keys.

Signed-off-by: Daiki Ueno <ueno@gnu.org>
10 months agoconstate: switch epoch lookup to linear search
Daiki Ueno [Thu, 31 Jul 2025 06:34:48 +0000 (15:34 +0900)] 
constate: switch epoch lookup to linear search

The previous logic of epoch lookup was utilizing the fact that epoch
numbers are monotonically increasing and there are no gaps in between
after garbarge collection. That is, however, no longer true when a TLS
1.3 key update is happening in only one direction.

This patch switches to using linear search instead, at the cost of
approx MAX_EPOCH_INDEX * 2 (= 8) comparison.

Signed-off-by: Daiki Ueno <ueno@gnu.org>
10 months agokey_update: fix state transition in KTLS code path
Daiki Ueno [Tue, 22 Jul 2025 01:49:33 +0000 (10:49 +0900)] 
key_update: fix state transition in KTLS code path

Signed-off-by: Daiki Ueno <ueno@gnu.org>
10 months agobuild: check if Esys_SetCryptoCallbacks is available
Karthik Das [Wed, 30 Jul 2025 12:42:14 +0000 (12:42 +0000)] 
build: check if Esys_SetCryptoCallbacks is available

Signed-off-by: Karthik Das <kartheekdasari1998@gmail.com>
10 months agoMerge branch 'wip/dueno/certtool-without-pkcs1' into 'master'
Daiki Ueno [Wed, 30 Jul 2025 23:26:37 +0000 (08:26 +0900)] 
Merge branch 'wip/dueno/certtool-without-pkcs1' into 'master'

fips: adjust RSA self-tests after PKCS#1 v1.5 padding is no longer acceptable

See merge request gnutls/gnutls!1932

10 months agotests: do not assume RSAES-PKCS1-v1_5 is enabled in system config
Daiki Ueno [Mon, 10 Feb 2025 06:57:39 +0000 (15:57 +0900)] 
tests: do not assume RSAES-PKCS1-v1_5 is enabled in system config

Signed-off-by: Alexander Sosedkin <asosedkin@redhat.com>
Signed-off-by: Daiki Ueno <ueno@gnu.org>
10 months agofips: perform both PCTs for unrestricted RSA key
Daiki Ueno [Mon, 27 Jan 2025 07:36:41 +0000 (16:36 +0900)] 
fips: perform both PCTs for unrestricted RSA key

As PKCS#1 v1.5-padding is no longer allowed, exercise PCT with both
RSA-PSS and RSA-OAEP for unrestricted RSA keys. Note that, it is no
longer possible to create 512-bit RSA key under FIPS mode, because
there is a restriction of message size in RSA-OAEP based on the key
size, i.e., mLen > k - 2hLen - 2.

Signed-off-by: Daiki Ueno <ueno@gnu.org>
10 months agopk: exercise decrypt2 in PCT
Daiki Ueno [Wed, 12 Feb 2025 03:13:47 +0000 (12:13 +0900)] 
pk: exercise decrypt2 in PCT

Signed-off-by: Daiki Ueno <ueno@gnu.org>
10 months agopk: sprinkle SPKI over encryption functions
Daiki Ueno [Tue, 11 Feb 2025 22:23:59 +0000 (07:23 +0900)] 
pk: sprinkle SPKI over encryption functions

Similarly to signing, the encrypt/decrypt/decrypt2 functions defined
in gnutls_crypto_pk_st now take SPKI as an additional parameter, so
the encryption/decryption behavior can be overridden.

Signed-off-by: Daiki Ueno <ueno@gnu.org>
10 months agofips: perform RSA self-tests using RSA-PSS instead of PKCS#1 v1.5
Daiki Ueno [Tue, 17 Dec 2024 07:55:47 +0000 (16:55 +0900)] 
fips: perform RSA self-tests using RSA-PSS instead of PKCS#1 v1.5

Previously the RSA self-tests were using PKCS#1 v1.5, for both
signature generation and encryption/decryption, which turned a bit
problematic as GnuTLS now has a run-time option to disable that
scheme.

According to FIPS 140-3 IG 10.3.A, for each FIPS 186-4 and FIPS 186-5
public key digital signature algorithm, a CAST shall be performed
using at least one of the schemes approved for use in the approved
mode. Similarly, the IG annex D.G mentions that if the RSA signature
generation algorithm and RSA un-encapsulation scheme use the same
implementation, only test for signature generation suffices.

Therefore, this switches to using RSA-PSS only and drop the
RSA encryption/decryption self-tests.

Signed-off-by: Daiki Ueno <ueno@gnu.org>
10 months agopk: use deterministic RNG for RSA-PSS in self-tests
Daiki Ueno [Tue, 17 Dec 2024 16:11:50 +0000 (01:11 +0900)] 
pk: use deterministic RNG for RSA-PSS in self-tests

This ports the logic to use a specialized RNG with deterministic
behavior from RSA PKCS#1 v1.5 signature creation.

Signed-off-by: Daiki Ueno <ueno@gnu.org>
10 months agoMerge branch 'wip/fundawang/sanity-lib' into 'master'
Daiki Ueno [Tue, 29 Jul 2025 10:47:18 +0000 (19:47 +0900)] 
Merge branch 'wip/fundawang/sanity-lib' into 'master'

tests: only do sanity-lib test when tpm-tss is dlopened

Closes #1722

See merge request gnutls/gnutls!1995

10 months agotests: only do sanity-lib test when tpm-tss is dlopened
fundawang [Sun, 13 Jul 2025 08:59:59 +0000 (08:59 +0000)] 
tests: only do sanity-lib test when tpm-tss is dlopened

Signed-off-by: Funda Wang <fundawang@yeah.net>
10 months agoMerge branch 'wip/dueno/test-fixes' into 'master'
Daiki Ueno [Mon, 28 Jul 2025 22:09:47 +0000 (07:09 +0900)] 
Merge branch 'wip/dueno/test-fixes' into 'master'

Fixes for 3.8.10 testsuite

Closes #1721

See merge request gnutls/gnutls!1980

10 months ago.gitlab-ci.yml: manual trigger fedora-cross/bootstrap
Daiki Ueno [Mon, 28 Jul 2025 08:20:52 +0000 (17:20 +0900)] 
.gitlab-ci.yml: manual trigger fedora-cross/bootstrap

Signed-off-by: Daiki Ueno <ueno@gnu.org>
10 months agotests: skip system-override-compress-cert.sh for missing libs
Daiki Ueno [Wed, 9 Jul 2025 20:58:52 +0000 (05:58 +0900)] 
tests: skip system-override-compress-cert.sh for missing libs

The tls13/compress-cert-conf.c requires brotli and the test needs one
other algorithm; assume zstd and skip if any of those are missing.

Signed-off-by: Daiki Ueno <ueno@gnu.org>
10 months agotests: distribute ktls_utils.h
Daiki Ueno [Wed, 9 Jul 2025 20:54:32 +0000 (05:54 +0900)] 
tests: distribute ktls_utils.h

Signed-off-by: Daiki Ueno <ueno@gnu.org>
10 months agotests: make cert-tests/mldsa.sh work in VPATH build
Daiki Ueno [Wed, 9 Jul 2025 20:53:32 +0000 (05:53 +0900)] 
tests: make cert-tests/mldsa.sh work in VPATH build

Signed-off-by: Daiki Ueno <ueno@gnu.org>
10 months agoMerge branch 'wip/apteryks/portability-improvements' into 'master'
Daiki Ueno [Mon, 28 Jul 2025 08:08:47 +0000 (17:08 +0900)] 
Merge branch 'wip/apteryks/portability-improvements' into 'master'

scripts: Use /usr/bin/env for more portable shebangs.

See merge request gnutls/gnutls!1994

10 months agotests: Remove dependency on `which' command.
Maxim Cournoyer [Fri, 18 Jul 2025 03:05:31 +0000 (12:05 +0900)] 
tests: Remove dependency on `which' command.

A POSIX equivalent (command) works just as well.

* tests/pkcs11-tool.sh: Replace 'which' invocations with 'command'.
* tests/tpm2.sh: Likewise.
* tests/tpmtool_test.sh: Likewise.

Signed-off-by: Maxim Cournoyer <maxim@guixotic.coop>
10 months agotests: Lookup softhsm tools from PATH.
Maxim Cournoyer [Fri, 18 Jul 2025 03:05:22 +0000 (12:05 +0900)] 
tests: Lookup softhsm tools from PATH.

This is more portable, e.g. on non-FHS systems.

* tests/testpkcs11.softhsm (init_card): Use POSIX's 'command' to test
if softhsm2-util or softhsm is available from PATH.
tests: Check softhsm2-util from PATH.
* tests/pkcs11/softhsm.h (softhsm_bin): Check from PATH.

Signed-off-by: Maxim Cournoyer <maxim@guixotic.coop>
10 months agoMakefile.am: Hint at libdane requirement for distcheck target.
Maxim Cournoyer [Fri, 18 Jul 2025 03:05:15 +0000 (12:05 +0900)] 
Makefile.am: Hint at libdane requirement for distcheck target.

Signed-off-by: Maxim Cournoyer <maxim@guixotic.coop>
10 months agoscripts: Use /usr/bin/env for more portable shebangs.
Maxim Cournoyer [Fri, 18 Jul 2025 03:05:00 +0000 (12:05 +0900)] 
scripts: Use /usr/bin/env for more portable shebangs.

Lookup perl from PATH instead of from its fixed expected location,
which may not exist on non-FHS systems like Guix System and NixOS.

* doc/scripts/gdoc: Adjust shebang to use /usr/bin/env.
* doc/scripts/getfuncs.pl: Likewise.

Signed-off-by: Maxim Cournoyer <maxim@guixotic.coop>
10 months agoMerge branch 'wip/purdue-university1/memleaks' into 'master'
Daiki Ueno [Mon, 28 Jul 2025 04:22:53 +0000 (13:22 +0900)] 
Merge branch 'wip/purdue-university1/memleaks' into 'master'

Fix memleaks and handle allocation error

See merge request gnutls/gnutls!1993

10 months ago.gitlab-ci.yml: remove "texconfig rehash" invocation
Daiki Ueno [Mon, 28 Jul 2025 01:23:27 +0000 (10:23 +0900)] 
.gitlab-ci.yml: remove "texconfig rehash" invocation

Signed-off-by: Daiki Ueno <ueno@gnu.org>
10 months ago.gitlab-ci.yml: exercise heartbeat and SRP support
Daiki Ueno [Mon, 28 Jul 2025 01:14:20 +0000 (10:14 +0900)] 
.gitlab-ci.yml: exercise heartbeat and SRP support

Signed-off-by: Daiki Ueno <ueno@gnu.org>
10 months ago.gitlab-ci.yml: reduce fedora/test matrix
Daiki Ueno [Mon, 28 Jul 2025 01:11:46 +0000 (10:11 +0900)] 
.gitlab-ci.yml: reduce fedora/test matrix

As PQC has nothing to do with KTLS, skip the pqc + ktls combination.

Signed-off-by: Daiki Ueno <ueno@gnu.org>
10 months agoReplace with statically allocated buffer
Jiasheng Jiang [Sun, 20 Jul 2025 21:11:46 +0000 (21:11 +0000)] 
Replace with statically allocated buffer

Replace with statically allocated buffer to avoid potential NULL pointer
dereference.

Fixes: 1fb6d1b5 ("fips140-2: moved PCT-test in wrap_nettle_generate_keys")
Signed-off-by: Jiasheng Jiang <jiashengjiangcool@gmail.com>
10 months agolib/hello_ext.c: Add check for gnutls_strdup()
Jiasheng Jiang [Fri, 11 Jul 2025 22:24:41 +0000 (22:24 +0000)] 
lib/hello_ext.c: Add check for gnutls_strdup()

Add check for the return value of gnutls_strdup() to avoid potential NULL pointer dereference.

Fixes: 5bba569b4 ("gnutls_session_ext_register: keep track of extension name")
Signed-off-by: Jiasheng Jiang <jiashengjiangcool@gmail.com>
10 months agolib/file.c: Add check for gnutls_malloc()
Jiasheng Jiang [Fri, 11 Jul 2025 20:12:55 +0000 (20:12 +0000)] 
lib/file.c: Add check for gnutls_malloc()

Add check for the return value of gnutls_malloc() to avoid potential NULL pointer dereference.

Fixes: d1428c0f9 ("helper.c -> file.c")
Signed-off-by: Jiasheng Jiang <jiashengjiangcool@gmail.com>
10 months agolib/ext/srp.c: Add gnutls_free() to avoid memory leak
Jiasheng Jiang [Thu, 10 Jul 2025 19:53:19 +0000 (19:53 +0000)] 
lib/ext/srp.c: Add gnutls_free() to avoid memory leak

Add gnutls_free() to free priv->username if the allocation of priv->password fails to avoid memory leak.
Moreover, replace "return" with "goto" to avoid memory leak.

Fixes: a1a15422 ("Fixes and memory leak elimination in SRP authentication.")
Signed-off-by: Jiasheng Jiang <jiashengjiangcool@gmail.com>
10 months agolib/ext/srp.c: Add gnutls_free() in the error path
Jiasheng Jiang [Fri, 11 Jul 2025 20:04:39 +0000 (20:04 +0000)] 
lib/ext/srp.c: Add gnutls_free() in the error path

Add gnutls_free() in the error path to avoid potential memory leak if BUFFER_POP_DATUM fails.

Fixes: 8b038ab97 ("The auth_ and ext_ files were moved to respective directories.")
Signed-off-by: Jiasheng Jiang <jiashengjiangcool@gmail.com>
10 months agolib/cert-cred-rawpk.c: Add gnutls_free() and gnutls_pcert_deinit() in the error paths
Jiasheng Jiang [Fri, 11 Jul 2025 19:18:15 +0000 (19:18 +0000)] 
lib/cert-cred-rawpk.c: Add gnutls_free() and gnutls_pcert_deinit() in the error paths

Add gnutls_free() and gnutls_pcert_deinit() in the error paths to avoid potential memory leak.

Fixes: 565efaeac ("Implemented support for raw public-key functionality (RFC7250).")
Signed-off-by: Jiasheng Jiang <jiashengjiangcool@gmail.com>
10 months agofuzz/gnutls_srp_server_fuzzer.c: Add check for gnutls_malloc()
Jiasheng Jiang [Fri, 11 Jul 2025 18:51:35 +0000 (18:51 +0000)] 
fuzz/gnutls_srp_server_fuzzer.c: Add check for gnutls_malloc()

Add check for the return value of gnutls_malloc() to avoid potential NULL pointer dereference.

Fixes: 5bb8a18b0 ("fuzzer: Initial check in for improved fuzzing")
Signed-off-by: Jiasheng Jiang <jiashengjiangcool@gmail.com>
10 months agoMerge branch 'wip/hare1712/psk-sha384' into 'master'
Daiki Ueno [Fri, 25 Jul 2025 07:38:27 +0000 (16:38 +0900)] 
Merge branch 'wip/hare1712/psk-sha384' into 'master'

lib/psk: Add gnutls_psk_allocate_{client,server}_credentials2

Closes #386

See merge request gnutls/gnutls!1992

10 months ago.gitlab-ci.yml: point to the gnulib checkout
Daiki Ueno [Thu, 24 Jul 2025 22:47:09 +0000 (07:47 +0900)] 
.gitlab-ci.yml: point to the gnulib checkout

Signed-off-by: Daiki Ueno <ueno@gnu.org>
10 months agolib/psk: Add gnutls_psk_allocate_{client,server}_credentials2
Hannes Reinecke [Fri, 14 Mar 2025 11:31:13 +0000 (12:31 +0100)] 
lib/psk: Add gnutls_psk_allocate_{client,server}_credentials2

Add new functions gnutls_psk_allocate_client_credentials2() and
gnutls_psk_allocate_server_credentials2() which allow to specify
the hash algorithm for the PSK. This fixes a bug in the current
implementation where the binder is always calculated with SHA256.

Signed-off-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Daiki Ueno <ueno@gnu.org>
10 months agoMerge branch 'wip/dueno/ci-optimize' into 'master'
Daiki Ueno [Thu, 24 Jul 2025 11:25:12 +0000 (20:25 +0900)] 
Merge branch 'wip/dueno/ci-optimize' into 'master'

.gitlab-ci.yml: optimize the number of builds

See merge request gnutls/gnutls!1991

10 months agotests: skip tlsfuzzer tests in FIPS mode
Daiki Ueno [Thu, 24 Jul 2025 06:33:45 +0000 (15:33 +0900)] 
tests: skip tlsfuzzer tests in FIPS mode

Those tests are not expected to run in FIPS mode and may return
different results than in non-FIPS mode.

Signed-off-by: Daiki Ueno <ueno@gnu.org>
10 months ago.gitlab-ci.yml: remove mingw-vista pipelines
Daiki Ueno [Wed, 23 Jul 2025 10:56:32 +0000 (19:56 +0900)] 
.gitlab-ci.yml: remove mingw-vista pipelines

The Vista build is now the default in mingw, the build will result in
the equivalent artifacts to non-Vista.

Signed-off-by: Daiki Ueno <ueno@gnu.org>
10 months ago.gitlab-ci.yml: bump cache version
Daiki Ueno [Tue, 22 Jul 2025 09:36:57 +0000 (18:36 +0900)] 
.gitlab-ci.yml: bump cache version

Signed-off-by: Daiki Ueno <ueno@gnu.org>
10 months agocfg: avoid UB on FILE stream marked as error
Daiki Ueno [Wed, 23 Jul 2025 04:55:17 +0000 (13:55 +0900)] 
cfg: avoid UB on FILE stream marked as error

Spotted by clang-analyzer 19.

Signed-off-by: Daiki Ueno <ueno@gnu.org>
10 months agofastopen: check return value of connect before inspecting errno
Daiki Ueno [Thu, 3 Apr 2025 09:49:15 +0000 (18:49 +0900)] 
fastopen: check return value of connect before inspecting errno

Spotted by clang-analyzer from Clang 19:

  system/fastopen.c:131:7: warning: An undefined value may be read from 'errno' [unix.Errno]
    131 |                 if (errno == ENOTCONN || errno == EINPROGRESS) {
        |                     ^~~~~

This also fixes the check at the end of tfo_writev for successful TFO
enablement, which previously checked the return value was 0, while it
should have been checking >= 0.

Signed-off-by: Daiki Ueno <ueno@gnu.org>
10 months agopkcs11: read pkcs11.conf at once with gnutls_load_file
Daiki Ueno [Thu, 3 Apr 2025 08:47:44 +0000 (17:47 +0900)] 
pkcs11: read pkcs11.conf at once with gnutls_load_file

clang-analyzer from Clang 19 complains about the fgets usage while a
mutex is held:

  pkcs11.c:911:9: warning: Call to blocking function 'fgets' inside of critical section [unix.BlockInCriticalSection]
    911 |         while (fgets(line, sizeof(line), fp) != NULL) {
        |                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~

This changes the logic to read the content of the file at once to
avoid iterative calls to fgets.

Signed-off-by: Daiki Ueno <ueno@gnu.org>
10 months ago.gitlab-ci.yml: install clang19-extra-tools in .pre
Daiki Ueno [Tue, 22 Jul 2025 08:23:11 +0000 (17:23 +0900)] 
.gitlab-ci.yml: install clang19-extra-tools in .pre

Signed-off-by: Daiki Ueno <ueno@gnu.org>
10 months agobuild: indent with latest Clang 19
Daiki Ueno [Tue, 22 Jul 2025 08:10:54 +0000 (17:10 +0900)] 
build: indent with latest Clang 19

Signed-off-by: Daiki Ueno <ueno@gnu.org>
10 months ago.gitlab-ci.yml: disable fedora-nettle pipelines
Daiki Ueno [Tue, 22 Jul 2025 06:29:05 +0000 (15:29 +0900)] 
.gitlab-ci.yml: disable fedora-nettle pipelines

Now that we pin Nettle to the 3.10 branch, building Nettle from source
always result in the (almost) identical binaries.  Skip them for now,
until GnuTLS supports the Nettle 4 API.

Signed-off-by: Daiki Ueno <ueno@gnu.org>
10 months ago.gitlab-ci.yml: merge fedora-{ktls, leancrypto, FIPS140-2} pipelines
Daiki Ueno [Tue, 22 Jul 2025 06:24:58 +0000 (15:24 +0900)] 
.gitlab-ci.yml: merge fedora-{ktls, leancrypto, FIPS140-2} pipelines

Use leancrypto from the container image instead of building from
source, as well as control the GNUTLS_FORCE_FIPS_MODE and
crypto-policies setting through parallel::matrix.

Signed-off-by: Daiki Ueno <ueno@gnu.org>
10 months ago.gitlab-ci.yml: merge fedora-notools pipeline into fedora-minimal
Daiki Ueno [Mon, 21 Jul 2025 00:48:51 +0000 (09:48 +0900)] 
.gitlab-ci.yml: merge fedora-notools pipeline into fedora-minimal

Signed-off-by: Daiki Ueno <ueno@gnu.org>
10 months ago.gitlab-ci.yml: split doc-dist.Fedora into build and test
Daiki Ueno [Mon, 21 Jul 2025 00:45:54 +0000 (09:45 +0900)] 
.gitlab-ci.yml: split doc-dist.Fedora into build and test

Signed-off-by: Daiki Ueno <ueno@gnu.org>
10 months ago.gitlab-ci.yml: manually trigger CPU intensitive tests
Daiki Ueno [Mon, 21 Jul 2025 00:33:10 +0000 (09:33 +0900)] 
.gitlab-ci.yml: manually trigger CPU intensitive tests

Signed-off-by: Daiki Ueno <ueno@gnu.org>
10 months ago.gitlab-ci.yml: rework sanitizer pipeline
Daiki Ueno [Mon, 21 Jul 2025 00:24:50 +0000 (09:24 +0900)] 
.gitlab-ci.yml: rework sanitizer pipeline

This splits UB+ASAN-Werror.Fedora.x86_64.gcc into build and test
phases and make it simpler by:

- Stop doing 2 builds for trust store, given the same code path is
  exercised when the trust store is enabled at build time
- Stop doing 2 builds for AGGRESSIVE_REALLOC, now that the buffer
  allocation strategy can be tuned with the GNUTLS_BUFFER_RECLAIM
  envvar
- Remove -Werror check from this pipeline, as it has nothing to do
  with sanitizers

Signed-off-by: Daiki Ueno <ueno@gnu.org>
10 months agostr: make gnutls_buffer resizing behavior configurable at run-time
Daiki Ueno [Sun, 20 Jul 2025 08:37:11 +0000 (17:37 +0900)] 
str: make gnutls_buffer resizing behavior configurable at run-time

Signed-off-by: Daiki Ueno <ueno@gnu.org>
10 months ago.gitlab-ci.yml: mount binfmt_misc only at test phase
Daiki Ueno [Sun, 20 Jul 2025 08:01:05 +0000 (17:01 +0900)] 
.gitlab-ci.yml: mount binfmt_misc only at test phase

When cross-compiling to MinGW, the wine registration to binfmt_misc is
only needed when running tests, not when bootstrapping nor building.

Signed-off-by: Daiki Ueno <ueno@gnu.org>
10 months ago.gitlab-ci.yml: use shallow git clone
Daiki Ueno [Sun, 20 Jul 2025 07:59:11 +0000 (16:59 +0900)] 
.gitlab-ci.yml: use shallow git clone

Signed-off-by: Daiki Ueno <ueno@gnu.org>
10 months agoMerge branch 'ddudas/tpm2-switch-crypto-backend' into 'master'
Daiki Ueno [Fri, 11 Jul 2025 09:29:22 +0000 (18:29 +0900)] 
Merge branch 'ddudas/tpm2-switch-crypto-backend' into 'master'

Make TPM2 support self-contained

See merge request gnutls/gnutls!1946

10 months agoCumulative update
d-Dudas [Tue, 8 Jul 2025 18:42:17 +0000 (21:42 +0300)] 
Cumulative update

- description typo correction
- aes key size construction update
- dynamic ECDH key size
- dynamic RSA exponent size

Signed-off-by: David Dudas <david.dudas03@e-uvt.ro>
10 months agoAdd support for regular CFB.
d-Dudas [Thu, 17 Apr 2025 08:04:35 +0000 (11:04 +0300)] 
Add support for regular CFB.

Signed-off-by: David Dudas <david.dudas03@e-uvt.ro>
10 months agoMake TPM2 support self-contained
d-Dudas [Sun, 30 Mar 2025 18:03:52 +0000 (18:03 +0000)] 
Make TPM2 support self-contained

Setup GnuTLS based callbacks for TPM2
using ESYS API's Esys_SetCryptoCallbacks function.

Signed-off-by: David Dudas <david.dudas03@e-uvt.ro>
10 months agoMerge branch 'wip/dueno/release-3.8.10' into 'master' 3.8.10
Daiki Ueno [Wed, 9 Jul 2025 04:04:43 +0000 (13:04 +0900)] 
Merge branch 'wip/dueno/release-3.8.10' into 'master'

Release 3.8.10

Closes #1666, #1694, #1695, #1696, #1718, and #1720

See merge request gnutls/gnutls!1979

10 months ago.gitlab-ci.yml: use self-hosted runner
Daiki Ueno [Tue, 8 Jul 2025 09:51:26 +0000 (18:51 +0900)] 
.gitlab-ci.yml: use self-hosted runner

Signed-off-by: Daiki Ueno <ueno@gnu.org>
10 months agoRelease 3.8.10
Daiki Ueno [Mon, 7 Jul 2025 22:00:39 +0000 (07:00 +0900)] 
Release 3.8.10

Signed-off-by: Daiki Ueno <ueno@gnu.org>
10 months agodoc: fix texinfo menu entries
Daiki Ueno [Tue, 8 Jul 2025 09:46:48 +0000 (18:46 +0900)] 
doc: fix texinfo menu entries

Signed-off-by: Daiki Ueno <ueno@gnu.org>
10 months agotests: add missing automake variable prefix to pkcs11-provider tests
Daiki Ueno [Tue, 8 Jul 2025 07:46:38 +0000 (16:46 +0900)] 
tests: add missing automake variable prefix to pkcs11-provider tests

Signed-off-by: Daiki Ueno <ueno@gnu.org>
10 months agocli: print DEFAULT_TRUST_STORE_{DIR,PKCS11} with --list-config
Daiki Ueno [Mon, 7 Jul 2025 23:47:07 +0000 (08:47 +0900)] 
cli: print DEFAULT_TRUST_STORE_{DIR,PKCS11} with --list-config

Signed-off-by: Daiki Ueno <ueno@gnu.org>
10 months agohandshake: clear HSK_PSK_SELECTED is when resetting binders
Daiki Ueno [Mon, 7 Jul 2025 02:15:45 +0000 (11:15 +0900)] 
handshake: clear HSK_PSK_SELECTED is when resetting binders

When a TLS 1.3 handshake involves HRR and resumption or PSK, and the
second Client Hello omits PSK, the server would result in a NULL
pointer dereference as the PSK binder information is cleared while the
HSK_PSK_SELECTED flag is still set. This makes sure that
HSK_PSK_SELECTED flag is always cleared when the PSK binders are
reset. This also makes it clear the HSK_PSK_SELECTED flag is valid
only during a handshake; after that, whether PSK is used can be
checked with gnutls_auth_client_get_type.

Reported by Stefan Bühler.

Signed-off-by: Daiki Ueno <ueno@gnu.org>
10 months agocerttool: avoid 1-byte write buffer overrun when parsing template
Daiki Ueno [Mon, 7 Jul 2025 01:57:10 +0000 (10:57 +0900)] 
certtool: avoid 1-byte write buffer overrun when parsing template

Previously, when parsing a template file with a number of key value
pairs, certtool could write a NUL byte after the heap buffer, causing
a memory corruption. This fixes the issue by allocating the NUL byte.
Reported by David Aitel.

Signed-off-by: Daiki Ueno <ueno@gnu.org>
10 months agox509: avoid double free when exporting othernames in SAN
Daiki Ueno [Mon, 7 Jul 2025 01:44:12 +0000 (10:44 +0900)] 
x509: avoid double free when exporting othernames in SAN

Previously, the _gnutls_write_new_othername function, called by
gnutls_x509_ext_export_subject_alt_names to export "otherName" in a
certificate's SAN extension, freed the caller allocated ASN.1
structure upon error, resulting in a potential double-free.

Reported by OpenAI Security Research Team.

Signed-off-by: Daiki Ueno <ueno@gnu.org>
10 months agox509: reject zero-length version in certificate request
Andrew Hamilton [Mon, 7 Jul 2025 01:35:54 +0000 (10:35 +0900)] 
x509: reject zero-length version in certificate request

Ensure zero size asn1 values are considered invalid in
gnutls_x509_crq_get_version, this ensures crq version is not used
uninitialized. Spotted by oss-fuzz at:
https://issues.oss-fuzz.com/issues/42536706

Signed-off-by: Andrew Hamilton <adhamilt@gmail.com>
Signed-off-by: Daiki Ueno <ueno@gnu.org>
10 months agopsk: fix read buffer overrun in the "pre_shared_key" extension
Andrew Hamilton [Mon, 7 Jul 2025 01:31:55 +0000 (10:31 +0900)] 
psk: fix read buffer overrun in the "pre_shared_key" extension

While processing the "pre_shared_key" extension in TLS 1.3, if there
are certain malformed data in the extension headers, then the code may
read uninitialized memory (2 bytes) beyond the received TLS extension
buffer. Spotted by oss-fuzz at:
https://issues.oss-fuzz.com/issues/42513990

Signed-off-by: Andrew Hamilton <adhamilt@gmail.com>
Signed-off-by: Daiki Ueno <ueno@gnu.org>
10 months agox509: fix read buffer overrun in SCT timestamps
Andrew Hamilton [Mon, 7 Jul 2025 01:23:59 +0000 (10:23 +0900)] 
x509: fix read buffer overrun in SCT timestamps

Prevent reading beyond heap buffer in call to _gnutls_parse_ct_sct
when processing x509 Signed Certificate Timestamps with certain
malformed data. Spotted by oss-fuzz at:
https://issues.oss-fuzz.com/issues/42530513

Signed-off-by: Andrew Hamilton <adhamilt@gmail.com>
Signed-off-by: Daiki Ueno <ueno@gnu.org>
10 months agoMerge branch 'wip/dueno/pkcs11-provider-docs' into 'master'
Daiki Ueno [Mon, 7 Jul 2025 21:51:04 +0000 (06:51 +0900)] 
Merge branch 'wip/dueno/pkcs11-provider-docs' into 'master'

Add documentation for the pkcs#11-provider

See merge request gnutls/gnutls!1978

10 months agoAdd NEWS entry for the PKCS#11 provider [skip ci]
Zoltan Fridrich [Mon, 7 Jul 2025 08:09:00 +0000 (10:09 +0200)] 
Add NEWS entry for the PKCS#11 provider [skip ci]

Signed-off-by: Zoltan Fridrich <zfridric@redhat.com>
10 months agoAdd documentation for the pkcs#11-provider
Zoltan Fridrich [Mon, 7 Jul 2025 08:02:20 +0000 (10:02 +0200)] 
Add documentation for the pkcs#11-provider

Signed-off-by: Zoltan Fridrich <zfridric@redhat.com>
10 months agoMerge branch 'wip/dueno/pkcs11-provider-fixes' into 'master'
Daiki Ueno [Mon, 7 Jul 2025 07:44:11 +0000 (16:44 +0900)] 
Merge branch 'wip/dueno/pkcs11-provider-fixes' into 'master'

Minor build fixes for pkcs11-provider

See merge request gnutls/gnutls!1975

10 months agobuild: fix build with --with-included-libtasn1
Daiki Ueno [Mon, 7 Jul 2025 07:44:11 +0000 (16:44 +0900)] 
build: fix build with --with-included-libtasn1

As libminitasn1.la is always built a static library, linking it twice
makes linking fail because of duplicated symbols. This also stops
including <nettle/bignum.h> as it is unused and causing compile error
on macOS homebrew:

  In file included from p11_pk.c:32:
  /opt/homebrew/Cellar/nettle/3.10.2/include/nettle/bignum.h:50:11: fatal error: 'gmp.h' file not found
  # include <gmp.h>
            ^~~~~~~
  1 error generated.

Signed-off-by: Daiki Ueno <ueno@gnu.org>
10 months agoMerge branch 'patch5' into 'master'
Daiki Ueno [Sat, 5 Jul 2025 00:56:36 +0000 (09:56 +0900)] 
Merge branch 'patch5' into 'master'

lib/hello_ext.c: Add gnutls_free() to avoid memory leak

See merge request gnutls/gnutls!1955

10 months agolib/hello_ext.c: Add gnutls_free() to avoid memory leak
Jiasheng Jiang [Sat, 5 Jul 2025 00:56:36 +0000 (00:56 +0000)] 
lib/hello_ext.c: Add gnutls_free() to avoid memory leak

Add gnutls_free() to free tmp_mod.name in the error handling to avoid memory leak.

Fixes: 5bba569b4 ("gnutls_session_ext_register: keep track of extension name")
Signed-off-by: JiashengJiang <jiasheng@purdue.edu>
10 months agoMerge branch 'patch4' into 'master'
Daiki Ueno [Sat, 5 Jul 2025 00:55:17 +0000 (09:55 +0900)] 
Merge branch 'patch4' into 'master'

lib/x509/x509_ext.c: Add gnutls_free() to avoid memory leak

See merge request gnutls/gnutls!1954

10 months agolib/x509/x509_ext.c: Add gnutls_free() to avoid memory leak
Jiasheng Jiang [Sat, 5 Jul 2025 00:55:17 +0000 (00:55 +0000)] 
lib/x509/x509_ext.c: Add gnutls_free() to avoid memory leak

Add gnutls_free() to free ooc if subject_alt_names_set() fails to avoid memory leak.

Fixes: 2bd323f72 ("Added new API to handle X.509 extensions.")
Signed-off-by: JiashengJiang <jiasheng@purdue.edu>
10 months agoMerge branch 'patch8' into 'master'
Daiki Ueno [Sat, 5 Jul 2025 00:49:56 +0000 (09:49 +0900)] 
Merge branch 'patch8' into 'master'

tests/x509-cert-callback-ocsp.c: Free p and certs on error to avoid memory leak

See merge request gnutls/gnutls!1958

10 months agotests/x509-cert-callback-ocsp.c: Free p and certs on error to avoid memory leak
Jiasheng Jiang [Sat, 5 Jul 2025 00:49:56 +0000 (00:49 +0000)] 
tests/x509-cert-callback-ocsp.c: Free p and certs on error to avoid memory leak

Call gnutls_free() to release p and certs on error, preventing a memory leak.

Fixes: db486d97c ("tests: enhanced OCSP tests")
Signed-off-by: JiashengJiang <jiasheng@purdue.edu>
10 months agoMerge branch 'patch10' into 'master'
Daiki Ueno [Sat, 5 Jul 2025 00:49:09 +0000 (09:49 +0900)] 
Merge branch 'patch10' into 'master'

tests/x509-cert-callback.c: Free p and certs on error to avoid memory leak

See merge request gnutls/gnutls!1960

10 months agotests/x509-cert-callback.c: Free p and certs on error to avoid memory leak
Jiasheng Jiang [Sat, 5 Jul 2025 00:49:09 +0000 (00:49 +0000)] 
tests/x509-cert-callback.c: Free p and certs on error to avoid memory leak

Call gnutls_free() to release p and certs on error, preventing a memory leak.

Fixes: ed02ed050 ("tests: added check with X.509 certificates and callbacks")
Signed-off-by: JiashengJiang <jiasheng@purdue.edu>