git: 6b8bbb468473 - main - devel/qt6-base: remove dead LibreSSL preprocessor/code

From: Charlie Li <vishwin_at_FreeBSD.org>
Date: Fri, 17 May 2024 21:39:39 UTC
The branch main has been updated by vishwin:

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

commit 6b8bbb468473f5b68faf9cd077c0583f7b2cf75d
Author:     Charlie Li <vishwin@FreeBSD.org>
AuthorDate: 2024-05-17 21:34:51 +0000
Commit:     Charlie Li <vishwin@FreeBSD.org>
CommitDate: 2024-05-17 21:39:20 +0000

    devel/qt6-base: remove dead LibreSSL preprocessor/code
    
    - remove guards for LibreSSL < 3.9
    - CRYPTO_free since 3.9 accepts file and line arguments as OpenSSL
---
 ...ns_tls_openssl_qsslsocket__openssl__symbols.cpp | 32 +++++---------
 ...s_tls_openssl_qsslsocket__openssl__symbols__p.h | 50 ++--------------------
 ...atch-src_plugins_tls_openssl_qx509__openssl.cpp | 48 ++-------------------
 3 files changed, 17 insertions(+), 113 deletions(-)

diff --git a/devel/qt6-base/files/patch-src_plugins_tls_openssl_qsslsocket__openssl__symbols.cpp b/devel/qt6-base/files/patch-src_plugins_tls_openssl_qsslsocket__openssl__symbols.cpp
index 902f6ae2be64..b8f5dfd475da 100644
--- a/devel/qt6-base/files/patch-src_plugins_tls_openssl_qsslsocket__openssl__symbols.cpp
+++ b/devel/qt6-base/files/patch-src_plugins_tls_openssl_qsslsocket__openssl__symbols.cpp
@@ -1,4 +1,4 @@
---- src/plugins/tls/openssl/qsslsocket_openssl_symbols.cpp.orig	2023-11-15 13:58:42 UTC
+--- src/plugins/tls/openssl/qsslsocket_openssl_symbols.cpp.orig	2024-03-19 15:46:43 UTC
 +++ src/plugins/tls/openssl/qsslsocket_openssl_symbols.cpp
 @@ -112,23 +112,36 @@ DEFINEFUNC(int, EVP_PKEY_up_ref, EVP_PKEY *a, a, retur
  DEFINEFUNC2(int, BN_is_word, BIGNUM *a, a, BN_ULONG w, w, return 0, return)
@@ -37,19 +37,7 @@
  #ifdef TLS1_3_VERSION
  DEFINEFUNC2(int, SSL_CTX_set_ciphersuites, SSL_CTX *ctx, ctx, const char *str, str, return 0, return)
  DEFINEFUNC2(void, SSL_set_psk_use_session_callback, SSL *ssl, ssl, q_SSL_psk_use_session_cb_func_t callback, callback, return, DUMMYARG)
-@@ -154,7 +167,11 @@ DEFINEFUNC(STACK_OF(X509) *, X509_STORE_CTX_get0_chain
- 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)
-+#ifndef LIBRESSL_VERSION_NUMBER
- DEFINEFUNC3(void, CRYPTO_free, void *str, str, const char *file, file, int line, line, return, DUMMYARG)
-+#else
-+DEFINEFUNC(void, CRYPTO_free, void *a, a, return, DUMMYARG)
-+#endif
- DEFINEFUNC3(int, CRYPTO_memcmp, const void * in_a, in_a, const void * in_b, in_b, size_t len, len, return 1, return);
- DEFINEFUNC(long, OpenSSL_version_num, void, DUMMYARG, return 0, return)
- DEFINEFUNC(const char *, OpenSSL_version, int a, a, return nullptr, return)
-@@ -193,7 +210,9 @@ DEFINEFUNC2(OCSP_RESPONSE *, OCSP_response_create, int
+@@ -193,7 +206,9 @@ DEFINEFUNC2(OCSP_RESPONSE *, OCSP_response_create, int
              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)
@@ -59,7 +47,7 @@
  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)
-@@ -214,7 +233,9 @@ DEFINEFUNC2(int, ASN1_STRING_to_UTF8, unsigned char **
+@@ -214,7 +229,9 @@ DEFINEFUNC2(int, ASN1_STRING_to_UTF8, unsigned char **
  DEFINEFUNC2(int, ASN1_INTEGER_cmp, const ASN1_INTEGER *a, a, const ASN1_INTEGER *b, b, return 1, return)
  DEFINEFUNC(int, ASN1_STRING_length, ASN1_STRING *a, a, return 0, return)
  DEFINEFUNC2(int, ASN1_STRING_to_UTF8, unsigned char **a, a, ASN1_STRING *b, b, return 0, return)
@@ -69,7 +57,7 @@
  DEFINEFUNC4(long, BIO_ctrl, BIO *a, a, int b, b, long c, c, void *d, d, return -1, return)
  DEFINEFUNC(int, BIO_free, BIO *a, a, return 0, return)
  DEFINEFUNC2(BIO *, BIO_new_mem_buf, void *a, a, int b, b, return nullptr, return)
-@@ -289,12 +310,14 @@ DEFINEFUNC(X509_STORE *, SSL_CTX_get_cert_store, const
+@@ -289,12 +306,14 @@ DEFINEFUNC(X509_STORE *, SSL_CTX_get_cert_store, const
  DEFINEFUNC2(int, SSL_CTX_use_PrivateKey, SSL_CTX *a, a, EVP_PKEY *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)
@@ -84,7 +72,7 @@
  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)
-@@ -761,8 +784,8 @@ static LoadedOpenSsl loadOpenSsl()
+@@ -761,8 +780,8 @@ static LoadedOpenSsl loadOpenSsl()
      libcrypto->setFileNameAndVersion("crypto"_L1, shlibVersion);
  #elif defined(SHLIB_VERSION_NUMBER)
      // first attempt: the canonical name is libssl.so.<SHLIB_VERSION_NUMBER>
@@ -95,7 +83,7 @@
  #endif // OPENSSL_SHLIB_VERSION
  
      if (libcrypto->load() && libssl->load()) {
-@@ -795,8 +818,8 @@ static LoadedOpenSsl loadOpenSsl()
+@@ -795,8 +814,8 @@ static LoadedOpenSsl loadOpenSsl()
      libssl->setFileNameAndVersion("ssl"_L1 + suffix, -1);
      libcrypto->setFileNameAndVersion("crypto"_L1 + suffix, -1);
  # else
@@ -106,7 +94,7 @@
  # endif
      if (libcrypto->load() && libssl->load()) {
          // libssl.so.0 and libcrypto.so.0 found
-@@ -865,21 +888,34 @@ bool q_resolveOpenSslSymbols()
+@@ -865,21 +884,34 @@ bool q_resolveOpenSslSymbols()
          RESOLVEFUNC(EVP_CIPHER_CTX_reset)
          RESOLVEFUNC(AUTHORITY_INFO_ACCESS_free)
          RESOLVEFUNC(EVP_PKEY_up_ref)
@@ -141,7 +129,7 @@
  #ifdef TLS1_3_VERSION
          RESOLVEFUNC(SSL_CTX_set_ciphersuites)
          RESOLVEFUNC(SSL_set_psk_use_session_callback)
-@@ -961,7 +997,9 @@ bool q_resolveOpenSslSymbols()
+@@ -961,7 +993,9 @@ bool q_resolveOpenSslSymbols()
          RESOLVEFUNC(OCSP_check_validity)
          RESOLVEFUNC(OCSP_cert_to_id)
          RESOLVEFUNC(OCSP_id_get0_info)
@@ -152,7 +140,7 @@
          RESOLVEFUNC(OCSP_basic_sign)
          RESOLVEFUNC(OCSP_response_create)
          RESOLVEFUNC(i2d_OCSP_RESPONSE)
-@@ -1056,12 +1094,14 @@ bool q_resolveOpenSslSymbols()
+@@ -1056,12 +1090,14 @@ bool q_resolveOpenSslSymbols()
          RESOLVEFUNC(SSL_CTX_use_PrivateKey)
          RESOLVEFUNC(SSL_CTX_use_PrivateKey_file)
          RESOLVEFUNC(SSL_CTX_get_cert_store);
@@ -167,7 +155,7 @@
          RESOLVEFUNC(SSL_accept)
          RESOLVEFUNC(SSL_clear)
          RESOLVEFUNC(SSL_connect)
-@@ -1121,7 +1161,9 @@ bool q_resolveOpenSslSymbols()
+@@ -1121,7 +1157,9 @@ bool q_resolveOpenSslSymbols()
          RESOLVEFUNC(RSA_free)
  
          RESOLVEFUNC(DH_bits)
diff --git a/devel/qt6-base/files/patch-src_plugins_tls_openssl_qsslsocket__openssl__symbols__p.h b/devel/qt6-base/files/patch-src_plugins_tls_openssl_qsslsocket__openssl__symbols__p.h
index 565d27f71f8f..0f92172a0f4c 100644
--- a/devel/qt6-base/files/patch-src_plugins_tls_openssl_qsslsocket__openssl__symbols__p.h
+++ b/devel/qt6-base/files/patch-src_plugins_tls_openssl_qsslsocket__openssl__symbols__p.h
@@ -1,4 +1,4 @@
---- src/plugins/tls/openssl/qsslsocket_openssl_symbols_p.h.orig	2023-09-15 10:20:51 UTC
+--- src/plugins/tls/openssl/qsslsocket_openssl_symbols_p.h.orig	2024-03-19 15:46:43 UTC
 +++ src/plugins/tls/openssl/qsslsocket_openssl_symbols_p.h
 @@ -46,6 +46,13 @@ QT_BEGIN_NAMESPACE
  
@@ -47,7 +47,7 @@
  int q_SSL_session_reused(SSL *a);
  qssloptions q_SSL_CTX_set_options(SSL_CTX *ctx, qssloptions op);
  int q_OPENSSL_init_ssl(uint64_t opts, const OPENSSL_INIT_SETTINGS *settings);
-@@ -237,9 +261,15 @@ STACK_OF(X509) *q_X509_STORE_CTX_get0_chain(X509_STORE
+@@ -237,8 +261,13 @@ STACK_OF(X509) *q_X509_STORE_CTX_get0_chain(X509_STORE
  # define q_SSL_load_error_strings() q_OPENSSL_init_ssl(OPENSSL_INIT_LOAD_SSL_STRINGS \
                                                         | OPENSSL_INIT_LOAD_CRYPTO_STRINGS, NULL)
  
@@ -59,11 +59,9 @@
 +#define q_SKM_sk_value(type, st,i) ((type * (*)(const STACK_OF(type) *, int))q_sk_value)(st, i)
 +#endif // LIBRESSL_VERSION_NUMBER
  
-+
  #define q_OPENSSL_add_all_algorithms_conf()  q_OPENSSL_init_crypto(OPENSSL_INIT_ADD_ALL_CIPHERS \
                                                                     | OPENSSL_INIT_ADD_ALL_DIGESTS \
-                                                                    | OPENSSL_INIT_LOAD_CONFIG, NULL)
-@@ -423,12 +453,14 @@ X509_STORE *q_SSL_CTX_get_cert_store(const SSL_CTX *a)
+@@ -423,12 +452,14 @@ X509_STORE *q_SSL_CTX_get_cert_store(const SSL_CTX *a)
  int q_SSL_CTX_use_PrivateKey(SSL_CTX *a, EVP_PKEY *b);
  int q_SSL_CTX_use_PrivateKey_file(SSL_CTX *a, const char *b, int c);
  X509_STORE *q_SSL_CTX_get_cert_store(const SSL_CTX *a);
@@ -78,7 +76,7 @@
  void q_SSL_free(SSL *a);
  STACK_OF(SSL_CIPHER) *q_SSL_get_ciphers(const SSL *a);
  const SSL_CIPHER *q_SSL_get_current_cipher(SSL *a);
-@@ -537,14 +569,26 @@ void q_PKCS12_free(PKCS12 *pkcs12);
+@@ -537,14 +568,26 @@ void q_PKCS12_free(PKCS12 *pkcs12);
  #define q_BIO_get_mem_data(b, pp) (int)q_BIO_ctrl(b,BIO_CTRL_INFO,0,(char *)pp)
  #define q_BIO_pending(b) (int)q_BIO_ctrl(b,BIO_CTRL_PENDING,0,NULL)
  #define q_SSL_CTX_set_mode(ctx,op) q_SSL_CTX_ctrl((ctx),SSL_CTRL_MODE,(op),NULL)
@@ -105,43 +103,3 @@
  #define q_sk_SSL_CIPHER_value(st, i) q_SKM_sk_value(SSL_CIPHER, (st), (i))
  #define q_SSL_CTX_add_extra_chain_cert(ctx,x509) \
          q_SSL_CTX_ctrl(ctx,SSL_CTRL_EXTRA_CHAIN_CERT,0,(char *)x509)
-@@ -646,7 +690,11 @@ int q_OCSP_id_get0_info(ASN1_OCTET_STRING **piNameHash
- int q_OCSP_id_get0_info(ASN1_OCTET_STRING **piNameHash, ASN1_OBJECT **pmd, ASN1_OCTET_STRING **pikeyHash,
-                         ASN1_INTEGER **pserial, OCSP_CERTID *cid);
- 
-+#if defined(LIBRESSL_VERSION_NUMBER) && LIBRESSL_VERSION_NUMBER < 0x3050000fL
-+#define q_OCSP_resp_get0_certs(bs) ((bs)->certs)
-+#else
- const STACK_OF(X509) *q_OCSP_resp_get0_certs(const OCSP_BASICRESP *bs);
-+#endif
- OCSP_CERTID *q_OCSP_cert_to_id(const EVP_MD *dgst, X509 *subject, X509 *issuer);
- void q_OCSP_CERTID_free(OCSP_CERTID *cid);
- int q_OCSP_id_cmp(OCSP_CERTID *a, OCSP_CERTID *b);
-@@ -665,8 +713,15 @@ void *q_CRYPTO_malloc(size_t num, const char *file, in
- 
- void *q_CRYPTO_malloc(size_t num, const char *file, int line);
- #define q_OPENSSL_malloc(num) q_CRYPTO_malloc(num, "", 0)
-+
-+#ifndef LIBRESSL_VERSION_NUMBER
- void q_CRYPTO_free(void *str, const char *file, int line);
- # define q_OPENSSL_free(addr) q_CRYPTO_free(addr, "", 0)
-+#else
-+void q_CRYPTO_free(void *a);
-+# define q_OPENSSL_free(addr) q_CRYPTO_free(addr)
-+#endif
-+
- int q_CRYPTO_memcmp(const void * in_a, const void * in_b, size_t len);
- 
- void q_SSL_set_info_callback(SSL *ssl, void (*cb) (const SSL *ssl, int type, int val));
-@@ -730,7 +785,11 @@ int q_RSA_bits(RSA *a);
- 
- int q_DH_bits(DH *dh);
- int q_RSA_bits(RSA *a);
-+#if defined(LIBRESSL_VERSION_NUMBER) && (LIBRESSL_VERSION_NUMBER < 0x3050000fL)
-+#define q_DSA_bits(dsa) q_BN_num_bits((dsa)->p)
-+#else
- int q_DSA_bits(DSA *a);
-+#endif
- 
- int q_EVP_PKEY_assign(EVP_PKEY *a, int b, void *r);
- int q_EVP_PKEY_cmp(const EVP_PKEY *a, const EVP_PKEY *b);
diff --git a/devel/qt6-base/files/patch-src_plugins_tls_openssl_qx509__openssl.cpp b/devel/qt6-base/files/patch-src_plugins_tls_openssl_qx509__openssl.cpp
index 2c822ea8c44c..a391e32bdd42 100644
--- a/devel/qt6-base/files/patch-src_plugins_tls_openssl_qx509__openssl.cpp
+++ b/devel/qt6-base/files/patch-src_plugins_tls_openssl_qx509__openssl.cpp
@@ -1,48 +1,6 @@
---- src/plugins/tls/openssl/qx509_openssl.cpp.orig	2023-09-21 19:24:26 UTC
+--- src/plugins/tls/openssl/qx509_openssl.cpp.orig	2024-03-19 15:46:43 UTC
 +++ src/plugins/tls/openssl/qx509_openssl.cpp
-@@ -64,7 +64,12 @@ QMultiMap<QByteArray, QString> mapFromX509Name(X509_NA
-         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));
--        q_CRYPTO_free(data, nullptr, 0);
-+#ifndef LIBRESSL_VERSION_NUMBER
-+         q_CRYPTO_free(data, nullptr, 0);
-+#else
-+         q_CRYPTO_free(data);
-+#endif
-+
-     }
- 
-     return info;
-@@ -75,11 +80,27 @@ QDateTime dateTimeFromASN1(const ASN1_TIME *aTime)
-     QDateTime result;
-     tm lTime;
- 
-+#if defined(LIBRESSL_VERSION_NUMBER) && (LIBRESSL_VERSION_NUMBER < 0x3060000fL)
-+    const char *data;
-+    size_t len;
-+    int type;
-+
-+    data = (const char*)ASN1_STRING_get0_data((const ASN1_STRING *)aTime);
-+    len = ASN1_STRING_length(aTime);
-+    type = ASN1_STRING_type(aTime);
-+
-+    if (ASN1_time_parse(data, len, &lTime, type) == type) {
-+        QDate resDate(lTime.tm_year + 1900, lTime.tm_mon + 1, lTime.tm_mday);
-+        QTime resTime(lTime.tm_hour, lTime.tm_min, lTime.tm_sec);
-+        result = QDateTime(resDate, resTime, Qt::UTC);
-+    }
-+#else
-     if (q_ASN1_TIME_to_tm(aTime, &lTime)) {
-         QDate resDate(lTime.tm_year + 1900, lTime.tm_mon + 1, lTime.tm_mday);
-         QTime resTime(lTime.tm_hour, lTime.tm_min, lTime.tm_sec);
-         result = QDateTime(resDate, resTime, QTimeZone::UTC);
-     }
-+#endif
- 
-     return result;
- }
-@@ -190,7 +211,11 @@ QVariant x509UnknownExtensionToValue(X509_EXTENSION *e
+@@ -190,7 +190,11 @@ QVariant x509UnknownExtensionToValue(X509_EXTENSION *e
          QVariantList list;
          bool isMap = false;
  
@@ -54,7 +12,7 @@
              CONF_VALUE *nval = q_SKM_sk_value(CONF_VALUE, val, j);
              if (nval->name && nval->value) {
                  isMap = true;
-@@ -286,7 +311,11 @@ QVariant x509ExtensionToValue(X509_EXTENSION *ext)
+@@ -286,7 +290,11 @@ QVariant x509ExtensionToValue(X509_EXTENSION *ext)
              if (!info)
                  return {};
              QVariantMap result;