]> git.ipfire.org Git - thirdparty/gnutls.git/log
thirdparty/gnutls.git
4 months agotests/suite/testdane.sh: add more HTTPS hosts
Alexander Sosedkin [Fri, 16 Jan 2026 16:57:41 +0000 (17:57 +0100)] 
tests/suite/testdane.sh: add more HTTPS hosts

Signed-off-by: Alexander Sosedkin <asosedkin@redhat.com>
4 months agotests/suite/testdane.sh: insignificant tweaks
Alexander Sosedkin [Fri, 16 Jan 2026 16:42:25 +0000 (17:42 +0100)] 
tests/suite/testdane.sh: insignificant tweaks

Signed-off-by: Alexander Sosedkin <asosedkin@redhat.com>
4 months agoMerge branch 'mtheil/clear-rnd-state' into 'master'
Daiki Ueno [Wed, 14 Jan 2026 09:40:03 +0000 (18:40 +0900)] 
Merge branch 'mtheil/clear-rnd-state' into 'master'

rnd: always clear internal RNG state and confidential temporary data

See merge request gnutls/gnutls!2051

4 months agornd: always clear internal RNG state and confidential temporary data
Markus Theil [Tue, 13 Jan 2026 11:05:13 +0000 (12:05 +0100)] 
rnd: always clear internal RNG state and confidential temporary data

Internal RNG state should not be left in memory after deallocating
the RNG or exiting a process using GnuTLS. Fix this for the ChaCha20
based RNG implementation. The FIPS RNG impl. already does this, due
to FIPS requirements.

Signed-off-by: Markus Theil <theil.markus@gmail.com>
4 months agoMerge branch 'fix/large-srp-group-stack-buff-overflow' into 'master'
Daiki Ueno [Wed, 14 Jan 2026 08:05:44 +0000 (17:05 +0900)] 
Merge branch 'fix/large-srp-group-stack-buff-overflow' into 'master'

srptool: fix stack buffer overflow with large SRP groups

Closes #1777

See merge request gnutls/gnutls!2050

4 months agosrptool: fix stack buffer overflow with large SRP groups
Dmitrichenko Mikhail [Mon, 12 Jan 2026 10:28:14 +0000 (10:28 +0000)] 
srptool: fix stack buffer overflow with large SRP groups

The static buffer result in _srp_crypt() was only 1024 bytes, while the
8192-bit SRP group code produces base64-encoded verifier of 1366
characters.

Using sprintf() with the old buffer caused a stack buffer overflow
(undefined behaviour) when --index=6 or --index=7 was used.

This commit:
- increases the static buffer size to 2048 bytes (sufficient for all
  currently supported groups),
- replaces sprintf() with snprintf() to prevent overflow even if the
  buffer were accidentally too small.

Found by Linux Verification Center (linuxtesting.org) with SVACE.

Fixes: #1777
Signed-off-by: Mikhail Dmitrichenko <m.dmitrichenko222@gmail.com>
4 months agolib: add support for Hygon Genuine CPUs in x86 acceleration
xinpeng.wang [Wed, 14 Jan 2026 05:19:46 +0000 (13:19 +0800)] 
lib: add support for Hygon Genuine CPUs in x86 acceleration

Hygon CPUs (HygonGenuine) share the same AES-NI and other crypto
instruction sets with AMD Zen architecture. However, they were previously
falling back to the generic software provider because the vendor check
only recognized Intel and AMD.

This fallback to the software provider (Nettle wrapper) could lead to
numerical issues or crashes (e.g., divide-by-zero) in certain
environments like Photoshop.

This patch:
1. Adds X86_CPU_VENDOR_HYGON to x86_cpu_vendor enum.
2. Updates check_x86_cpu_vendor() to recognize Hygon CPUs.
3. Enables hardware acceleration for Hygon CPUs.

Signed-off-by: xinpeng.wang <wangxinpeng@uniontech.com>
4 months agoMerge branch 'wip/dueno/doc-update-copyright-year' into 'master'
Daiki Ueno [Wed, 14 Jan 2026 04:57:58 +0000 (13:57 +0900)] 
Merge branch 'wip/dueno/doc-update-copyright-year' into 'master'

Update year of copyright notices in doc/gnutls.texi

See merge request gnutls/gnutls!2052

4 months agoUpdate year of copyright notices in doc/gnutls.texi
Daiki Ueno [Wed, 14 Jan 2026 04:27:49 +0000 (13:27 +0900)] 
Update year of copyright notices in doc/gnutls.texi

Signed-off-by: Daiki Ueno <ueno@gnu.org>
4 months agoMerge branch 'wip/dueno/pkcs11-thread-fixes' into 'master'
Daiki Ueno [Tue, 6 Jan 2026 01:14:30 +0000 (10:14 +0900)] 
Merge branch 'wip/dueno/pkcs11-thread-fixes' into 'master'

pkcs11: properly fall back to thread-unsafe module init

Closes #1774

See merge request gnutls/gnutls!2049

5 months agopkcs11: fix module name resolution for unconfigured modules
Daiki Ueno [Mon, 22 Dec 2025 09:20:25 +0000 (18:20 +0900)] 
pkcs11: fix module name resolution for unconfigured modules

When a PKCS#11 module is not configured, p11_kit_module_get_name()
returns NULL. In that case, use the filename instead.

Signed-off-by: Daiki Ueno <ueno@gnu.org>
5 months agopkcs11: properly fall back to thread-unsafe module init
Daiki Ueno [Mon, 22 Dec 2025 06:29:06 +0000 (15:29 +0900)] 
pkcs11: properly fall back to thread-unsafe module init

The PKCS#11 module initialization logic introduced in
aa5f15a872e62e54abe58624ee393e68d1faf689 first attempts to initialize
the module with CKR_NEED_TO_CREATE_THREADS|CKF_OS_LOCKING_OK, which
may return either CKR_CANT_LOCK or CKR_NEED_TO_CREATE_THREADS, where
the latter was previously treated as a hard error. This fixes it and
also makes the second attempt to not supply any flags.

Signed-off-by: Daiki Ueno <ueno@gnu.org>
5 months agoMerge branch 'wip/dueno/hash-output' into 'master'
Daiki Ueno [Sun, 7 Dec 2025 15:01:40 +0000 (00:01 +0900)] 
Merge branch 'wip/dueno/hash-output' into 'master'

accelerated: accept NULL as digest argument for gnutls_hash_output

Closes #1769

See merge request gnutls/gnutls!2048

5 months agotests/slow: set TEST_EXTENSIONS for wrappers
Daiki Ueno [Tue, 2 Dec 2025 02:42:05 +0000 (11:42 +0900)] 
tests/slow: set TEST_EXTENSIONS for wrappers

Signed-off-by: Daiki Ueno <ueno@gnu.org>
5 months agocrypto-selftests: exercise gnutls_hash_output(..., NULL)
Daiki Ueno [Tue, 2 Dec 2025 00:33:22 +0000 (09:33 +0900)] 
crypto-selftests: exercise gnutls_hash_output(..., NULL)

This moves the test introduced in commit
7a7d3e44c0f769eb7bae6c6ee21a0a8a3f9e5144, from tests/slow/hash-large.c
to the library selftests, because the former is tailored for
excessively large input, ignoring SIGSEGV.

Signed-off-by: Daiki Ueno <ueno@gnu.org>
5 months agoMerge branch 'wip/dueno/release-3.8.11-post' into 'master'
Daiki Ueno [Tue, 2 Dec 2025 23:59:47 +0000 (08:59 +0900)] 
Merge branch 'wip/dueno/release-3.8.11-post' into 'master'

Post-release administrivia

See merge request gnutls/gnutls!2047

6 months agoaccelerated: accept NULL as digest argument for gnutls_hash_output
Daiki Ueno [Tue, 2 Dec 2025 06:10:37 +0000 (15:10 +0900)] 
accelerated: accept NULL as digest argument for gnutls_hash_output

As a follow-up of commit eced4c0c2b3d3ee6a35dab99616a25910b623f79 this
also extends the accelerated version of gnutls_hash_output to be able
to reset the context by passing NULL as the digest argument.

Signed-off-by: Daiki Ueno <ueno@gnu.org>
6 months agodevel/release-steps.md: update CI job name to the latest
Daiki Ueno [Mon, 1 Dec 2025 09:16:06 +0000 (18:16 +0900)] 
devel/release-steps.md: update CI job name to the latest

Signed-off-by: Daiki Ueno <ueno@gnu.org>
6 months agoabi-dump: update git submodule
Daiki Ueno [Thu, 20 Nov 2025 09:27:14 +0000 (18:27 +0900)] 
abi-dump: update git submodule

Signed-off-by: Daiki Ueno <ueno@gnu.org>
6 months agoMerge branch 'ci-f42' into 'master'
Daiki Ueno [Wed, 26 Nov 2025 03:56:23 +0000 (12:56 +0900)] 
Merge branch 'ci-f42' into 'master'

CI: move to Fedora 42

See merge request gnutls/gnutls!2039

6 months ago.gitlab-ci.yml: move i686 to a separate image
Alexander Sosedkin [Thu, 6 Nov 2025 18:31:59 +0000 (19:31 +0100)] 
.gitlab-ci.yml: move i686 to a separate image

Signed-off-by: Alexander Sosedkin <asosedkin@redhat.com>
6 months agoMerge branch 'master' into 'master'
Daiki Ueno [Tue, 25 Nov 2025 12:37:47 +0000 (21:37 +0900)] 
Merge branch 'master' into 'master'

Add missing copyright/license headers

See merge request gnutls/gnutls!2046

6 months agoMerge branch 'fix_crau_with_old_gcc' into 'master'
Daiki Ueno [Tue, 25 Nov 2025 12:37:23 +0000 (21:37 +0900)] 
Merge branch 'fix_crau_with_old_gcc' into 'master'

audit: crau: fix compilation with gcc < 11

See merge request gnutls/gnutls!2045

6 months agoAdd missing copyright/license headers
Krenzelok Frantisek [Mon, 24 Nov 2025 15:02:23 +0000 (16:02 +0100)] 
Add missing copyright/license headers

Signed-off-by: Krenzelok Frantisek <krenzelok.frantisek@gmail.com>
6 months ago.gitlab-ci.yml: move mingw and cross jobs to Fedora 42
Alexander Sosedkin [Wed, 5 Nov 2025 12:22:08 +0000 (13:22 +0100)] 
.gitlab-ci.yml: move mingw and cross jobs to Fedora 42

Signed-off-by: Alexander Sosedkin <asosedkin@redhat.com>
6 months ago.gitlab-ci.yml: move vanilla Fedora jobs to Fedora 42
Alexander Sosedkin [Mon, 3 Nov 2025 15:06:21 +0000 (16:06 +0100)] 
.gitlab-ci.yml: move vanilla Fedora jobs to Fedora 42

Signed-off-by: Alexander Sosedkin <asosedkin@redhat.com>
6 months agoaudit: crau: fix compilation with gcc < 11
Julien Olivain [Sun, 23 Nov 2025 17:17:19 +0000 (18:17 +0100)] 
audit: crau: fix compilation with gcc < 11

If the CRAU_MAYBE_UNUSED macro is unset, the crau.h file tries to
automatically detect an appropriate value for it.

This autodetection is using the cpp special operator
`__has_c_attribute` [1], introduced in gcc 11 [2].

When compiling with a gcc older than version 11, the compilation fails
with the error:

    In file included from audit.h:22,
                     from audit.c:26:
    crau/crau.h:255:23: error: missing binary operator before token "("
         __has_c_attribute (__maybe_unused__)
                           ^

This has been observed, for example, in Rocky Linux 8.10, which
contains a gcc v8.5.0.

The issue happens because the test for the `__has_c_attribute`
availability and the test for the `__maybe_unused__` attribute
are in the same directive. Those tests should be separated in
two different directives, following the same logic described in
the `__has_builtin` documentation [3].

This issue was found in Buildroot, after updating gnutls to
version 3.8.11 in [4].

This commit fixes the issue by splitting the test in two.

[1] https://gcc.gnu.org/onlinedocs/cpp/_005f_005fhas_005fc_005fattribute.html
[2] https://gcc.gnu.org/gcc-11/changes.html#c
[3] https://gcc.gnu.org/onlinedocs/cpp/_005f_005fhas_005fbuiltin.html
[4] https://gitlab.com/buildroot.org/buildroot/-/commit/81dbfe1c2ae848b4eb1f896198d13455df50e548

Reported-by: Neal Frager <neal.frager@amd.com>
Signed-off-by: Julien Olivain <ju.o@free.fr>
6 months agoMerge branch 'missing-includes' into 'master'
Daiki Ueno [Fri, 21 Nov 2025 07:16:26 +0000 (16:16 +0900)] 
Merge branch 'missing-includes' into 'master'

mem: include headers for size_t and uint8_t

Closes #1764

See merge request gnutls/gnutls!2044

6 months agomem: include headers for size_t and uint8_t
Jan Palus [Thu, 20 Nov 2025 17:51:59 +0000 (18:51 +0100)] 
mem: include headers for size_t and uint8_t

Fixes: #1764
Signed-off-by: Jan Palus <jpalus@fastmail.com>
6 months agoMerge branch 'wip/dueno/release-3.8.11-symbols' into 'master' 3.8.11
Daiki Ueno [Thu, 20 Nov 2025 01:48:28 +0000 (10:48 +0900)] 
Merge branch 'wip/dueno/release-3.8.11-symbols' into 'master'

build: update symbols.last to include gnutls_audit_* functions

See merge request gnutls/gnutls!2043

6 months agobuild: update symbols.last to include gnutls_audit_* functions
Daiki Ueno [Wed, 19 Nov 2025 23:52:53 +0000 (08:52 +0900)] 
build: update symbols.last to include gnutls_audit_* functions

Signed-off-by: Daiki Ueno <ueno@gnu.org>
6 months agoMerge branch 'wip/dueno/release-3.8.11' into 'master'
Daiki Ueno [Wed, 19 Nov 2025 15:05:15 +0000 (00:05 +0900)] 
Merge branch 'wip/dueno/release-3.8.11' into 'master'

Release 3.8.11

See merge request gnutls/gnutls!2041

6 months agoRelease 3.8.11
Daiki Ueno [Tue, 18 Nov 2025 00:05:29 +0000 (09:05 +0900)] 
Release 3.8.11

Signed-off-by: Daiki Ueno <ueno@gnu.org>
6 months agopkcs11: avoid stack overwrite when initializing a token
Daiki Ueno [Tue, 18 Nov 2025 04:17:55 +0000 (13:17 +0900)] 
pkcs11: avoid stack overwrite when initializing a token

If gnutls_pkcs11_token_init is called with label longer than 32
characters, the internal storage used to blank-fill it would
overflow. This adds a guard to prevent that.

Signed-off-by: Daiki Ueno <ueno@gnu.org>
6 months agobuild: bump Nettle version requirement from 3.6 to 3.10
Daiki Ueno [Tue, 18 Nov 2025 00:28:26 +0000 (09:28 +0900)] 
build: bump Nettle version requirement from 3.6 to 3.10

Given Nettle 3.10 is ABI compatible with 3.6 and includes several
security relevant fixes, this updates the library's minimum
requirement of Nettle to 3.10. The bundled code will stay for the
next couple of release cycles in case any downstream issues are found,
as suggested in:
https://lists.gnupg.org/pipermail/gnutls-help/2025-November/004905.html

Signed-off-by: Daiki Ueno <ueno@gnu.org>
6 months agolib: clarify docs for gnutls_credentials_set
Daniel P. BerrangĂ© [Wed, 29 Oct 2025 13:29:34 +0000 (13:29 +0000)] 
lib: clarify docs for gnutls_credentials_set

Make it explicit that only a single credentials object of a given
type may be set against a session. Any further attempts to set
credentials for a type will replace previously set crdentials.
The act of replacement also allows the previously set credentials
to be freed by the caller.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
6 months agolib/kx: Only report file open error if there is an error
Alistair Francis [Thu, 9 Oct 2025 04:57:08 +0000 (14:57 +1000)] 
lib/kx: Only report file open error if there is an error

Previously all attempts to open a `SSLKEYLOGFILE` would result in a
"unable to open keylog file" regardless of if the file was opened or
not. Instead let's only report the issue if the file fails to open.

Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
6 months agoMerge branch 'ci-pre-f42' into 'master'
Daiki Ueno [Wed, 19 Nov 2025 11:46:25 +0000 (20:46 +0900)] 
Merge branch 'ci-pre-f42' into 'master'

CI: assorted fixes in preparation for moving it to Fedora 42

See merge request gnutls/gnutls!2042

6 months ago.gitlab-ci.yml: run all the jobs untagged...
Alexander Sosedkin [Wed, 19 Nov 2025 10:02:53 +0000 (11:02 +0100)] 
.gitlab-ci.yml: run all the jobs untagged...

... to let them use either self-hosted runners
or saas-linux-small-amd64 GitLab-hosted runners.

Also revert `except: [tags]` resource preservation measure.

Signed-off-by: Alexander Sosedkin <asosedkin@redhat.com>
6 months ago.gitlab-ci.yml: move fedora-docdist to a doc image
Alexander Sosedkin [Thu, 6 Nov 2025 11:38:30 +0000 (12:38 +0100)] 
.gitlab-ci.yml: move fedora-docdist to a doc image

Signed-off-by: Alexander Sosedkin <asosedkin@redhat.com>
6 months ago.gitlab-ci.yml: register binfmt handlers only if missing
Alexander Sosedkin [Tue, 11 Nov 2025 19:53:06 +0000 (20:53 +0100)] 
.gitlab-ci.yml: register binfmt handlers only if missing

Signed-off-by: Alexander Sosedkin <asosedkin@redhat.com>
6 months ago.gitlab-ci.yml: remove bz2049401 workaround
Alexander Sosedkin [Thu, 6 Nov 2025 09:58:52 +0000 (10:58 +0100)] 
.gitlab-ci.yml: remove bz2049401 workaround

Signed-off-by: Alexander Sosedkin <asosedkin@redhat.com>
6 months ago.gitlab-ci.yml: enable binfmt for mingw
Alexander Sosedkin [Thu, 6 Nov 2025 09:57:43 +0000 (10:57 +0100)] 
.gitlab-ci.yml: enable binfmt for mingw

Signed-off-by: Alexander Sosedkin <asosedkin@redhat.com>
6 months agotests/suite/tls-interoperability: update submodule
Alexander Sosedkin [Thu, 6 Nov 2025 09:52:40 +0000 (10:52 +0100)] 
tests/suite/tls-interoperability: update submodule

Signed-off-by: Alexander Sosedkin <asosedkin@redhat.com>
6 months ago.gitlab-ci.yml: GIT_STRATEGY: clone for commit-check
Alexander Sosedkin [Thu, 6 Nov 2025 10:38:26 +0000 (11:38 +0100)] 
.gitlab-ci.yml: GIT_STRATEGY: clone for commit-check

Signed-off-by: Alexander Sosedkin <asosedkin@redhat.com>
6 months agodevel/check_if_signed: fix a condition
Alexander Sosedkin [Thu, 6 Nov 2025 10:35:42 +0000 (11:35 +0100)] 
devel/check_if_signed: fix a condition

Signed-off-by: Alexander Sosedkin <asosedkin@redhat.com>
6 months agotests/pkcs11-provider: match token with --provider when initializing
Daiki Ueno [Mon, 17 Nov 2025 23:57:43 +0000 (08:57 +0900)] 
tests/pkcs11-provider: match token with --provider when initializing

Even if the "module-path" query attribute is given in the PKCS#11 URI,
p11tool does not filter tokens based on that when called with
--initialize. As this is not part of the pkcs11-provider
functionality, use --provider option to specify the token.

Also defer the settings of GNUTLS_SYSTEM_PRIORITY_FILE and
GNUTLS_SYSTEM_PRIORITY_FAIL_ON_INVALID after the token initialization.

Signed-off-by: Daiki Ueno <ueno@gnu.org>
6 months agolib/Makefile: remove audit_int.h reference
Alexander Sosedkin [Thu, 6 Nov 2025 18:06:55 +0000 (19:06 +0100)] 
lib/Makefile: remove audit_int.h reference

Signed-off-by: Alexander Sosedkin <asosedkin@redhat.com>
6 months agoMerge branch 'wip/devkdas/audit' into 'master'
Daiki Ueno [Mon, 17 Nov 2025 21:20:24 +0000 (06:20 +0900)] 
Merge branch 'wip/devkdas/audit' into 'master'

Add missing parameter documentation in lib/audit.c

See merge request gnutls/gnutls!2040

6 months agoAdd missing parameter documentation in lib/audit.c
Karthik Das [Sun, 16 Nov 2025 08:31:29 +0000 (08:31 +0000)] 
Add missing parameter documentation in lib/audit.c

Signed-off-by: Karthik Das <kartheekdasari1998@gmail.com>
6 months agoMerge branch 'wip/dueno/usretc' into 'master'
Daiki Ueno [Thu, 6 Nov 2025 22:13:30 +0000 (07:13 +0900)] 
Merge branch 'wip/dueno/usretc' into 'master'

Assorted build fixes and improvements

See merge request gnutls/gnutls!2036

7 months agobuild: ignore new functions at "make abi-check-latest"
Daiki Ueno [Wed, 29 Oct 2025 03:45:00 +0000 (12:45 +0900)] 
build: ignore new functions at "make abi-check-latest"

Signed-off-by: Daiki Ueno <ueno@gnu.org>
7 months agobuild: pacify GCC analyzer false-positive in src/ocsptool.c
Daiki Ueno [Fri, 31 Oct 2025 04:08:20 +0000 (13:08 +0900)] 
build: pacify GCC analyzer false-positive in src/ocsptool.c

Without the guard (chain_size - 1), GCC analyzer spews the warning
below, which should be a false-positive:

ocsptool.c:532:32: warning: use of uninitialized value 'chain[1]' [CWE-457] [-Wanalyzer-use-of-uninitialized-value]
  532 |                         signer = chain[1];
      |                         ~~~~~~~^~~~~~~~~~

Signed-off-by: Daiki Ueno <ueno@gnu.org>
7 months agolib: Fix Wunterminated-string-initialization warnings
Samuel Zeter [Tue, 14 Oct 2025 16:00:26 +0000 (18:00 +0200)] 
lib: Fix Wunterminated-string-initialization warnings

Building on a newer gcc version (15) results in the following warnings:

status_request.c: In function 'client_send':
status_request.c:71:33: warning: initializer-string for array of 'unsigned char' truncates NUL terminator but destination lacks 'nonstring' attribute (6 chars into 5 available) [-Wunterminated-string-initialization]
   71 |         const uint8_t data[5] = "\x01\x00\x00\x00\x00";
      |                                 ^~~~~~~~~~~~~~~~~~~~~~
x86-common.c: In function 'check_phe_partial':
x86-common.c:342:31: warning: initializer-string for array of 'char' truncates NUL terminator but destination lacks 'nonstring' attribute (65 chars into 64 available) [-Wunterminated-string-initialization]
  342 |         const char text[64] = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
      |
      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Signed-off-by: Samuel Zeter <samuelzeter@gmail.com>
Modified-by: Daiki Ueno <ueno@gnu.org>
7 months agobuild: exclude duplicate entries in src/mech-list.h
Daiki Ueno [Fri, 31 Oct 2025 02:16:28 +0000 (11:16 +0900)] 
build: exclude duplicate entries in src/mech-list.h

Signed-off-by: Daiki Ueno <ueno@gnu.org>
7 months agobuild: derive the location of default config file from $sysconfdir
Daiki Ueno [Thu, 30 Oct 2025 05:12:54 +0000 (14:12 +0900)] 
build: derive the location of default config file from $sysconfdir

Previously we hard-coded "/etc" as part of the path of the default
configuration file. It is more palatable to respect the --sysconfdir
configure option and locate the file there.

Per recommendation at [1], the path is expanded at "make" time, not at
"configure" time.

1. https://www.gnu.org/savannah-checkouts/gnu/autoconf/manual/autoconf-2.72/html_node/Installation-Directory-Variables.html

Signed-off-by: Daiki Ueno <ueno@gnu.org>
7 months agoMerge branch 'wip/dueno/strict-prototypes' into 'master'
Daiki Ueno [Tue, 28 Oct 2025 00:38:15 +0000 (09:38 +0900)] 
Merge branch 'wip/dueno/strict-prototypes' into 'master'

build: fix compiler warnings with -Wstrict-prototypes

Closes #1754

See merge request gnutls/gnutls!2031

7 months agobuild: fix compiler warnings with -Wstrict-prototypes
Daiki Ueno [Fri, 24 Oct 2025 06:33:45 +0000 (15:33 +0900)] 
build: fix compiler warnings with -Wstrict-prototypes

Signed-off-by: Daiki Ueno <ueno@gnu.org>
7 months agoMerge branch 'wip/dueno/ecc-privkey' into 'master'
Daiki Ueno [Wed, 22 Oct 2025 11:01:17 +0000 (20:01 +0900)] 
Merge branch 'wip/dueno/ecc-privkey' into 'master'

x509: encode ECDSA private key in fixed length

Closes #1747

See merge request gnutls/gnutls!2030

7 months agox509: encode ECDSA private key in fixed length
Daiki Ueno [Mon, 20 Oct 2025 07:42:36 +0000 (16:42 +0900)] 
x509: encode ECDSA private key in fixed length

RFC 5915 section 3 says that the privateKey field of ECPrivateKey
structure should be fixed length, though the library encoded it in
variable length, depending on the leading byte. This patch enforces
that the field is always encoded in fixed length, as well as
consolidates the code paths for EdDSA and X25519/X448 keys.

Signed-off-by: Daiki Ueno <ueno@gnu.org>
7 months agoMerge branch 'wip/dueno/usdt-followup2' into 'master'
Daiki Ueno [Sat, 18 Oct 2025 06:10:20 +0000 (15:10 +0900)] 
Merge branch 'wip/dueno/usdt-followup2' into 'master'

audit: wrap crau interface and expose it partly as public API

See merge request gnutls/gnutls!2028

7 months agoaudit: wrap crau interface and expose it partly as public API
Daiki Ueno [Tue, 14 Oct 2025 05:32:33 +0000 (14:32 +0900)] 
audit: wrap crau interface and expose it partly as public API

This adds 3 new functions: gnutls_audit_push_context,
gnutls_audit_pop_context, and gnutls_audit_current_context, which
would be useful when the applications define their own crypto-auditing
probe points.

Signed-off-by: Daiki Ueno <ueno@gnu.org>
7 months agoconfigure: disable crypto-auditing support by default
Daiki Ueno [Tue, 14 Oct 2025 05:57:00 +0000 (14:57 +0900)] 
configure: disable crypto-auditing support by default

Signed-off-by: Daiki Ueno <ueno@gnu.org>
7 months agoMerge branch 'wip/dueno/usdt-followup' into 'master'
Daiki Ueno [Fri, 10 Oct 2025 23:33:58 +0000 (08:33 +0900)] 
Merge branch 'wip/dueno/usdt-followup' into 'master'

m4/hooks.m4: check <sys/sdt.h> defines DTrace compatible macros

See merge request gnutls/gnutls!2026

7 months agoconfigure: fix faketime detection
Daiki Ueno [Thu, 9 Oct 2025 00:21:29 +0000 (09:21 +0900)] 
configure: fix faketime detection

This fixes the cache variable name (gnutls_cv_prog_faketime_works, not
gnutls_cv_faketime_works), and avoids extraneous output from the
configure.

Signed-off-by: Daiki Ueno <ueno@gnu.org>
7 months agopo: ignore new files introduced by gettext
Daiki Ueno [Thu, 9 Oct 2025 00:11:06 +0000 (09:11 +0900)] 
po: ignore new files introduced by gettext

Signed-off-by: Daiki Ueno <ueno@gnu.org>
7 months agom4/hooks.m4: check <sys/sdt.h> defines DTrace compatible macros
Daiki Ueno [Thu, 9 Oct 2025 00:09:59 +0000 (09:09 +0900)] 
m4/hooks.m4: check <sys/sdt.h> defines DTrace compatible macros

On macOS, <sys/sdt.h> defines a different interface than on
GNU/Linux. Check if DTRACE_PROBE* macros are actually usable.

Signed-off-by: Daiki Ueno <ueno@gnu.org>
7 months agoMerge branch 'wip/dueno/usdt2' into 'master'
Daiki Ueno [Mon, 6 Oct 2025 13:07:41 +0000 (22:07 +0900)] 
Merge branch 'wip/dueno/usdt2' into 'master'

Instrument crypto-auditing probes

See merge request gnutls/gnutls!2019

7 months agoMerge branch 'wip/szeter/fix-prvk-pkcs8' into 'master'
Daiki Ueno [Mon, 6 Oct 2025 10:59:19 +0000 (19:59 +0900)] 
Merge branch 'wip/szeter/fix-prvk-pkcs8' into 'master'

x509: Remove extraneous asn1_delete

See merge request gnutls/gnutls!2025

7 months agox509: Remove misleading comments
Samuel Zeter [Thu, 2 Oct 2025 15:20:58 +0000 (01:20 +1000)] 
x509: Remove misleading comments

These comments were originally from an old function called
check_schema() which has since been removed.

Signed-off-by: Samuel Zeter <samuelzeter@gmail.com>
7 months agox509: Remove extraneous asn1_delete
Samuel Zeter [Thu, 2 Oct 2025 15:06:30 +0000 (01:06 +1000)] 
x509: Remove extraneous asn1_delete

No need for deletion given we already call asn1_delete_structure2.

Signed-off-by: Samuel Zeter <samuelzeter@gmail.com>
7 months agoMerge branch 'wip/purdue-university1/gnutls-free' into 'master'
Daiki Ueno [Mon, 6 Oct 2025 08:32:26 +0000 (17:32 +0900)] 
Merge branch 'wip/purdue-university1/gnutls-free' into 'master'

lib/nettle/int/drbg-aes-self-test: Replace free() with gnutls_free()

See merge request gnutls/gnutls!2024

7 months agotls-sig: instrument crypto-auditing probes
Daiki Ueno [Thu, 2 Oct 2025 05:11:42 +0000 (14:11 +0900)] 
tls-sig: instrument crypto-auditing probes

Signed-off-by: Daiki Ueno <ueno@gnu.org>
7 months ago_gnutls_handshake_sign_data: resolve signing algorithm only once
Daiki Ueno [Thu, 2 Oct 2025 08:56:37 +0000 (17:56 +0900)] 
_gnutls_handshake_sign_data: resolve signing algorithm only once

This avoids unnecessary look up of algorithm entry.

Signed-off-by: Daiki Ueno <ueno@gnu.org>
7 months agokey_share: instrument crypto-auditing probes
Daiki Ueno [Wed, 24 Sep 2025 04:23:09 +0000 (13:23 +0900)] 
key_share: instrument crypto-auditing probes

Signed-off-by: Daiki Ueno <ueno@gnu.org>
7 months agohandshake: instrument crypto-auditing probes
Daiki Ueno [Wed, 24 Sep 2025 01:38:07 +0000 (10:38 +0900)] 
handshake: instrument crypto-auditing probes

Signed-off-by: Daiki Ueno <ueno@gnu.org>
7 months agopk: instrument crypto-auditing probes
Daiki Ueno [Tue, 2 Sep 2025 08:45:27 +0000 (17:45 +0900)] 
pk: instrument crypto-auditing probes

Signed-off-by: Daiki Ueno <ueno@gnu.org>
7 months agobuild: bundle crypto-auditing helper library as copylib
Daiki Ueno [Tue, 25 Oct 2022 07:27:16 +0000 (16:27 +0900)] 
build: bundle crypto-auditing helper library as copylib

Signed-off-by: Daiki Ueno <ueno@gnu.org>
Co-authored-by: Zoltan Fridrich <zfridric@redhat.com>
7 months agolib/nettle/int/drbg-aes-self-test: Replace free() with gnutls_free()
Jiasheng Jiang [Tue, 19 Aug 2025 18:49:14 +0000 (18:49 +0000)] 
lib/nettle/int/drbg-aes-self-test: Replace free() with gnutls_free()

Replace free() with gnutls_free() for consistent memory deallocation.

Fixes: 1421e31ff ("Added DRBG submitted to nettle in gnutls.")
Signed-off-by: Jiasheng Jiang <jiashengjiangcool@gmail.com>
8 months agoMerge branch 'wip/alistair/key-update' into 'master'
Daiki Ueno [Thu, 25 Sep 2025 06:40:59 +0000 (15:40 +0900)] 
Merge branch 'wip/alistair/key-update' into 'master'

tls13/key_update: Expose a manual KeyUpdate function

See merge request gnutls/gnutls!2020

8 months agotls13/key_update: Expose a manual KeyUpdate function
Alistair Francis [Mon, 26 May 2025 04:41:46 +0000 (14:41 +1000)] 
tls13/key_update: Expose a manual KeyUpdate function

As part of supporting KeyUpdate in ktls-utils and NVMe-OF we need to
trigger an update of the local keys after the kernel has received a
KeyUpdate message.

This patch creates a new gnutls_handshake_update_receiving_key() function
that allows updating the local keys without sending any KeyUpdate
requests.

Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
Modified-by: Daiki Ueno <ueno@gnu.org>
8 months agoMerge branch 'wip/dueno/pkcs11-provider-followup2' into 'master'
Daiki Ueno [Sat, 20 Sep 2025 01:36:59 +0000 (10:36 +0900)] 
Merge branch 'wip/dueno/pkcs11-provider-followup2' into 'master'

pkcs11-provider: rework to share the code with the existing PKCS#11 support

See merge request gnutls/gnutls!2018

8 months agoNEWS: mention configuration change of PKCS#11 provider
Daiki Ueno [Thu, 18 Sep 2025 05:21:52 +0000 (14:21 +0900)] 
NEWS: mention configuration change of PKCS#11 provider

Signed-off-by: Daiki Ueno <ueno@gnu.org>
8 months agotests: make pkcs11-provider test self-contained
Daiki Ueno [Tue, 16 Sep 2025 09:45:45 +0000 (18:45 +0900)] 
tests: make pkcs11-provider test self-contained

Use p11tool exclusively to avoid pkcs11-tool dependency.

Signed-off-by: Daiki Ueno <ueno@gnu.org>
8 months agopkcs11: use the same initialization code for provider
Daiki Ueno [Tue, 16 Sep 2025 08:57:24 +0000 (17:57 +0900)] 
pkcs11: use the same initialization code for provider

This makes the pkcs11-provider code use the thread-safe module
initialization code introduced in commit
aa5f15a872e62e54abe58624ee393e68d1faf689. As the mechanism works over
p11-kit managed modules, this switches the "path" config option to
using PKCS#11 URI, through the "url" keyword.

Signed-off-by: Daiki Ueno <ueno@gnu.org>
8 months agopkcs11: use CRYPTOKI_GNU interface in the provider code
Daiki Ueno [Tue, 16 Sep 2025 06:15:23 +0000 (15:15 +0900)] 
pkcs11: use CRYPTOKI_GNU interface in the provider code

This mass-rewrites the pkcs11-provider code to match the rest of
PKCS#11 support in the library, to be able to share the same module
initialization code everywhere.

Signed-off-by: Daiki Ueno <ueno@gnu.org>
8 months agoMerge branch 'wip/dueno/trust-list' into 'master'
Daiki Ueno [Thu, 11 Sep 2025 08:44:57 +0000 (17:44 +0900)] 
Merge branch 'wip/dueno/trust-list' into 'master'

pkcs11: try to initialize modules in thread-safe mode

Closes #1212

See merge request gnutls/gnutls!2014

8 months agoMerge branch 'wip/dueno/zeroize-key' into 'master'
Daiki Ueno [Thu, 11 Sep 2025 05:25:45 +0000 (14:25 +0900)] 
Merge branch 'wip/dueno/zeroize-key' into 'master'

build: unconditionally use zeroize_key/zrelease_mpi_key

See merge request gnutls/gnutls!2017

8 months agopkcs11: try to initialize modules in thread-safe mode
Daiki Ueno [Mon, 1 Sep 2025 21:53:34 +0000 (06:53 +0900)] 
pkcs11: try to initialize modules in thread-safe mode

When modules are initialized without CKF_OS_LOCKING_OK nor custom
locking functions, they may skip their internal locking assuming that
the applications will take care of thread-safety, which is costly and
GnuTLS currently doesn't do that.

To mitigate this, this patch changes the module initialization code to
tell the modules to guarantee thread-safety by themselves. If they are
unable to do that, this falls back to the normal initialization
without C_Initialize parameters. This also omits the custom_init flag,
which indicated whether the module is initialized with
p11_kit_module_initialize or a direct call to C_Initialize, now that
modules are always initialized with C_Initialize.

Signed-off-by: Daiki Ueno <ueno@gnu.org>
8 months agobuild: unconditionally use zeroize_key/zrelease_mpi_key
Daiki Ueno [Tue, 9 Sep 2025 06:22:43 +0000 (15:22 +0900)] 
build: unconditionally use zeroize_key/zrelease_mpi_key

Since 39aaa63a1a4cb8432e090887f38241afb2b264a6, zeroize_temp_key is an
alias to zeroize_key, and zrelease_temp_mpi_key is an alias to
zrelease_mpi_key. Use the latter directly and also remove
_gnutls_free_temp_key_datum.

Signed-off-by: Daiki Ueno <ueno@gnu.org>
9 months agoMerge branch 'wip/twilfredo/fixup-psk-binder-algo' into 'master'
Daiki Ueno [Thu, 21 Aug 2025 05:13:16 +0000 (14:13 +0900)] 
Merge branch 'wip/twilfredo/fixup-psk-binder-algo' into 'master'

lib/psk: add null check for binder algo

See merge request gnutls/gnutls!2013

9 months agopre_shared_key: fix memleak when retrying with different binder algo
Daiki Ueno [Wed, 20 Aug 2025 22:03:38 +0000 (07:03 +0900)] 
pre_shared_key: fix memleak when retrying with different binder algo

As the PSK entry is reallocated, free it upon retry. Also use
_gnutls_free_key_datum instead of _gnutls_free_temp_key_datum
consistently.

Signed-off-by: Daiki Ueno <ueno@gnu.org>
9 months agotests/psk-file: Add testing for _credentials2 functions
Wilfred Mallawa [Tue, 19 Aug 2025 04:59:21 +0000 (14:59 +1000)] 
tests/psk-file: Add testing for _credentials2 functions

Adds testing for gnutls_psk_allocate_X_credentials2() functions for
server and client.

Signed-off-by: Wilfred Mallawa <wilfred.mallawa@wdc.com>
Modified-by: Daiki Ueno <ueno@gnu.org>
9 months agolib/psk: add null check for binder algo
Wilfred Mallawa [Mon, 18 Aug 2025 02:40:57 +0000 (12:40 +1000)] 
lib/psk: add null check for binder algo

Currently, `pskcred->binder_algo` is used without checking first if it
is valid. This can lead to a NULL pointer dereference in cases such as
[1]. This patch adds NULL check `pskcred->binder_algo` before using it.

This also makes it more explicit in
gnutls_psk_allocate_server_credentials2() that `pskcred->binder_algo
== NULL` indicates auto-detection, while avoiding the linear lookup
for a NULL entry.

[1] https://gitlab.com/gnutls/gnutls/-/issues/1729

Fix Suggested by: Daiki Ueno <ueno@gnu.org>
Signed-off-by: Wilfred Mallawa <wilfred.mallawa@wdc.com>
9 months agoMerge branch 'wip/dueno/post-optimize2' into 'master'
Daiki Ueno [Wed, 20 Aug 2025 01:05:27 +0000 (10:05 +0900)] 
Merge branch 'wip/dueno/post-optimize2' into 'master'

Optimize FIPS power-on self-tests: stop running unnecessary tests

See merge request gnutls/gnutls!2011

9 months agocrypto-selftests-pk: skip negative tests by default
Daiki Ueno [Tue, 17 Dec 2024 08:55:22 +0000 (17:55 +0900)] 
crypto-selftests-pk: skip negative tests by default

Signed-off-by: Daiki Ueno <ueno@gnu.org>
9 months agofips: skip compat API tests in AES self-tests
Daiki Ueno [Tue, 17 Dec 2024 08:54:54 +0000 (17:54 +0900)] 
fips: skip compat API tests in AES self-tests

Signed-off-by: Daiki Ueno <ueno@gnu.org>
9 months agofips: only run the first test vector for each symmetric algorithm
Daiki Ueno [Tue, 17 Dec 2024 01:03:26 +0000 (10:03 +0900)] 
fips: only run the first test vector for each symmetric algorithm

FIPS 140-3 doesn't require to run multiple test vectors for a single
algorithm, and one of the test vector for PBKDF2, with an 80000
iteration count is known to be too costly.  Therefore, this patch
changes gnutls_*_self_test to pick only the first test from the test
vectors, unless GNUTLS_SELF_TEST_FLAG_ALL is specified.  The existing
test vectors have been reviewed and modified for the first element to
use the sane parameters, namely: aes128_gcm_vectors to use non-zero
key and non-empty AAD, aes256_gcm_vectors to use non-empty AAD, and
pbkdf2_sha256_vectors to use iteration count greater than 1.

Signed-off-by: Daiki Ueno <ueno@gnu.org>
9 months agofips: run AES-256 self-tests with only a single mode
Daiki Ueno [Fri, 13 Dec 2024 09:42:03 +0000 (18:42 +0900)] 
fips: run AES-256 self-tests with only a single mode

Previously we ran FIPS power-on self-tests for AES-256-CBC,
AES-256-GCM, AES-256-XTS, and AES-256-CFB8, though only one mode per
key size suffices according to FIPS 140-3 IG. This omits AES-256-CBC,
AES-256-XTS, and AES-256-CFB8, keeping AES-256-GCM for performance.

Signed-off-by: Daiki Ueno <ueno@gnu.org>
9 months agoMerge branch 'wip/cjhxmx/nc' into 'master'
Daiki Ueno [Tue, 19 Aug 2025 00:38:42 +0000 (09:38 +0900)] 
Merge branch 'wip/cjhxmx/nc' into 'master'

x509: fix incorrect handling in name constraints merging

See merge request gnutls/gnutls!2010