]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
openssl: fix compiler warning with OpenSSL master
authorDaniel Stenberg <daniel@haxx.se>
Mon, 23 Feb 2026 08:11:18 +0000 (09:11 +0100)
committerDaniel Stenberg <daniel@haxx.se>
Mon, 23 Feb 2026 09:23:57 +0000 (10:23 +0100)
vtls/openssl.c:469:15: error: assignment discards â€˜const’ qualifier from pointer target type [-Wdiscarded-qualifiers]

X509_get_X509_PUBKEY() now returns a const pointer - but only on OpenSSL
3, we must keep the non-const version for all forks.

Closes #20681

lib/vtls/openssl.c

index f1f8843b9a8da66b1e8d568a95c4d05462cf39b8..4142e937a2d4f10b44484e4baa9300fffb4b5e82 100644 (file)
@@ -389,6 +389,13 @@ static CURLcode get_pkey_dh(struct Curl_easy *data,
   return result;
 }
 
+#ifdef HAVE_OPENSSL3
+/* from OpenSSL commit fc756e594ed5a27af378 */
+typedef const X509_PUBKEY pubkeytype_t;
+#else
+typedef X509_PUBKEY pubkeytype_t;
+#endif
+
 static CURLcode ossl_certchain(struct Curl_easy *data, SSL *ssl)
 {
   CURLcode result;
@@ -453,7 +460,7 @@ static CURLcode ossl_certchain(struct Curl_easy *data, SSL *ssl)
 
     {
       const X509_ALGOR *sigalg = NULL;
-      X509_PUBKEY *xpubkey = NULL;
+      pubkeytype_t *xpubkey = NULL;
       ASN1_OBJECT *pubkeyoid = NULL;
 
       X509_get0_signature(&psig, &sigalg, x);