public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
* [rpms/curl] curl-v8.21.0-9: Don't fail ML-DSA connection that requires channel binding
@ 2026-11-02 14:32 Rob Crittenden
0 siblings, 0 replies; only message in thread
From: Rob Crittenden @ 2026-11-02 14:32 UTC (permalink / raw)
To: git-commits
A new commit has been pushed.
Repo : rpms/curl
Branch : curl-v8.21.0-9
Commit : 9821ffef8df4d04216000f7fa65777a9e3fb6677
Author : Rob Crittenden <rcritten@redhat.com>
Date : 2026-03-30T08:51:10-04:00
Stats : +165/-1 in 2 file(s)
URL : https://src.fedoraproject.org/rpms/curl/c/9821ffef8df4d04216000f7fa65777a9e3fb6677?branch=curl-v8.21.0-9
Log:
Don't fail ML-DSA connection that requires channel binding
Backport upstream commit b0f6e9a.
RFC 5299 in section 4.1 reads:
o if the certificate's signatureAlgorithm uses no hash functions or
uses multiple hash functions, then this channel binding type's
channel bindings are undefined at this time (updates to is channel
binding type may occur to address this issue if it ever arises).
This is the case for ML-DSA.
This upstream patch correctly detects this condition and will not
fail the connection.
Resolves: #2450393
---
diff --git a/002-curl-8.19.0-mldsa-channel-binding.patch b/002-curl-8.19.0-mldsa-channel-binding.patch
new file mode 100644
index 0000000..0d86756
--- /dev/null
+++ b/002-curl-8.19.0-mldsa-channel-binding.patch
@@ -0,0 +1,159 @@
+From b0f6e9a3d7be02e8f2e323aa97f2ff9b30662b32 Mon Sep 17 00:00:00 2001
+From: Stefan Eissing <stefan@eissing.org>
+Date: Thu, 26 Feb 2026 10:21:31 +0100
+Subject: [PATCH] openssl channel_binding: lookup digest algorithm without NID
+
+Use an alternate OpenSSL API to get the digest algorithm tied
+to a certificate signature to compute the channel binding.
+
+Fixes #20590
+Reported-by: Rob Crittenden
+Closes #20734
+---
+ lib/vtls/openssl.c | 97 +++++++++++++++++++++++++++++++++++++++-------
+ 1 file changed, 82 insertions(+), 15 deletions(-)
+
+diff --git a/lib/vtls/openssl.c b/lib/vtls/openssl.c
+index 08c20430a21f..0d41aa8f51a8 100644
+--- a/lib/vtls/openssl.c
++++ b/lib/vtls/openssl.c
+@@ -5255,13 +5255,15 @@ static CURLcode ossl_recv(struct Curl_cfilter *cf,
+ return result;
+ }
+
+-static CURLcode ossl_get_channel_binding(struct Curl_easy *data, int sockindex,
++static CURLcode ossl_get_channel_binding(struct Curl_easy *data,
++ int sockindex,
+ struct dynbuf *binding)
+ {
+ X509 *cert;
+- int algo_nid;
+- const EVP_MD *algo_type;
+- const char *algo_name;
++ int mdnid;
++ bool no_digest_acceptable = FALSE;
++ const EVP_MD *algo_type = NULL;
++ const char *algo_name = NULL;
+ unsigned int length;
+ unsigned char buf[EVP_MAX_MD_SIZE];
+
+@@ -5293,43 +5295,108 @@ static CURLcode ossl_get_channel_binding(struct Curl_easy *data, int sockindex,
+ /* No server certificate, do not do channel binding */
+ return CURLE_OK;
+
+- if(!OBJ_find_sigid_algs(X509_get_signature_nid(cert), &algo_nid, NULL)) {
++#ifdef HAVE_OPENSSL3
++ {
++ int pknid, secbits;
++ uint32_t flags;
++ EVP_PKEY *pkey = X509_get0_pubkey(cert);
++
++ if(!X509_get_signature_info(cert, &mdnid, &pknid, &secbits, &flags)) {
++ failf(data, "certificate signature algorithm not recognized");
++ result = CURLE_SSL_INVALIDCERTSTATUS;
++ goto out;
++ }
++
++ if(mdnid != NID_undef) {
++ if(mdnid == NID_md5 || mdnid == NID_sha1) {
++ algo_type = EVP_sha256();
++ }
++ else
++ algo_type = EVP_get_digestbynid(mdnid);
++ }
++ else if(pkey && !EVP_PKEY_is_a(pkey, OBJ_nid2sn(pknid))) {
++ /* The cert's pkey is different from the algorithm used to sign
++ * the certificate. Since the reported `mdnid` is undefined, there
++ * is no digest algorithm available here. This happens in PQC
++ * and is accepted, resulting in no addition to the binding. */
++ no_digest_acceptable = TRUE;
++ }
++ else if(pkey) {
++ /* cert's pkey type is the same as the cert signer (or same family).
++ * Ask for the mandatory/advisory digest algorithm for the pkey.
++ */
++ char mdname[128] = "";
++ int rc = EVP_PKEY_get_default_digest_name(pkey, mdname, sizeof(mdname));
++ bool md_is_undef = !strcmp(mdname, "UNDEF");
++
++ if(rc == 2 && md_is_undef) {
++ /* OpenSSL declares "undef" the *mandatory* digest for this key.
++ * This is some PQC shit, accept it, no addition to binding. */
++ no_digest_acceptable = TRUE;
++ }
++ else if(rc > 0 && mdname[0] != '\0' && !md_is_undef) {
++ infof(data, "Digest algorithm : %s%s (derived from public key)"
++ ", but unavailable",
++ mdname, rc == 2 ? " [mandatory]" : " [advisory]");
++ }
++ }
++ }
++#else /* HAVE_OPENSSL3 */
++
++ if(!OBJ_find_sigid_algs(X509_get_signature_nid(cert), &mdnid, NULL)) {
+ failf(data,
+ "Unable to find digest NID for certificate signature algorithm");
+ result = CURLE_SSL_INVALIDCERTSTATUS;
+- goto error;
++ goto out;
+ }
+
+ /* https://datatracker.ietf.org/doc/html/rfc5929#section-4.1 */
+- if(algo_nid == NID_md5 || algo_nid == NID_sha1) {
++ if(mdnid == NID_md5 || mdnid == NID_sha1) {
+ algo_type = EVP_sha256();
+ }
+ else {
+- algo_type = EVP_get_digestbynid(algo_nid);
++ algo_type = EVP_get_digestbynid(mdnid);
+ if(!algo_type) {
+- algo_name = OBJ_nid2sn(algo_nid);
++ algo_name = OBJ_nid2sn(mdnid);
+ failf(data, "Could not find digest algorithm %s (NID %d)",
+- algo_name ? algo_name : "(null)", algo_nid);
++ algo_name ? algo_name : "(null)", mdnid);
+ result = CURLE_SSL_INVALIDCERTSTATUS;
+- goto error;
++ goto out;
++ }
++ }
++
++#endif /* HAVE_OPENSSL3, else */
++
++ if(!algo_type) {
++ if(no_digest_acceptable) {
++ infof(data, "certificate exposes no signing digest algorithm, "
++ "nothing to add to channel binding");
++ result = CURLE_OK;
++ goto out;
+ }
++ /* unacceptable, something is wrong, fail */
++ algo_name = OBJ_nid2sn(mdnid);
++ failf(data, "Unable to find digest algorithm %s (NID %d) "
++ "for channel binding", algo_name ? algo_name : "(null)", mdnid);
++ result = CURLE_SSL_INVALIDCERTSTATUS;
++ goto out;
+ }
+
+ if(!X509_digest(cert, algo_type, buf, &length)) {
+- failf(data, "X509_digest() failed");
++ failf(data, "X509_digest() failed for channel binding");
+ result = CURLE_SSL_INVALIDCERTSTATUS;
+- goto error;
++ goto out;
+ }
+
+ /* Append "tls-server-end-point:" */
+ result = curlx_dyn_addn(binding, prefix, sizeof(prefix) - 1);
+ if(result)
+- goto error;
++ goto out;
+
+ /* Append digest */
+ result = curlx_dyn_addn(binding, buf, length);
+
+-error:
++out:
+ X509_free(cert);
+ return result;
+ }
diff --git a/curl.spec b/curl.spec
index 7728b1b..fbb0815 100644
--- a/curl.spec
+++ b/curl.spec
@@ -12,7 +12,7 @@
Summary: A utility for getting files from remote servers (FTP, HTTP, and others)
Name: curl
Version: 8.19.0
-Release: 2%{?dist}
+Release: 3%{?dist}
License: curl
Source0: https://curl.se/download/%{name}-%{version_no_tilde}.tar.xz
Source1: https://curl.se/download/%{name}-%{version_no_tilde}.tar.xz.asc
@@ -23,6 +23,8 @@ Source2: mykey.asc
# Fix test459 to pass when running tests in parallel
Patch001: 001-curl-8.19.0-test459-switch-to-mode-warn-for-stderr-check.patch
+# Don't fail channel binding for ML-DSA certificates
+Patch002: 002-curl-8.19.0-mldsa-channel-binding.patch
# patch making libcurl multilib ready
Patch101: 0101-curl-7.32.0-multilib.patch
@@ -450,6 +452,9 @@ rm -f ${RPM_BUILD_ROOT}%{_mandir}/man1/wcurl.1*
%{_libdir}/libcurl.so.4.[0-9].[0-9].minimal
%changelog
+* Tue Mar 24 2026 Rob Crittenden <rcritten@redhat.com> - 8.19.0-3
+- openssl channel_binding: lookup digest algorithm without NID
+
* Fri Mar 20 2026 Jan Macku <jamacku@redhat.com> - 8.19.0-2
- fix the failing test459 and test2502 after enabling parallel tests
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2026-11-02 14:32 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-02 14:32 [rpms/curl] curl-v8.21.0-9: Don't fail ML-DSA connection that requires channel binding Rob Crittenden
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox