View | Details | Raw Unified | Return to bug 245600 | Differences between
and this patch

Collapse All | Expand All

(-)net/qt5-network/files/patch-qsslsocket_openssl11_symbols_p.h (+71 lines)
Line 0 Link Here
1
--- src/network/ssl/qsslsocket_openssl11_symbols_p.h.orig	2019-10-01 07:47:24 UTC
2
+++ src/network/ssl/qsslsocket_openssl11_symbols_p.h
3
@@ -77,20 +77,49 @@
4
 
5
 const unsigned char * q_ASN1_STRING_get0_data(const ASN1_STRING *x);
6
 
7
+#if defined(LIBRESSL_VERSION_NUMBER) && LIBRESSL_VERSION_NUMBER >= 0x20700000L
8
+// LibreSSL 2.7 has stack_st but not OPENSSL_STACK
9
+typedef struct stack_st OPENSSL_STACK; /* Use STACK_OF(...) instead */
10
+// From the signature in LibreSSL
11
+#define OPENSSL_INIT_SETTINGS void
12
+// https://github.com/openssl/openssl/blob/master/include/openssl/x509_vfy.h#L63
13
+typedef int (*X509_STORE_CTX_verify_cb)(int, X509_STORE_CTX *);
14
+#endif
15
+
16
+
17
 Q_AUTOTEST_EXPORT BIO *q_BIO_new(const BIO_METHOD *a);
18
 Q_AUTOTEST_EXPORT const BIO_METHOD *q_BIO_s_mem();
19
 
20
+#ifdef LIBRESSL_VERSION_NUMBER
21
+#define q_DSA_bits(dsa) q_BN_num_bits((dsa)->p)
22
+#else
23
 int q_DSA_bits(DSA *a);
24
+#endif
25
 int q_EVP_CIPHER_CTX_reset(EVP_CIPHER_CTX *c);
26
 Q_AUTOTEST_EXPORT int q_EVP_PKEY_up_ref(EVP_PKEY *a);
27
 int q_EVP_PKEY_base_id(EVP_PKEY *a);
28
 int q_RSA_bits(RSA *a);
29
+#ifdef LIBRESSL_VERSION_NUMBER
30
+int q_sk_num(OPENSSL_STACK *a);
31
+void q_sk_pop_free(OPENSSL_STACK *a, void (*b)(void *));
32
+OPENSSL_STACK *q_sk_new_null();
33
+void q_sk_push(OPENSSL_STACK *st, void *data);
34
+void q_sk_free(OPENSSL_STACK *a);
35
+void * q_sk_value(OPENSSL_STACK *a, int b);
36
+#define q_OPENSSL_sk_num(a) q_sk_num(a)
37
+#define q_OPENSSL_sk_pop_free(a, b) q_sk_pop_free(a, b)
38
+#define q_OPENSSL_sk_new_null() q_sk_new_null()
39
+#define q_OPENSSL_sk_push(a, b) q_sk_push(a, b)
40
+#define q_OPENSSL_sk_free q_sk_free
41
+#define q_OPENSSL_sk_value(a, b) q_sk_value(a, b)
42
+#else
43
 Q_AUTOTEST_EXPORT int q_OPENSSL_sk_num(OPENSSL_STACK *a);
44
 Q_AUTOTEST_EXPORT void q_OPENSSL_sk_pop_free(OPENSSL_STACK *a, void (*b)(void *));
45
 Q_AUTOTEST_EXPORT OPENSSL_STACK *q_OPENSSL_sk_new_null();
46
 Q_AUTOTEST_EXPORT void q_OPENSSL_sk_push(OPENSSL_STACK *st, void *data);
47
 Q_AUTOTEST_EXPORT void q_OPENSSL_sk_free(OPENSSL_STACK *a);
48
 Q_AUTOTEST_EXPORT void * q_OPENSSL_sk_value(OPENSSL_STACK *a, int b);
49
+#endif
50
 int q_SSL_session_reused(SSL *a);
51
 unsigned long q_SSL_CTX_set_options(SSL_CTX *ctx, unsigned long op);
52
 int q_OPENSSL_init_ssl(uint64_t opts, const OPENSSL_INIT_SETTINGS *settings);
53
@@ -113,12 +142,15 @@
54
 void q_DH_get0_pqg(const DH *dh, const BIGNUM **p, const BIGNUM **q, const BIGNUM **g);
55
 int q_DH_bits(DH *dh);
56
 
57
-# define q_SSL_load_error_strings() q_OPENSSL_init_ssl(OPENSSL_INIT_LOAD_SSL_STRINGS \
58
+#define q_SSL_load_error_strings() q_OPENSSL_init_ssl(OPENSSL_INIT_LOAD_SSL_STRINGS \
59
                                                        | OPENSSL_INIT_LOAD_CRYPTO_STRINGS, NULL)
60
-
61
+#ifdef LIBRESSL_VERSION_NUMBER
62
+#define q_SKM_sk_num(type, st) ((int (*)(const STACK_OF(type) *))q_sk_num)(st)
63
+#define q_SKM_sk_value(type, st,i) ((type * (*)(const STACK_OF(type) *, int))q_sk_value)(st, i)
64
+#else
65
 #define q_SKM_sk_num(type, st) ((int (*)(const STACK_OF(type) *))q_OPENSSL_sk_num)(st)
66
 #define q_SKM_sk_value(type, st,i) ((type * (*)(const STACK_OF(type) *, int))q_OPENSSL_sk_value)(st, i)
67
-
68
+#endif
69
 #define q_OPENSSL_add_all_algorithms_conf()  q_OPENSSL_init_crypto(OPENSSL_INIT_ADD_ALL_CIPHERS \
70
                                                                    | OPENSSL_INIT_ADD_ALL_DIGESTS \
71
                                                                    | OPENSSL_INIT_LOAD_CONFIG, NULL)
(-)net/qt5-network/files/patch-src_network_kernel_qnetworkinterface__unix.cpp_ (+11 lines)
Line 0 Link Here
1
--- src/network/ssl/qsslcontext_openssl.cpp.orig	2019-10-01 08:05:51 UTC
2
+++ src/network/ssl/qsslcontext_openssl.cpp
3
@@ -265,7 +265,7 @@ void QSslContext::applyBackendConfig(QSslContext *sslC
4
     }
5
 #endif // ocsp
6
 
7
-#if OPENSSL_VERSION_NUMBER >= 0x10002000L
8
+#if OPENSSL_VERSION_NUMBER >= 0x10002000L && !defined(LIBRESSL_VERSION_NUMBER)
9
     if (QSslSocket::sslLibraryVersionNumber() >= 0x10002000L) {
10
         QSharedPointer<SSL_CONF_CTX> cctx(q_SSL_CONF_CTX_new(), &q_SSL_CONF_CTX_free);
11
         if (cctx) {
(-)net/qt5-network/files/patch-src_network_ssl_qsslsocket_openssl.cpp (+11 lines)
Line 0 Link Here
1
--- src/network/ssl/qsslsocket_openssl.cpp.orig	2019-10-01 08:09:52 UTC
2
+++ src/network/ssl/qsslsocket_openssl.cpp
3
@@ -604,7 +604,7 @@ bool QSslSocketBackendPrivate::initSslContext()
4
             q_SSL_set_psk_server_callback(ssl, &q_ssl_psk_server_callback);
5
     }
6
 #endif
7
-#if OPENSSL_VERSION_NUMBER >= 0x10101006L
8
+#if OPENSSL_VERSION_NUMBER >= 0x10101006L && !defined(LIBRESSL_VERSION_NUMBER)
9
     // Set the client callback for TLSv1.3 PSK
10
     if (mode == QSslSocket::SslClientMode
11
         && QSslSocket::sslLibraryBuildVersionNumber() >= 0x10101006L) {
(-)net/qt5-network/files/patch-src_network_ssl_qsslsocket_openssl_symbols.cpp (+86 lines)
Line 0 Link Here
1
--- src/network/ssl/qsslsocket_openssl_symbols.cpp.orig	2019-10-25 09:16:48.000000000 +0200
2
+++ src/network/ssl/qsslsocket_openssl_symbols.cpp	2019-11-01 20:03:08.715014000 +0100
3
@@ -152,6 +152,14 @@
4
 DEFINEFUNC(int, EVP_CIPHER_CTX_reset, EVP_CIPHER_CTX *c, c, return 0, return)
5
 DEFINEFUNC(int, EVP_PKEY_base_id, EVP_PKEY *a, a, return NID_undef, return)
6
 DEFINEFUNC(int, RSA_bits, RSA *a, a, return 0, return)
7
+#ifdef LIBRESSL_VERSION_NUMBER
8
+DEFINEFUNC(int, sk_num, OPENSSL_STACK *a, a, return -1, return)
9
+DEFINEFUNC2(void, sk_pop_free, OPENSSL_STACK *a, a, void (*b)(void*), b, return, DUMMYARG)
10
+DEFINEFUNC(OPENSSL_STACK *, sk_new_null, DUMMYARG, DUMMYARG, return nullptr, return)
11
+DEFINEFUNC2(void, sk_push, OPENSSL_STACK *a, a, void *b, b, return, DUMMYARG)
12
+DEFINEFUNC(void, sk_free, OPENSSL_STACK *a, a, return, DUMMYARG)
13
+DEFINEFUNC2(void *, sk_value, OPENSSL_STACK *a, a, int b, b, return nullptr, return)
14
+#else
15
 DEFINEFUNC(int, DSA_bits, DSA *a, a, return 0, return)
16
 DEFINEFUNC(int, OPENSSL_sk_num, OPENSSL_STACK *a, a, return -1, return)
17
 DEFINEFUNC2(void, OPENSSL_sk_pop_free, OPENSSL_STACK *a, a, void (*b)(void*), b, return, DUMMYARG)
18
@@ -159,6 +167,7 @@
19
 DEFINEFUNC2(void, OPENSSL_sk_push, OPENSSL_STACK *a, a, void *b, b, return, DUMMYARG)
20
 DEFINEFUNC(void, OPENSSL_sk_free, OPENSSL_STACK *a, a, return, DUMMYARG)
21
 DEFINEFUNC2(void *, OPENSSL_sk_value, OPENSSL_STACK *a, a, int b, b, return nullptr, return)
22
+#endif
23
 DEFINEFUNC(int, SSL_session_reused, SSL *a, a, return 0, return)
24
 DEFINEFUNC2(unsigned long, SSL_CTX_set_options, SSL_CTX *ctx, ctx, unsigned long op, op, return 0, return)
25
 #ifdef TLS1_3_VERSION
26
@@ -443,7 +452,7 @@
27
 DEFINEFUNC2(int, SSL_CTX_use_RSAPrivateKey, SSL_CTX *a, a, RSA *b, b, return -1, return)
28
 DEFINEFUNC3(int, SSL_CTX_use_PrivateKey_file, SSL_CTX *a, a, const char *b, b, int c, c, return -1, return)
29
 DEFINEFUNC(X509_STORE *, SSL_CTX_get_cert_store, const SSL_CTX *a, a, return nullptr, return)
30
-#if OPENSSL_VERSION_NUMBER >= 0x10002000L
31
+#if OPENSSL_VERSION_NUMBER >= 0x10002000L && !defined(LIBRESSL_VERSION_NUMBER)
32
 DEFINEFUNC(SSL_CONF_CTX *, SSL_CONF_CTX_new, DUMMYARG, DUMMYARG, return nullptr, return);
33
 DEFINEFUNC(void, SSL_CONF_CTX_free, SSL_CONF_CTX *a, a, return ,return);
34
 DEFINEFUNC2(void, SSL_CONF_CTX_set_ssl_ctx, SSL_CONF_CTX *a, a, SSL_CTX *b, b, return, return);
35
@@ -839,8 +848,8 @@
36
 #endif
37
 #if defined(SHLIB_VERSION_NUMBER) && !defined(Q_OS_QNX) // on QNX, the libs are always libssl.so and libcrypto.so
38
     // first attempt: the canonical name is libssl.so.<SHLIB_VERSION_NUMBER>
39
-    libssl->setFileNameAndVersion(QLatin1String("ssl"), QLatin1String(SHLIB_VERSION_NUMBER));
40
-    libcrypto->setFileNameAndVersion(QLatin1String("crypto"), QLatin1String(SHLIB_VERSION_NUMBER));
41
+    libssl->setFileNameAndVersion(QLatin1String("%%OPENSSLLIB%%/libssl"), QLatin1String(SHLIB_VERSION_NUMBER));
42
+    libcrypto->setFileNameAndVersion(QLatin1String("%%OPENSSLLIB%%/libcrypto"), QLatin1String(SHLIB_VERSION_NUMBER));
43
     if (libcrypto->load() && libssl->load()) {
44
         // libssl.so.<SHLIB_VERSION_NUMBER> and libcrypto.so.<SHLIB_VERSION_NUMBER> found
45
         return pair;
46
@@ -980,12 +989,21 @@
47
     RESOLVEFUNC(EVP_CIPHER_CTX_reset)
48
     RESOLVEFUNC(EVP_PKEY_base_id)
49
     RESOLVEFUNC(RSA_bits)
50
+#ifdef LIBRESSL_VERSION_NUMBER
51
+    RESOLVEFUNC(sk_new_null)
52
+    RESOLVEFUNC(sk_push)
53
+    RESOLVEFUNC(sk_free)
54
+    RESOLVEFUNC(sk_num)
55
+    RESOLVEFUNC(sk_pop_free)
56
+    RESOLVEFUNC(sk_value)
57
+#else
58
     RESOLVEFUNC(OPENSSL_sk_new_null)
59
     RESOLVEFUNC(OPENSSL_sk_push)
60
     RESOLVEFUNC(OPENSSL_sk_free)
61
     RESOLVEFUNC(OPENSSL_sk_num)
62
     RESOLVEFUNC(OPENSSL_sk_pop_free)
63
     RESOLVEFUNC(OPENSSL_sk_value)
64
+#endif
65
     RESOLVEFUNC(DH_get0_pqg)
66
     RESOLVEFUNC(SSL_CTX_set_options)
67
 #ifdef TLS1_3_VERSION
68
@@ -1024,7 +1042,9 @@
69
 
70
     RESOLVEFUNC(SSL_SESSION_get_ticket_lifetime_hint)
71
     RESOLVEFUNC(DH_bits)
72
+#ifndef LIBRESSL_VERSION_NUMBER
73
     RESOLVEFUNC(DSA_bits)
74
+#endif
75
 
76
 #if QT_CONFIG(dtls)
77
     RESOLVEFUNC(DTLSv1_listen)
78
@@ -1280,7 +1300,7 @@
79
     RESOLVEFUNC(SSL_CTX_use_RSAPrivateKey)
80
     RESOLVEFUNC(SSL_CTX_use_PrivateKey_file)
81
     RESOLVEFUNC(SSL_CTX_get_cert_store);
82
-#if OPENSSL_VERSION_NUMBER >= 0x10002000L
83
+#if OPENSSL_VERSION_NUMBER >= 0x10002000L && !defined(LIBRESSL_VERSION_NUMBER)
84
     RESOLVEFUNC(SSL_CONF_CTX_new);
85
     RESOLVEFUNC(SSL_CONF_CTX_free);
86
     RESOLVEFUNC(SSL_CONF_CTX_set_ssl_ctx);
(-)net/qt5-network/files/patch-src_network_ssl_qsslsocket_openssl_symbols_p.h (+26 lines)
Line 0 Link Here
1
--- src/network/ssl/qsslsocket_openssl_symbols_p.h.orig	2019-10-01 07:47:06 UTC
2
+++ src/network/ssl/qsslsocket_openssl_symbols_p.h
3
@@ -72,6 +72,14 @@
4
 #include "qsslsocket_openssl_p.h"
5
 #include <QtCore/qglobal.h>
6
 
7
+#if defined(LIBRESSL_VERSION_NUMBER) && LIBRESSL_VERSION_NUMBER >= 0x20700000L
8
+# define TLS1_2_VERSION 0x0303
9
+# define TLS_MAX_VERSION TLS1_2_VERSION
10
+# define TLS_ANY_VERSION 0x10000
11
+# define DTLS1_2_VERSION                 0xFEFD
12
+# define DTLS_MAX_VERSION                DTLS1_2_VERSION
13
+#endif
14
+
15
 #if QT_CONFIG(ocsp)
16
 #include "qocsp_p.h"
17
 #endif
18
@@ -372,7 +378,7 @@ int q_SSL_CTX_use_PrivateKey(SSL_CTX *a, EVP_PKEY *b);
19
 int q_SSL_CTX_use_RSAPrivateKey(SSL_CTX *a, RSA *b);
20
 int q_SSL_CTX_use_PrivateKey_file(SSL_CTX *a, const char *b, int c);
21
 X509_STORE *q_SSL_CTX_get_cert_store(const SSL_CTX *a);
22
-#if OPENSSL_VERSION_NUMBER >= 0x10002000L
23
+#if OPENSSL_VERSION_NUMBER >= 0x10002000L  && !defined(LIBRESSL_VERSION_NUMBER)
24
 SSL_CONF_CTX *q_SSL_CONF_CTX_new();
25
 void q_SSL_CONF_CTX_free(SSL_CONF_CTX *a);
26
 void q_SSL_CONF_CTX_set_ssl_ctx(SSL_CONF_CTX *a, SSL_CTX *b);

Return to bug 245600