Package: release.debian.org Severity: normal Tags: trixie X-Debbugs-Cc: [email protected] Control: affects -1 + src:gnutls28 User: [email protected] Usertags: pu
Hello,
I would like to fix minor security issues and two regressions:
* Fix TLS 1.3 handshake.
Backport this fix released in gnutls-3.8.13 to fix a regression with TLS
1.3 handshake after this commit in openjdk (both Debian 12 and 13
openjdk packages are affected):
https://bugs.openjdk.org/browse/JDK-8349583
Closes: 1142662
* Cherry-pick fixes from 3.8.14 release.
libgnutls: Fix crash on certificate list memory allocation failure
On allocation failure, the certificate list pointer and count could
get out of sync, causing a NULL deref or double-free during session
cleanup.
Both fields are now zeroized before the allocation.
Reported by Joshua Rogers of AISLE Research Team.
[GNUTLS-SA-2026-11-18-1, severity: low] [CVE-2026-127039]
libgnutls: Fix crash in RSA-PSK username copy memory allocation failure A
missing return on a failed username copy could crash the handshake when
memory allocation fails.
The error is now propagated, aborting the handshake.
Reported by Joshua Rogers of AISLE Research Team.
[GNUTLS-SA-2026-11-18-2, severity: low] [CVE-2026-127040]
These two non-DSA issues are tracked in #1154435
* Cherry-pick patches from 3.8.11 to fix plc11 module init.
Fixes regression from the patchset for the CVE-2025-9820 fix.
Closes: #1154411
[ Checklist ]
[x] *all* changes are documented in the d/changelog
[x] I reviewed all changes and I approve them
[ x attach debdiff against the package in (old)stable
[x] the issue is verified as fixed in unstable
cu Andreas
--
"You people are noisy," Nia said.
I made the gesture of agreement.
diff -Nru gnutls28-3.8.9/debian/changelog gnutls28-3.8.9/debian/changelog --- gnutls28-3.8.9/debian/changelog 2026-05-10 13:15:39.000000000 +0200 +++ gnutls28-3.8.9/debian/changelog 2026-11-21 16:41:55.000000000 +0100 @@ -1,3 +1,34 @@ +gnutls28 (3.8.9-3+deb13u5) trixie; urgency=medium + + [ Romain Tartière ] + * Fix TLS 1.3 handshake. + Backport this fix released in gnutls-3.8.13 to fix a regression with TLS + 1.3 handshake after this commit in openjdk (both Debian 12 and 13 + openjdk packages are affected): + https://bugs.openjdk.org/browse/JDK-8349583 + Closes: 1142662 + + [ Andreas Metzler ] + * Cherry-pick fixes from 3.8.14 release. + libgnutls: Fix crash on certificate list memory allocation failure + On allocation failure, the certificate list pointer and count could + get out of sync, causing a NULL deref or double-free during session + cleanup. + Both fields are now zeroized before the allocation. + Reported by Joshua Rogers of AISLE Research Team. + [GNUTLS-SA-2026-11-18-1, severity: low] [CVE-2026-127039] + libgnutls: Fix crash in RSA-PSK username copy memory allocation failure A + missing return on a failed username copy could crash the handshake when + memory allocation fails. + The error is now propagated, aborting the handshake. + Reported by Joshua Rogers of AISLE Research Team. + [GNUTLS-SA-2026-11-18-2, severity: low] [CVE-2026-127040] Closes: #1154435 + * Cherry-pick patches from 3.8.11 to fix pkcs11 module init. + Fixes regression from the patchset for the CVE-2025-9820 fix. + Closes: #1154411 + + -- Andreas Metzler <[email protected]> Sat, 21 Nov 2026 16:41:55 +0100 + gnutls28 (3.8.9-3+deb13u4) trixie-security; urgency=high * Add 3.8.13 patchset from CentOS 10 security release. diff -Nru gnutls28-3.8.9/debian/patches/54_fix-tls-1.3-handshake.patch gnutls28-3.8.9/debian/patches/54_fix-tls-1.3-handshake.patch --- gnutls28-3.8.9/debian/patches/54_fix-tls-1.3-handshake.patch 1970-01-01 01:00:00.000000000 +0100 +++ gnutls28-3.8.9/debian/patches/54_fix-tls-1.3-handshake.patch 2026-11-21 13:18:24.000000000 +0100 @@ -0,0 +1,58 @@ +From 57830464c548cd2346eca624961257b99c0e8dfc Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Romain=20Tarti=C3=A8re?= <[email protected]> +Date: Thu, 16 Apr 2026 14:08:31 -1000 +Subject: [PATCH] Fix TLS 1.3 handshake +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Add the signature_algorithms_cert to the list of allowed algorithms if +present, and fallback to the signature_algorithms otherwise. + +This better fit [RFC8446 section 4.2.3][1]: + +> If no "signature_algorithms_cert" extension is present, then the +> "signature_algorithms" extension also applies to signatures appearing +> in certificates. + +This fix TLS 1.3 handshake with Java after [JDK-8349583][2]. + +[1]: https://datatracker.ietf.org/doc/html/rfc8446#section-4.2.3 +[2]: https://bugs.openjdk.org/browse/JDK-8349583 + +Signed-off-by: Romain Tartière <[email protected]> +--- + lib/tls13/certificate_request.c | 10 ++++++++-- + 1 file changed, 8 insertions(+), 2 deletions(-) + +diff --git a/lib/tls13/certificate_request.c b/lib/tls13/certificate_request.c +index 8a8a1499af..3c298cca72 100644 +--- a/lib/tls13/certificate_request.c ++++ b/lib/tls13/certificate_request.c +@@ -108,15 +108,21 @@ static int parse_cert_extension(void *_ctx, unsigned tls_id, + if (se == NULL) + continue; + ++ gnutls_pk_algorithm_t algo; ++ if (se->cert_pk != GNUTLS_PK_UNKNOWN) ++ algo = se->cert_pk; ++ else ++ algo = se->pk; ++ + if (ctx->pk_algos_length >= + sizeof(ctx->pk_algos) / sizeof(ctx->pk_algos[0])) + break; + +- if (is_algo_in_list(se->pk, ctx->pk_algos, ++ if (is_algo_in_list(algo, ctx->pk_algos, + ctx->pk_algos_length)) + continue; + +- ctx->pk_algos[ctx->pk_algos_length++] = se->pk; ++ ctx->pk_algos[ctx->pk_algos_length++] = algo; + } + #ifdef ENABLE_OCSP + } else if (tls_id == ext_mod_status_request.tls_id) { +-- +GitLab + diff -Nru gnutls28-3.8.9/debian/patches/55_01_0001-_gnutls_pcert_to_auth_info-always-zeroize-cert-list-.patch gnutls28-3.8.9/debian/patches/55_01_0001-_gnutls_pcert_to_auth_info-always-zeroize-cert-list-.patch --- gnutls28-3.8.9/debian/patches/55_01_0001-_gnutls_pcert_to_auth_info-always-zeroize-cert-list-.patch 1970-01-01 01:00:00.000000000 +0100 +++ gnutls28-3.8.9/debian/patches/55_01_0001-_gnutls_pcert_to_auth_info-always-zeroize-cert-list-.patch 2026-11-21 13:31:46.000000000 +0100 @@ -0,0 +1,64 @@ +From 0cf60141ca2c1289e96847261ff355010cb6f3a8 Mon Sep 17 00:00:00 2001 +From: Zoltan Fridrich <[email protected]> +Date: Mon, 4 May 2026 11:33:15 +0200 +Subject: [PATCH 1/2] _gnutls_pcert_to_auth_info: always zeroize cert list + after cleaning it up + +Fixes: #1863 +Fixes: CVE-2026-127039 +Fixes: GNUTLS-SA-2026-11-18-1 +Severity: Low +Introduced-in: bb3bc56370e3b291219695bec5d4e1cbfc3241be 2.5.9 +Reported-by: Joshua Rogers of AISLE Research Team <[email protected]> +Signed-off-by: Zoltan Fridrich <[email protected]> +--- + lib/auth/cert.c | 21 ++++++++------------- + 1 file changed, 8 insertions(+), 13 deletions(-) + +diff --git a/lib/auth/cert.c b/lib/auth/cert.c +index 71f87c237b..fbdc84036d 100644 +--- a/lib/auth/cert.c ++++ b/lib/auth/cert.c +@@ -84,31 +84,26 @@ enum CertificateSigTypeFlags { + int _gnutls_pcert_to_auth_info(cert_auth_info_t info, gnutls_pcert_st *certs, + size_t ncerts) + { +- size_t i, j; +- + if (info->raw_certificate_list != NULL) { +- for (j = 0; j < info->ncerts; j++) +- _gnutls_free_datum(&info->raw_certificate_list[j]); ++ for (size_t i = 0; i < info->ncerts; i++) ++ _gnutls_free_datum(&info->raw_certificate_list[i]); + gnutls_free(info->raw_certificate_list); + } ++ info->raw_certificate_list = NULL; ++ info->ncerts = 0; + +- if (ncerts == 0) { +- info->raw_certificate_list = NULL; +- info->ncerts = 0; ++ if (ncerts == 0) + return 0; +- } + + info->raw_certificate_list = + gnutls_calloc(ncerts, sizeof(gnutls_datum_t)); +- if (info->raw_certificate_list == NULL) { +- gnutls_assert(); +- return GNUTLS_E_MEMORY_ERROR; +- } ++ if (info->raw_certificate_list == NULL) ++ return gnutls_assert_val(GNUTLS_E_MEMORY_ERROR); + + info->cert_type = certs[0].type; + info->ncerts = ncerts; + +- for (i = 0; i < ncerts; i++) { ++ for (size_t i = 0; i < ncerts; i++) { + info->raw_certificate_list[i].data = certs[i].cert.data; + info->raw_certificate_list[i].size = certs[i].cert.size; + certs[i].cert.data = NULL; +-- +2.53.0 + diff -Nru gnutls28-3.8.9/debian/patches/55_01_0002-NEWS-add-an-entry-for-CVE-2026-127039.patch gnutls28-3.8.9/debian/patches/55_01_0002-NEWS-add-an-entry-for-CVE-2026-127039.patch --- gnutls28-3.8.9/debian/patches/55_01_0002-NEWS-add-an-entry-for-CVE-2026-127039.patch 1970-01-01 01:00:00.000000000 +0100 +++ gnutls28-3.8.9/debian/patches/55_01_0002-NEWS-add-an-entry-for-CVE-2026-127039.patch 2026-11-21 13:42:17.000000000 +0100 @@ -0,0 +1,33 @@ +From 847261c734b3c6e9d7505d24ecce6b2ee0f64d5e Mon Sep 17 00:00:00 2001 +From: Alexander Sosedkin <[email protected]> +Date: Tue, 14 Jul 2026 19:08:39 +0200 +Subject: [PATCH 2/2] NEWS: add an entry for CVE-2026-127039 + +Signed-off-by: Alexander Sosedkin <[email protected]> +--- + NEWS | 7 +++++++ + 1 file changed, 7 insertions(+) + +--- a/NEWS ++++ b/NEWS +@@ -3,10 +3,20 @@ Bug numbers referenced in this log corre + available at https://gitlab.com/gnutls/gnutls/issues + Copyright (C) 2000-2016 Free Software Foundation, Inc. + Copyright (C) 2013-2019 Nikos Mavrogiannopoulos + See the end for copying conditions. + ++ ++ ++** libgnutls: Fix crash on certificate list memory allocation failure ++ On allocation failure, the certificate list pointer and count could ++ get out of sync, causing a NULL deref or double-free during session cleanup. ++ Both fields are now zeroized before the allocation. ++ Reported by Joshua Rogers of AISLE Research Team. ++ [GNUTLS-SA-2026-11-18-1, severity: low] [CVE-2026-127039] ++ ++ + * Version 3.8.11 + + ** libgnutls: Fix stack overwrite in gnutls_pkcs11_token_init + Reported by Luigino Camastra from Aisle Research. [GNUTLS-SA-2025-11-18, + CVSS: low] [CVE-2025-9820] diff -Nru gnutls28-3.8.9/debian/patches/55_02_0001-rsa_psk.c-add-missing-return.patch gnutls28-3.8.9/debian/patches/55_02_0001-rsa_psk.c-add-missing-return.patch --- gnutls28-3.8.9/debian/patches/55_02_0001-rsa_psk.c-add-missing-return.patch 1970-01-01 01:00:00.000000000 +0100 +++ gnutls28-3.8.9/debian/patches/55_02_0001-rsa_psk.c-add-missing-return.patch 2026-11-21 13:31:46.000000000 +0100 @@ -0,0 +1,32 @@ +From 8767518753a633e5ef59f112310db8dc9ff6771a Mon Sep 17 00:00:00 2001 +From: Zoltan Fridrich <[email protected]> +Date: Tue, 5 May 2026 14:51:00 +0200 +Subject: [PATCH 1/2] rsa_psk.c: add missing return + +Fixes: #1868 +Fixes: CVE-2026-127040 +Fixes: GNUTLS-SA-2026-11-18-2 +Severity: Low +Introduced-in: f032324af70b8420f7b550f3277efd4a9cd2b2dd 3.7.7 +Reported-by: Joshua Rogers of AISLE Research Team <[email protected]> +Signed-off-by: Zoltan Fridrich <[email protected]> +--- + lib/auth/rsa_psk.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/lib/auth/rsa_psk.c b/lib/auth/rsa_psk.c +index bf88cad0b6..240558f554 100644 +--- a/lib/auth/rsa_psk.c ++++ b/lib/auth/rsa_psk.c +@@ -297,7 +297,7 @@ static int _gnutls_proc_rsa_psk_client_kx(gnutls_session_t session, + + ret = _gnutls_copy_psk_username(info, username); + if (ret < 0) +- gnutls_assert_val(ret); ++ return gnutls_assert_val(ret); + + /* Adjust data so it points to EncryptedPreMasterSecret */ + data += username.size + 2; +-- +2.53.0 + diff -Nru gnutls28-3.8.9/debian/patches/55_02_0002-NEWS-add-an-entry-for-CVE-2026-127040.patch gnutls28-3.8.9/debian/patches/55_02_0002-NEWS-add-an-entry-for-CVE-2026-127040.patch --- gnutls28-3.8.9/debian/patches/55_02_0002-NEWS-add-an-entry-for-CVE-2026-127040.patch 1970-01-01 01:00:00.000000000 +0100 +++ gnutls28-3.8.9/debian/patches/55_02_0002-NEWS-add-an-entry-for-CVE-2026-127040.patch 2026-11-21 13:42:18.000000000 +0100 @@ -0,0 +1,30 @@ +From 62f3cc5409195aa175dd9e6f5d1bd6291dac844c Mon Sep 17 00:00:00 2001 +From: Alexander Sosedkin <[email protected]> +Date: Thu, 5 Nov 2026 19:20:17 +0100 +Subject: [PATCH 2/2] NEWS: add an entry for CVE-2026-127040 + +Signed-off-by: Alexander Sosedkin <[email protected]> +--- + NEWS | 7 +++++++ + 1 file changed, 7 insertions(+) + +--- a/NEWS ++++ b/NEWS +@@ -12,10 +12,17 @@ See the end for copying conditions. + get out of sync, causing a NULL deref or double-free during session cleanup. + Both fields are now zeroized before the allocation. + Reported by Joshua Rogers of AISLE Research Team. + [GNUTLS-SA-2026-11-18-1, severity: low] [CVE-2026-127039] + ++** libgnutls: Fix crash in RSA-PSK username copy memory allocation failure ++ A missing return on a failed username copy could crash the handshake ++ when memory allocation fails. ++ The error is now propagated, aborting the handshake. ++ Reported by Joshua Rogers of AISLE Research Team. ++ [GNUTLS-SA-2026-11-18-2, severity: low] [CVE-2026-127040] ++ + + * Version 3.8.11 + + ** libgnutls: Fix stack overwrite in gnutls_pkcs11_token_init + Reported by Luigino Camastra from Aisle Research. [GNUTLS-SA-2025-11-18, diff -Nru gnutls28-3.8.9/debian/patches/56-01-pkcs11-properly-fall-back-to-thread-unsafe-module-in.patch gnutls28-3.8.9/debian/patches/56-01-pkcs11-properly-fall-back-to-thread-unsafe-module-in.patch --- gnutls28-3.8.9/debian/patches/56-01-pkcs11-properly-fall-back-to-thread-unsafe-module-in.patch 1970-01-01 01:00:00.000000000 +0100 +++ gnutls28-3.8.9/debian/patches/56-01-pkcs11-properly-fall-back-to-thread-unsafe-module-in.patch 2026-11-21 16:41:55.000000000 +0100 @@ -0,0 +1,119 @@ +From f6680ada01ac8757f372cd7b97fd80e33c79c927 Mon Sep 17 00:00:00 2001 +From: Daiki Ueno <[email protected]> +Date: Mon, 22 Dec 2025 15:29:06 +0900 +Subject: [PATCH 1/2] 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 <[email protected]> +--- + .gitignore | 1 + + lib/pkcs11.c | 21 ++++++++++++--------- + tests/pkcs11/pkcs11-mock4.c | 10 ++++++---- + 3 files changed, 19 insertions(+), 13 deletions(-) + +diff --git a/lib/pkcs11.c b/lib/pkcs11.c +index 021974f5fa..668d91bb13 100644 +--- a/lib/pkcs11.c ++++ b/lib/pkcs11.c +@@ -251,18 +251,14 @@ static const struct ck_c_initialize_args default_init_args = { + NULL, + NULL, + NULL, + CKF_LIBRARY_CANT_CREATE_OS_THREADS | CKF_OS_LOCKING_OK, + NULL, + }; + +-static const struct ck_c_initialize_args no_thread_init_args = { +- NULL, NULL, NULL, NULL, CKF_LIBRARY_CANT_CREATE_OS_THREADS, NULL, +-}; +- + static void pkcs11_provider_deinit(struct gnutls_pkcs11_provider_st *provider) + { + p11_kit_module_finalize(provider->module); + p11_kit_module_release(provider->module); + gnutls_free(provider->init_args.reserved); + } + +@@ -280,23 +276,30 @@ static int pkcs11_provider_init(struct gnutls_pkcs11_provider_st *provider, + + _gnutls_debug_log("p11: Initializing module: %s\n", name); + + if (params && (p = strstr(params, "p11-kit:")) != 0) { + reserved = (char *)(p + sizeof("p11-kit:") - 1); + } + +- /* First try with CKF_OS_LOCKING_OK, then fall back without it */ ++ /* First try with CKF_LIBRARY_CANT_CREATE_OS_THREADS | ++ * CKF_OS_LOCKING_OK, then fall back without it */ + args = default_init_args; + args.reserved = (void *)reserved; + rv = module->C_Initialize(&args); + +- if (rv == CKR_CANT_LOCK) { +- args = no_thread_init_args; +- args.reserved = (void *)reserved; +- rv = module->C_Initialize(&args); ++ if (rv == CKR_NEED_TO_CREATE_THREADS || rv == CKR_CANT_LOCK) { ++ struct ck_c_initialize_args *pargs; ++ if (reserved) { ++ memset(&args, 0, sizeof(args)); ++ args.reserved = (void *)reserved; ++ pargs = &args; ++ } else { ++ pargs = NULL; ++ } ++ rv = module->C_Initialize(pargs); + } + + if (rv != CKR_OK) { + int ret; + + gnutls_assert(); + free(name); +diff --git a/tests/pkcs11/pkcs11-mock4.c b/tests/pkcs11/pkcs11-mock4.c +index ffa684b52f..3fd24eae29 100644 +--- a/tests/pkcs11/pkcs11-mock4.c ++++ b/tests/pkcs11/pkcs11-mock4.c +@@ -50,27 +50,29 @@ static CK_FUNCTION_LIST override_funcs; + #define _CONSTRUCTOR + #define _DESTRUCTOR + #else + #define _CONSTRUCTOR __attribute__((constructor)) + #define _DESTRUCTOR __attribute__((destructor)) + #endif + ++#define LOCK_FLAGS (CKF_LIBRARY_CANT_CREATE_OS_THREADS | CKF_OS_LOCKING_OK) ++ + static CK_RV override_C_Initialize(void *args) + { + CK_C_INITIALIZE_ARGS *init_args = args; + static bool first = true; + +- assert(init_args); +- + if (first) { +- assert(init_args->flags & CKF_OS_LOCKING_OK); ++ assert(init_args && ++ (init_args->flags & LOCK_FLAGS) == LOCK_FLAGS); + first = false; + return CKR_CANT_LOCK; + } else { +- assert(!(init_args->flags & CKF_OS_LOCKING_OK)); ++ assert(!init_args || ++ (init_args->flags & LOCK_FLAGS) != LOCK_FLAGS); + } + + return base_C_Initialize(args); + } + + CK_RV C_GetFunctionList(CK_FUNCTION_LIST **function_list) + { +-- +2.53.0 + diff -Nru gnutls28-3.8.9/debian/patches/56-02-pkcs11-fix-module-name-resolution-for-unconfigured-m.patch gnutls28-3.8.9/debian/patches/56-02-pkcs11-fix-module-name-resolution-for-unconfigured-m.patch --- gnutls28-3.8.9/debian/patches/56-02-pkcs11-fix-module-name-resolution-for-unconfigured-m.patch 1970-01-01 01:00:00.000000000 +0100 +++ gnutls28-3.8.9/debian/patches/56-02-pkcs11-fix-module-name-resolution-for-unconfigured-m.patch 2026-11-21 16:41:55.000000000 +0100 @@ -0,0 +1,193 @@ +From 9a9913fde956a600e057786558a335dff7849531 Mon Sep 17 00:00:00 2001 +From: Daiki Ueno <[email protected]> +Date: Mon, 22 Dec 2025 18:20:25 +0900 +Subject: [PATCH 2/2] 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 <[email protected]> +--- + lib/pkcs11.c | 35 +++++++++++++++-------------------- + 1 file changed, 15 insertions(+), 20 deletions(-) + +diff --git a/lib/pkcs11.c b/lib/pkcs11.c +index 668d91bb13..9f3bb551c4 100644 +--- a/lib/pkcs11.c ++++ b/lib/pkcs11.c +@@ -58,14 +58,15 @@ + #define CKA_NSS_EMAIL_DISTRUST_AFTER 0xce534374UL + #endif + + GNUTLS_STATIC_MUTEX(pkcs11_mutex); + + struct gnutls_pkcs11_provider_st { + struct ck_function_list *module; ++ char *module_name; + unsigned active; + unsigned trusted; /* in the sense of p11-kit trusted: + * it can be used for verification */ + struct ck_info info; + struct ck_c_initialize_args init_args; + }; + +@@ -256,29 +257,27 @@ static const struct ck_c_initialize_args default_init_args = { + }; + + static void pkcs11_provider_deinit(struct gnutls_pkcs11_provider_st *provider) + { + p11_kit_module_finalize(provider->module); + p11_kit_module_release(provider->module); + gnutls_free(provider->init_args.reserved); ++ gnutls_free(provider->module_name); + } + + static int pkcs11_provider_init(struct gnutls_pkcs11_provider_st *provider, + struct ck_function_list *module, +- const void *params) ++ const char *module_name, const void *params) + { + struct ck_c_initialize_args args; + const void *reserved = NULL; + ck_rv_t rv; +- char *name; + char *p; + +- name = p11_kit_module_get_name(module); +- +- _gnutls_debug_log("p11: Initializing module: %s\n", name); ++ _gnutls_debug_log("p11: Initializing module: %s\n", module_name); + + if (params && (p = strstr(params, "p11-kit:")) != 0) { + reserved = (char *)(p + sizeof("p11-kit:") - 1); + } + + /* First try with CKF_LIBRARY_CANT_CREATE_OS_THREADS | + * CKF_OS_LOCKING_OK, then fall back without it */ +@@ -298,39 +297,38 @@ static int pkcs11_provider_init(struct gnutls_pkcs11_provider_st *provider, + rv = module->C_Initialize(pargs); + } + + if (rv != CKR_OK) { + int ret; + + gnutls_assert(); +- free(name); + ret = pkcs11_rv_to_err(rv); + assert(ret < 0); + return ret; + } + + if (args.flags & CKF_OS_LOCKING_OK) { + _gnutls_debug_log( + "p11: Module %s is initialized in a thread-safe mode\n", +- name); ++ module_name); + } else { + _gnutls_debug_log( + "p11: Module %s is initialized NOT in a thread-safe mode\n", +- name); ++ module_name); + } +- free(name); + + if (args.reserved) { + args.reserved = gnutls_strdup((const char *)args.reserved); + if (!args.reserved) + return GNUTLS_E_MEMORY_ERROR; + } + + memset(provider, 0, sizeof(*provider)); + provider->module = module; ++ provider->module_name = gnutls_strdup(module_name); + provider->init_args = args; + if (p11_kit_module_get_flags(module) & P11_KIT_MODULE_TRUSTED || + (params != NULL && strstr(params, "trusted") != 0)) + provider->trusted = 1; + + return 0; + } +@@ -349,18 +347,16 @@ static int pkcs11_provider_add(const struct gnutls_pkcs11_provider_st *provider) + pkcs11_get_module_info(provider->module, &info); + + /* initially check if this module is a duplicate */ + for (i = 0; i < active_providers; i++) { + /* already loaded, skip the rest */ + if (provider->module == providers[i].module || + memcmp(&info, &providers[i].info, sizeof(info)) == 0) { +- char *name = p11_kit_module_get_name(provider->module); + _gnutls_debug_log("p11: module %s is already loaded.\n", +- name); +- free(name); ++ provider->module_name); + return GNUTLS_E_INT_RET_0; + } + } + + memcpy(&providers[active_providers], provider, sizeof(*provider)); + memcpy(&providers[active_providers].info, &info, sizeof(info)); + providers[active_providers].active = 1; +@@ -496,15 +492,15 @@ int gnutls_pkcs11_add_provider(const char *name, const char *params) + module = p11_kit_module_load(name, P11_KIT_MODULE_CRITICAL | flags); + if (module == NULL) { + gnutls_assert(); + _gnutls_debug_log("p11: Cannot load provider %s\n", name); + return GNUTLS_E_PKCS11_LOAD_ERROR; + } + +- ret = pkcs11_provider_init(&provider, module, params); ++ ret = pkcs11_provider_init(&provider, module, name, params); + if (ret != 0) { + p11_kit_module_release(module); + gnutls_assert(); + return ret; + } + + ret = pkcs11_provider_add(&provider); +@@ -1012,36 +1008,35 @@ static int auto_load(unsigned trusted) + _gnutls_debug_log("Cannot load registered modules: %s\n", + p11_kit_message()); + return GNUTLS_E_PKCS11_LOAD_ERROR; + } + + for (i = 0; modules[i] != NULL; i++) { + struct gnutls_pkcs11_provider_st provider; ++ char *name = p11_kit_module_get_name(modules[i]); + +- ret = pkcs11_provider_init(&provider, modules[i], NULL); ++ ret = pkcs11_provider_init(&provider, modules[i], name, NULL); + if (ret < 0) { + gnutls_assert(); +- char *name = p11_kit_module_get_name(modules[i]); + _gnutls_debug_log( + "Cannot initialize PKCS #11 module: %s\n", + name); +- free(name); +- continue; ++ goto next; + } + + ret = pkcs11_provider_add(&provider); + if (ret < 0) { + gnutls_assert(); +- char *name = p11_kit_module_get_name(provider.module); + _gnutls_debug_log("Cannot add PKCS #11 module: %s\n", + name); +- free(name); + pkcs11_provider_deinit(&provider); +- continue; ++ goto next; + } ++ next: ++ free(name); + } + + /* Shallow free */ + free(modules); + return 0; + } + +-- +2.53.0 + diff -Nru gnutls28-3.8.9/debian/patches/series gnutls28-3.8.9/debian/patches/series --- gnutls28-3.8.9/debian/patches/series 2026-05-10 13:14:26.000000000 +0200 +++ gnutls28-3.8.9/debian/patches/series 2026-11-21 16:41:55.000000000 +0100 @@ -45,3 +45,10 @@ 53_0022_gnutls-3.8.10-1823-cfg-clear-options.patch 53_0023_gnutls-3.8.10-1817-security-parameters.patch 53_0025__gnutls_pkcs7_unpad-add-missing-declaration.patch +54_fix-tls-1.3-handshake.patch +55_01_0001-_gnutls_pcert_to_auth_info-always-zeroize-cert-list-.patch +55_01_0002-NEWS-add-an-entry-for-CVE-2026-127039.patch +55_02_0001-rsa_psk.c-add-missing-return.patch +55_02_0002-NEWS-add-an-entry-for-CVE-2026-127040.patch +56-01-pkcs11-properly-fall-back-to-thread-unsafe-module-in.patch +56-02-pkcs11-fix-module-name-resolution-for-unconfigured-m.patch
signature.asc
Description: PGP signature

