aboutsummaryrefslogtreecommitdiff
blob: 8bee8ad45738d14066dac5fedbae33413d617070 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
From aa07e1eacdbfeefa5ff21c5d7e45ce9e02e91dbb Mon Sep 17 00:00:00 2001
From: Stefan Strogin <steils@gentoo.org>
Date: Fri, 3 Jun 2022 21:11:45 -0700
Subject: [PATCH] LibreSSL 3.0.x support

---
 plugins/qca-ossl/qca-ossl.cpp | 25 ++++++++++++++++++++++++-
 1 file changed, 24 insertions(+), 1 deletion(-)

diff --git a/plugins/qca-ossl/qca-ossl.cpp b/plugins/qca-ossl/qca-ossl.cpp
index b2c5d3d..79775cd 100644
--- a/plugins/qca-ossl/qca-ossl.cpp
+++ b/plugins/qca-ossl/qca-ossl.cpp
@@ -44,7 +44,13 @@
 #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
+#endif
+
+#ifndef LIBRESSL_VERSION_NUMBER
 #include <openssl/kdf.h>
+#endif
 
 using namespace QCA;
 
@@ -1254,6 +1260,7 @@ public:
 protected:
 };
 
+#ifndef LIBRESSL_VERSION_NUMBER
 class opensslHkdfContext : public HKDFContext
 {
     Q_OBJECT
@@ -1286,6 +1293,7 @@ public:
         return out;
     }
 };
+#endif // LIBRESSL_VERSION_NUMBER
 
 class opensslHMACContext : public MACContext
 {
@@ -4993,7 +5001,11 @@ 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:
@@ -5014,7 +5026,11 @@ 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);
 
@@ -5386,8 +5402,11 @@ public:
             qDebug("unexpected version response");
             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));
 
@@ -6687,7 +6706,9 @@ public:
 #endif
         list += QStringLiteral("pbkdf1(sha1)");
         list += QStringLiteral("pbkdf2(sha1)");
+#ifndef LIBRESSL_VERSION_NUMBER
         list += QStringLiteral("hkdf(sha256)");
+#endif // LIBRESSL_VERSION_NUMBER
         list += QStringLiteral("pkey");
         list += QStringLiteral("dlgroup");
         list += QStringLiteral("rsa");
@@ -6756,8 +6777,10 @@ public:
 #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 // LIBRESSL_VERSION_NUMBER
         else if (type == QLatin1String("hmac(md5)"))
             return new opensslHMACContext(EVP_md5(), this, type);
         else if (type == QLatin1String("hmac(sha1)"))
-- 
2.35.1