git: 41488fd38012 - 2025Q3 - devel/qca: fix LibreSSL support

From: Max Brazhnikov <makc_at_FreeBSD.org>
Date: Tue, 09 Sep 2025 10:03:00 UTC
The branch 2025Q3 has been updated by makc:

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

commit 41488fd38012b12caf1ec9cd924ced487f946987
Author:     Max Brazhnikov <makc@FreeBSD.org>
AuthorDate: 2025-09-09 09:54:53 +0000
Commit:     Max Brazhnikov <makc@FreeBSD.org>
CommitDate: 2025-09-09 09:59:34 +0000

    devel/qca: fix LibreSSL support
    
    PR:             286678
    Submitted by:   Dave Hayes
    
    (cherry picked from commit c3c6a3a4ae8a87c43bbeafe44a1fe3484dd2e3a2)
---
 .../qca/files/patch-plugins_qca-ossl_qca-ossl.cpp  | 99 +++++-----------------
 1 file changed, 20 insertions(+), 79 deletions(-)

diff --git a/devel/qca/files/patch-plugins_qca-ossl_qca-ossl.cpp b/devel/qca/files/patch-plugins_qca-ossl_qca-ossl.cpp
index 10548649b6bd..5f72d93bd27e 100644
--- a/devel/qca/files/patch-plugins_qca-ossl_qca-ossl.cpp
+++ b/devel/qca/files/patch-plugins_qca-ossl_qca-ossl.cpp
@@ -1,94 +1,35 @@
-Patch from OpenBSD rsadowski@ 
-
-LibreSSL 3.0.x support from Stefan Strogin <steils@gentoo.org>
+Fix compilation with LibreSSL
 
 Index: plugins/qca-ossl/qca-ossl.cpp
---- plugins/qca-ossl/qca-ossl.cpp.orig	2025-03-09 12:09:03 UTC
+--- plugins/qca-ossl/qca-ossl.cpp.orig
 +++ plugins/qca-ossl/qca-ossl.cpp
-@@ -45,7 +45,13 @@
+@@ -45,6 +45,11 @@
  #include <openssl/provider.h>
  #endif
  
 +#ifndef RSA_F_RSA_OSSL_PRIVATE_DECRYPT
 +#define RSA_F_RSA_OSSL_PRIVATE_DECRYPT RSA_F_RSA_EAY_PRIVATE_DECRYPT
++#define SSL_CIPHER_standard_name SSL_CIPHER_get_name
 +#endif
 +
-+#ifndef LIBRESSL_VERSION_NUMBER
  #include <openssl/kdf.h>
-+#endif
  
  using namespace QCA;
- 
-@@ -1262,6 +1268,7 @@ class opensslPbkdf2Context : public KDFContext (protec
- protected:
- };
- 
-+#ifndef LIBRESSL_VERSION_NUMBER
- class opensslHkdfContext : public HKDFContext
- {
-     Q_OBJECT
-@@ -1294,6 +1301,7 @@ class opensslHkdfContext : public HKDFContext (public)
-         return out;
+@@ -6460,7 +6465,7 @@ static QStringList all_hash_types()
+         list += QStringLiteral("md2");
+ #endif
+         list += QStringLiteral("md4");
+-#ifdef OBJ_whirlpool
++#ifndef OPENSSL_NO_WHIRLPOOL
+         list += QStringLiteral("whirlpool");
+ #endif
      }
- };
-+#endif // LIBRESSL_VERSION_NUMBER
- 
- class opensslHMACContext : public MACContext
- {
-@@ -5004,7 +5012,11 @@ class MyTLSContext : public TLSContext (public)
-         case TLS::TLS_v1:
-             ctx = SSL_CTX_new(TLS_client_method());
-             SSL_CTX_set_min_proto_version(ctx, TLS1_VERSION);
-+#ifdef TLS1_3_VERSION           
-             SSL_CTX_set_max_proto_version(ctx, TLS1_3_VERSION);
-+#else
-+            SSL_CTX_set_max_proto_version(ctx, TLS1_2_VERSION);
-+#endif
-             break;
-         case TLS::DTLS_v1:
-         default:
-@@ -5025,7 +5037,11 @@ class MyTLSContext : public TLSContext (public)
-         QStringList cipherList;
-         for (int i = 0; i < sk_SSL_CIPHER_num(sk); ++i) {
-             const SSL_CIPHER *thisCipher = sk_SSL_CIPHER_value(sk, i);
-+#ifndef LIBRESSL_VERSION_NUMBER
-             cipherList += QString::fromLatin1(SSL_CIPHER_standard_name(thisCipher));
-+#else
-+            cipherList += QString::fromLatin1(SSL_CIPHER_get_name(thisCipher));
-+#endif
-         }
-         sk_SSL_CIPHER_free(sk);
- 
-@@ -5398,7 +5414,11 @@ class MyTLSContext : public TLSContext (public)
-             sessInfo.version = TLS::TLS_v1;
-         }
- 
-+#ifndef LIBRESSL_VERSION_NUMBER
-         sessInfo.cipherSuite = QString::fromLatin1(SSL_CIPHER_standard_name(SSL_get_current_cipher(ssl)));
-+#else
-+        sessInfo.cipherSuite = QString::fromLatin1(SSL_CIPHER_get_name(SSL_get_current_cipher(ssl)));
-+#endif
- 
-         sessInfo.cipherMaxBits = SSL_get_cipher_bits(ssl, &(sessInfo.cipherBits));
- 
-@@ -6705,7 +6725,9 @@ class opensslProvider : public Provider (public)
-         }
-         list += QStringLiteral("pkcs12");
-         list += QStringLiteral("pbkdf2(sha1)");
-+#ifndef LIBRESSL_VERSION_NUMBER
-         list += QStringLiteral("hkdf(sha256)");
-+#endif
-         list += QStringLiteral("pkey");
-         list += QStringLiteral("dlgroup");
-         list += QStringLiteral("rsa");
-@@ -6755,8 +6777,10 @@ class opensslProvider : public Provider (public)
+@@ -6921,7 +6926,7 @@ class opensslProvider : public Provider (public)
+ #endif
+             else if (type == QLatin1String("md4"))
+                 return new opensslHashContext(EVP_md4(), this, type);
+-#ifdef OBJ_whirlpool
++#ifndef OPENSSL_NO_WHIRLPOOL
+             else if (type == QLatin1String("whirlpool"))
+                 return new opensslHashContext(EVP_whirlpool(), this, type);
  #endif
-         else if (type == QLatin1String("pbkdf2(sha1)"))
-             return new opensslPbkdf2Context(this, type);
-+#ifndef LIBRESSL_VERSION_NUMBER
-         else if (type == QLatin1String("hkdf(sha256)"))
-             return new opensslHkdfContext(this, type);
-+#endif
-         else if (type == QLatin1String("hmac(md5)"))
-             return new opensslHMACContext(EVP_md5(), this, type);
-         else if (type == QLatin1String("hmac(sha1)"))