git: ce78e24f5d76 - main - net/qt5-network: fix with LibreSSL 3.5

From: Charlie Li <vishwin_at_FreeBSD.org>
Date: Wed, 25 May 2022 19:06:06 UTC
The branch main has been updated by vishwin:

URL: https://cgit.FreeBSD.org/ports/commit/?id=ce78e24f5d7629db168513026f50ce95ff2ff74f

commit ce78e24f5d7629db168513026f50ce95ff2ff74f
Author:     Charlie Li <vishwin@FreeBSD.org>
AuthorDate: 2022-03-21 07:57:00 +0000
Commit:     Charlie Li <vishwin@FreeBSD.org>
CommitDate: 2022-05-25 19:05:29 +0000

    net/qt5-network: fix with LibreSSL 3.5
    
    LibreSSL 3.5 opaqued many structs and implemented more functions
    in line with OpenSSL 1.1
    
    Approved by: tcberner (mentor, kde)
    Differential Revision: https://reviews.freebsd.org/D34619
---
 ...ch-src_network_ssl_qsslcertificate__openssl.cpp |  6 ++--
 .../patch-src_network_ssl_qsslcontext__openssl.cpp | 10 +++----
 ...patch-src_network_ssl_qsslcontext__openssl__p.h |  2 +-
 .../patch-src_network_ssl_qsslsocket__openssl.cpp  |  2 +-
 ...rc_network_ssl_qsslsocket__openssl__symbols.cpp | 34 ++++++++++++----------
 ...c_network_ssl_qsslsocket__openssl__symbols__p.h |  8 ++---
 6 files changed, 32 insertions(+), 30 deletions(-)

diff --git a/net/qt5-network/files/patch-src_network_ssl_qsslcertificate__openssl.cpp b/net/qt5-network/files/patch-src_network_ssl_qsslcertificate__openssl.cpp
index 38eddeb6f85f..41377f6f1735 100644
--- a/net/qt5-network/files/patch-src_network_ssl_qsslcertificate__openssl.cpp
+++ b/net/qt5-network/files/patch-src_network_ssl_qsslcertificate__openssl.cpp
@@ -1,7 +1,7 @@
-Patch from Gentoo: https://gitweb.gentoo.org/repo/gentoo.git/plain/dev-qt/qtnetwork/files/qtnetwork-5.15.1-libressl.patch
---- src/network/ssl/qsslcertificate_openssl.cpp.orig	2020-09-02 10:15:07 UTC
+Patch based on Gentoo: https://gitweb.gentoo.org/repo/gentoo.git/tree/dev-qt/qtnetwork/files/qtnetwork-5.15.1-libressl.patch?id=c60b2b11bd17afca9bbe546db12918f789b57e25
+--- src/network/ssl/qsslcertificate_openssl.cpp.orig	2021-12-07 13:51:35 UTC
 +++ src/network/ssl/qsslcertificate_openssl.cpp
-@@ -661,7 +661,7 @@ static QMultiMap<QByteArray, QString> _q_mapFromX509Na
+@@ -691,7 +691,7 @@ static QMultiMap<QByteArray, QString> _q_mapFromX509Na
          unsigned char *data = nullptr;
          int size = q_ASN1_STRING_to_UTF8(&data, q_X509_NAME_ENTRY_get_data(e));
          info.insert(name, QString::fromUtf8((char*)data, size));
diff --git a/net/qt5-network/files/patch-src_network_ssl_qsslcontext__openssl.cpp b/net/qt5-network/files/patch-src_network_ssl_qsslcontext__openssl.cpp
index 754d2d40ac50..58d36083bccb 100644
--- a/net/qt5-network/files/patch-src_network_ssl_qsslcontext__openssl.cpp
+++ b/net/qt5-network/files/patch-src_network_ssl_qsslcontext__openssl.cpp
@@ -1,7 +1,7 @@
-Patch from Gentoo: https://gitweb.gentoo.org/repo/gentoo.git/plain/dev-qt/qtnetwork/files/qtnetwork-5.15.1-libressl.patch
---- src/network/ssl/qsslcontext_openssl.cpp.orig	2020-09-02 10:15:07 UTC
+Patch based on Gentoo: https://gitweb.gentoo.org/repo/gentoo.git/tree/dev-qt/qtnetwork/files/qtnetwork-5.15.1-libressl.patch?id=c60b2b11bd17afca9bbe546db12918f789b57e25
+--- src/network/ssl/qsslcontext_openssl.cpp.orig	2021-12-07 13:51:35 UTC
 +++ src/network/ssl/qsslcontext_openssl.cpp
-@@ -397,16 +397,28 @@ init_context:
+@@ -408,16 +408,28 @@ init_context:
          maxVersion = DTLS1_VERSION;
          break;
      case QSsl::DtlsV1_0OrLater:
@@ -30,7 +30,7 @@ Patch from Gentoo: https://gitweb.gentoo.org/repo/gentoo.git/plain/dev-qt/qtnetw
          break;
      case QSsl::TlsV1_3OrLater:
  #ifdef TLS1_3_VERSION
-@@ -711,6 +723,7 @@ void QSslContext::applyBackendConfig(QSslContext *sslC
+@@ -722,6 +734,7 @@ void QSslContext::applyBackendConfig(QSslContext *sslC
      }
  #endif // ocsp
  
@@ -38,7 +38,7 @@ Patch from Gentoo: https://gitweb.gentoo.org/repo/gentoo.git/plain/dev-qt/qtnetw
      QSharedPointer<SSL_CONF_CTX> cctx(q_SSL_CONF_CTX_new(), &q_SSL_CONF_CTX_free);
      if (cctx) {
          q_SSL_CONF_CTX_set_ssl_ctx(cctx.data(), sslContext->ctx);
-@@ -757,7 +770,9 @@ void QSslContext::applyBackendConfig(QSslContext *sslC
+@@ -768,7 +781,9 @@ void QSslContext::applyBackendConfig(QSslContext *sslC
              sslContext->errorStr = msgErrorSettingBackendConfig(QSslSocket::tr("SSL_CONF_finish() failed"));
              sslContext->errorCode = QSslError::UnspecifiedError;
          }
diff --git a/net/qt5-network/files/patch-src_network_ssl_qsslcontext__openssl__p.h b/net/qt5-network/files/patch-src_network_ssl_qsslcontext__openssl__p.h
index e8965b74a737..284b01bdd24b 100644
--- a/net/qt5-network/files/patch-src_network_ssl_qsslcontext__openssl__p.h
+++ b/net/qt5-network/files/patch-src_network_ssl_qsslcontext__openssl__p.h
@@ -1,4 +1,4 @@
-Patch from Gentoo: https://gitweb.gentoo.org/repo/gentoo.git/plain/dev-qt/qtnetwork/files/qtnetwork-5.15.1-libressl.patch
+Patch based on Gentoo: https://gitweb.gentoo.org/repo/gentoo.git/tree/dev-qt/qtnetwork/files/qtnetwork-5.15.1-libressl.patch?id=c60b2b11bd17afca9bbe546db12918f789b57e25
 --- src/network/ssl/qsslcontext_openssl_p.h.orig	2020-09-02 10:15:07 UTC
 +++ src/network/ssl/qsslcontext_openssl_p.h
 @@ -61,6 +61,13 @@
diff --git a/net/qt5-network/files/patch-src_network_ssl_qsslsocket__openssl.cpp b/net/qt5-network/files/patch-src_network_ssl_qsslsocket__openssl.cpp
index 5655fb1f7fb8..d44e286fc3fa 100644
--- a/net/qt5-network/files/patch-src_network_ssl_qsslsocket__openssl.cpp
+++ b/net/qt5-network/files/patch-src_network_ssl_qsslsocket__openssl.cpp
@@ -1,4 +1,4 @@
-Patch from Gentoo: https://gitweb.gentoo.org/repo/gentoo.git/plain/dev-qt/qtnetwork/files/qtnetwork-5.15.1-libressl.patch
+Patch based on Gentoo: https://gitweb.gentoo.org/repo/gentoo.git/tree/dev-qt/qtnetwork/files/qtnetwork-5.15.1-libressl.patch?id=c60b2b11bd17afca9bbe546db12918f789b57e25
 --- src/network/ssl/qsslsocket_openssl.cpp.orig	2020-10-27 08:02:11 UTC
 +++ src/network/ssl/qsslsocket_openssl.cpp
 @@ -238,7 +238,11 @@ static int q_ssl_psk_use_session_callback(SSL *ssl, co
diff --git a/net/qt5-network/files/patch-src_network_ssl_qsslsocket__openssl__symbols.cpp b/net/qt5-network/files/patch-src_network_ssl_qsslsocket__openssl__symbols.cpp
index 48a847fcc8e9..beb605952d7a 100644
--- a/net/qt5-network/files/patch-src_network_ssl_qsslsocket__openssl__symbols.cpp
+++ b/net/qt5-network/files/patch-src_network_ssl_qsslsocket__openssl__symbols.cpp
@@ -1,7 +1,7 @@
-Patch from Gentoo: https://gitweb.gentoo.org/repo/gentoo.git/plain/dev-qt/qtnetwork/files/qtnetwork-5.15.1-libressl.patch
---- src/network/ssl/qsslsocket_openssl_symbols.cpp.orig	2020-09-02 10:15:07 UTC
+Patch based on Gentoo: https://gitweb.gentoo.org/repo/gentoo.git/tree/dev-qt/qtnetwork/files/qtnetwork-5.15.1-libressl.patch?id=c60b2b11bd17afca9bbe546db12918f789b57e25
+--- src/network/ssl/qsslsocket_openssl_symbols.cpp.orig	2021-12-07 13:51:35 UTC
 +++ src/network/ssl/qsslsocket_openssl_symbols.cpp
-@@ -145,11 +145,14 @@ DEFINEFUNC(const BIO_METHOD *, BIO_s_mem, void, DUMMYA
+@@ -145,18 +145,31 @@ DEFINEFUNC(const BIO_METHOD *, BIO_s_mem, void, DUMMYA
  DEFINEFUNC2(int, BN_is_word, BIGNUM *a, a, BN_ULONG w, w, return 0, return)
  DEFINEFUNC(int, EVP_CIPHER_CTX_reset, EVP_CIPHER_CTX *c, c, return 0, return)
  DEFINEFUNC(int, EVP_PKEY_up_ref, EVP_PKEY *a, a, return 0, return)
@@ -12,11 +12,13 @@ Patch from Gentoo: https://gitweb.gentoo.org/repo/gentoo.git/plain/dev-qt/qtnetw
 +#endif // OPENSSL_NO_DEPRECATED_3_0
  DEFINEFUNC(int, EVP_PKEY_base_id, EVP_PKEY *a, a, return NID_undef, return)
  DEFINEFUNC(int, RSA_bits, RSA *a, a, return 0, return)
-+#ifndef LIBRESSL_VERSION_NUMBER
++#if !defined(LIBRESSL_VERSION_NUMBER) || (defined(LIBRESSL_VERSION_NUMBER) && LIBRESSL_VERSION_NUMBER >= 0x03050000fL)
  DEFINEFUNC(int, DSA_bits, DSA *a, a, return 0, return)
++#endif
++#ifndef LIBRESSL_VERSION_NUMBER
  DEFINEFUNC(int, OPENSSL_sk_num, OPENSSL_STACK *a, a, return -1, return)
  DEFINEFUNC2(void, OPENSSL_sk_pop_free, OPENSSL_STACK *a, a, void (*b)(void*), b, return, DUMMYARG)
-@@ -157,6 +160,14 @@ DEFINEFUNC(OPENSSL_STACK *, OPENSSL_sk_new_null, DUMMY
+ DEFINEFUNC(OPENSSL_STACK *, OPENSSL_sk_new_null, DUMMYARG, DUMMYARG, return nullptr, return)
  DEFINEFUNC2(void, OPENSSL_sk_push, OPENSSL_STACK *a, a, void *b, b, return, DUMMYARG)
  DEFINEFUNC(void, OPENSSL_sk_free, OPENSSL_STACK *a, a, return, DUMMYARG)
  DEFINEFUNC2(void *, OPENSSL_sk_value, OPENSSL_STACK *a, a, int b, b, return nullptr, return)
@@ -30,8 +32,8 @@ Patch from Gentoo: https://gitweb.gentoo.org/repo/gentoo.git/plain/dev-qt/qtnetw
 +#endif // LIBRESSL_VERSION_NUMBER
  DEFINEFUNC(int, SSL_session_reused, SSL *a, a, return 0, return)
  DEFINEFUNC2(unsigned long, SSL_CTX_set_options, SSL_CTX *ctx, ctx, unsigned long op, op, return 0, return)
- #ifdef TLS1_3_VERSION
-@@ -182,7 +193,11 @@ DEFINEFUNC2(void, X509_STORE_set_verify_cb, X509_STORE
+ DEFINEFUNC(int, SSL_CTX_get_security_level, const SSL_CTX *ctx, ctx, return -1, return)
+@@ -184,7 +197,11 @@ DEFINEFUNC2(void, X509_STORE_set_verify_cb, X509_STORE
  DEFINEFUNC3(int, X509_STORE_set_ex_data, X509_STORE *a, a, int idx, idx, void *data, data, return 0, return)
  DEFINEFUNC2(void *, X509_STORE_get_ex_data, X509_STORE *r, r, int idx, idx, return nullptr, return)
  DEFINEFUNC(STACK_OF(X509) *, X509_STORE_CTX_get0_chain, X509_STORE_CTX *a, a, return nullptr, return)
@@ -43,17 +45,17 @@ Patch from Gentoo: https://gitweb.gentoo.org/repo/gentoo.git/plain/dev-qt/qtnetw
  DEFINEFUNC(long, OpenSSL_version_num, void, DUMMYARG, return 0, return)
  DEFINEFUNC(const char *, OpenSSL_version, int a, a, return nullptr, return)
  DEFINEFUNC(unsigned long, SSL_SESSION_get_ticket_lifetime_hint, const SSL_SESSION *session, session, return 0, return)
-@@ -222,7 +237,9 @@ DEFINEFUNC5(int, OCSP_id_get0_info, ASN1_OCTET_STRING 
+@@ -224,7 +241,9 @@ DEFINEFUNC5(int, OCSP_id_get0_info, ASN1_OCTET_STRING 
              ASN1_OCTET_STRING **piKeyHash, piKeyHash, ASN1_INTEGER **pserial, pserial, OCSP_CERTID *cid, cid,
              return 0, return)
  DEFINEFUNC2(OCSP_RESPONSE *, OCSP_response_create, int status, status, OCSP_BASICRESP *bs, bs, return nullptr, return)
-+#ifndef LIBRESSL_VERSION_NUMBER
++#if !defined(LIBRESSL_VERSION_NUMBER) || (defined(LIBRESSL_VERSION_NUMBER) && LIBRESSL_VERSION_NUMBER >= 0x03050000fL)
  DEFINEFUNC(const STACK_OF(X509) *, OCSP_resp_get0_certs, const OCSP_BASICRESP *bs, bs, return nullptr, return)
 +#endif
  DEFINEFUNC2(int, OCSP_id_cmp, OCSP_CERTID *a, a, OCSP_CERTID *b, b, return -1, return)
  DEFINEFUNC7(OCSP_SINGLERESP *, OCSP_basic_add1_status, OCSP_BASICRESP *r, r, OCSP_CERTID *c, c, int s, s,
              int re, re, ASN1_TIME *rt, rt, ASN1_TIME *t, t, ASN1_TIME *n, n, return nullptr, return)
-@@ -354,12 +371,14 @@ DEFINEFUNC2(int, SSL_CTX_use_PrivateKey, SSL_CTX *a, a
+@@ -356,12 +375,14 @@ DEFINEFUNC2(int, SSL_CTX_use_PrivateKey, SSL_CTX *a, a
  DEFINEFUNC2(int, SSL_CTX_use_RSAPrivateKey, SSL_CTX *a, a, RSA *b, b, return -1, return)
  DEFINEFUNC3(int, SSL_CTX_use_PrivateKey_file, SSL_CTX *a, a, const char *b, b, int c, c, return -1, return)
  DEFINEFUNC(X509_STORE *, SSL_CTX_get_cert_store, const SSL_CTX *a, a, return nullptr, return)
@@ -68,7 +70,7 @@ Patch from Gentoo: https://gitweb.gentoo.org/repo/gentoo.git/plain/dev-qt/qtnetw
  DEFINEFUNC(void, SSL_free, SSL *a, a, return, DUMMYARG)
  DEFINEFUNC(STACK_OF(SSL_CIPHER) *, SSL_get_ciphers, const SSL *a, a, return nullptr, return)
  DEFINEFUNC(const SSL_CIPHER *, SSL_get_current_cipher, SSL *a, a, return nullptr, return)
-@@ -843,17 +862,21 @@ bool q_resolveOpenSslSymbols()
+@@ -845,17 +866,21 @@ bool q_resolveOpenSslSymbols()
      RESOLVEFUNC(ASN1_STRING_get0_data)
      RESOLVEFUNC(EVP_CIPHER_CTX_reset)
      RESOLVEFUNC(EVP_PKEY_up_ref)
@@ -89,18 +91,18 @@ Patch from Gentoo: https://gitweb.gentoo.org/repo/gentoo.git/plain/dev-qt/qtnetw
 +#endif
      RESOLVEFUNC(DH_get0_pqg)
      RESOLVEFUNC(SSL_CTX_set_options)
- 
-@@ -895,7 +918,9 @@ bool q_resolveOpenSslSymbols()
+     RESOLVEFUNC(SSL_CTX_get_security_level)
+@@ -898,7 +923,9 @@ bool q_resolveOpenSslSymbols()
  
      RESOLVEFUNC(SSL_SESSION_get_ticket_lifetime_hint)
      RESOLVEFUNC(DH_bits)
-+#ifndef LIBRESSL_VERSION_NUMBER
++#if !defined(LIBRESSL_VERSION_NUMBER) || (defined(LIBRESSL_VERSION_NUMBER) && LIBRESSL_VERSION_NUMBER >= 0x03050000fL)
      RESOLVEFUNC(DSA_bits)
 +#endif
  
  #if QT_CONFIG(dtls)
      RESOLVEFUNC(DTLSv1_listen)
-@@ -925,7 +950,9 @@ bool q_resolveOpenSslSymbols()
+@@ -928,7 +955,9 @@ bool q_resolveOpenSslSymbols()
      RESOLVEFUNC(OCSP_check_validity)
      RESOLVEFUNC(OCSP_cert_to_id)
      RESOLVEFUNC(OCSP_id_get0_info)
@@ -110,7 +112,7 @@ Patch from Gentoo: https://gitweb.gentoo.org/repo/gentoo.git/plain/dev-qt/qtnetw
      RESOLVEFUNC(OCSP_basic_sign)
      RESOLVEFUNC(OCSP_response_create)
      RESOLVEFUNC(i2d_OCSP_RESPONSE)
-@@ -1055,12 +1082,14 @@ bool q_resolveOpenSslSymbols()
+@@ -1058,12 +1087,14 @@ bool q_resolveOpenSslSymbols()
      RESOLVEFUNC(SSL_CTX_use_RSAPrivateKey)
      RESOLVEFUNC(SSL_CTX_use_PrivateKey_file)
      RESOLVEFUNC(SSL_CTX_get_cert_store);
diff --git a/net/qt5-network/files/patch-src_network_ssl_qsslsocket__openssl__symbols__p.h b/net/qt5-network/files/patch-src_network_ssl_qsslsocket__openssl__symbols__p.h
index 1ad629e6cee0..d7af4da7063d 100644
--- a/net/qt5-network/files/patch-src_network_ssl_qsslsocket__openssl__symbols__p.h
+++ b/net/qt5-network/files/patch-src_network_ssl_qsslsocket__openssl__symbols__p.h
@@ -1,5 +1,5 @@
-Patch from Gentoo: https://gitweb.gentoo.org/repo/gentoo.git/plain/dev-qt/qtnetwork/files/qtnetwork-5.15.1-libressl.patch
---- src/network/ssl/qsslsocket_openssl_symbols_p.h.orig	2020-09-02 10:15:07 UTC
+Patch based on Gentoo: https://gitweb.gentoo.org/repo/gentoo.git/tree/dev-qt/qtnetwork/files/qtnetwork-5.15.1-libressl.patch?id=c60b2b11bd17afca9bbe546db12918f789b57e25
+--- src/network/ssl/qsslsocket_openssl_symbols_p.h.orig	2021-12-07 13:51:35 UTC
 +++ src/network/ssl/qsslsocket_openssl_symbols_p.h
 @@ -80,6 +80,13 @@ QT_BEGIN_NAMESPACE
  
@@ -19,7 +19,7 @@ Patch from Gentoo: https://gitweb.gentoo.org/repo/gentoo.git/plain/dev-qt/qtnetw
  Q_AUTOTEST_EXPORT BIO *q_BIO_new(const BIO_METHOD *a);
  Q_AUTOTEST_EXPORT const BIO_METHOD *q_BIO_s_mem();
  
-+#ifndef LIBRESSL_VERSION_NUMBER
++#if !defined(LIBRESSL_VERSION_NUMBER) || (defined(LIBRESSL_VERSION_NUMBER) && LIBRESSL_VERSION_NUMBER >= 0x03050000fL)
  int q_DSA_bits(DSA *a);
 +#else
 +#define q_DSA_bits(dsa) q_BN_num_bits((dsa)->p)
@@ -104,7 +104,7 @@ Patch from Gentoo: https://gitweb.gentoo.org/repo/gentoo.git/plain/dev-qt/qtnetw
  int q_OCSP_id_get0_info(ASN1_OCTET_STRING **piNameHash, ASN1_OBJECT **pmd, ASN1_OCTET_STRING **pikeyHash,
                          ASN1_INTEGER **pserial, OCSP_CERTID *cid);
  
-+#ifndef LIBRESSL_VERSION_NUMBER
++#if !defined(LIBRESSL_VERSION_NUMBER) || (defined(LIBRESSL_VERSION_NUMBER) && LIBRESSL_VERSION_NUMBER >= 0x03050000fL)
  const STACK_OF(X509) *q_OCSP_resp_get0_certs(const OCSP_BASICRESP *bs);
 +#else
 +#define q_OCSP_resp_get0_certs(bs) ((bs)->certs)