openssl: fix compiler warning with OpenSSL master

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
This commit is contained in:
Daniel Stenberg 2026-02-23 09:11:18 +01:00
parent e8415ad3c7
commit 3877db7bcf
No known key found for this signature in database
GPG Key ID: 5CC908FDB71E12C2

View 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);