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

Collapse All | Expand All

(-)net/qt4-network/Makefile (-4 / +1 lines)
Lines 3-9 Link Here
3
3
4
PORTNAME=	network
4
PORTNAME=	network
5
DISTVERSION=	${QT4_VERSION}
5
DISTVERSION=	${QT4_VERSION}
6
PORTREVISION=	9
6
PORTREVISION=	10
7
CATEGORIES=	net ipv6
7
CATEGORIES=	net ipv6
8
PKGNAMEPREFIX=	qt4-
8
PKGNAMEPREFIX=	qt4-
9
9
Lines 13-21 COMMENT= Qt network module Link Here
13
LICENSE=	GPLv3 LGPL21 LGPL3 GFDL
13
LICENSE=	GPLv3 LGPL21 LGPL3 GFDL
14
LICENSE_COMB=	dual
14
LICENSE_COMB=	dual
15
15
16
BROKEN_SSL=	openssl111
17
BROKEN_SSL_REASON_openssl111=	error: member access into incomplete type 'RSA' (aka 'rsa_st')
18
19
RUN_DEPENDS=	${LOCALBASE}/share/certs/ca-root-nss.crt:security/ca_root_nss
16
RUN_DEPENDS=	${LOCALBASE}/share/certs/ca-root-nss.crt:security/ca_root_nss
20
17
21
USES=		qmake:no_env qt-dist:4 ssl
18
USES=		qmake:no_env qt-dist:4 ssl
(-)net/qt4-network/files/patch-src_network_ssl_qsslcertificate.cpp (+66 lines)
Line 0 Link Here
1
--- src/network/ssl/qsslcertificate.cpp.orig	2015-05-07 14:14:44 UTC
2
+++ src/network/ssl/qsslcertificate.cpp
3
@@ -259,10 +259,14 @@ void QSslCertificate::clear()
4
 QByteArray QSslCertificate::version() const
5
 {
6
     QMutexLocker lock(QMutexPool::globalInstanceGet(d.data()));
7
-    if (d->versionString.isEmpty() && d->x509)
8
+    if (d->versionString.isEmpty() && d->x509) {
9
         d->versionString =
10
+#if OPENSSL_VERSION_NUMBER < 0x10100000L
11
             QByteArray::number(qlonglong(q_ASN1_INTEGER_get(d->x509->cert_info->version)) + 1);
12
-
13
+#else
14
+            QByteArray::number(qlonglong(q_X509_get_version(d->x509)) + 1);
15
+#endif
16
+    }
17
     return d->versionString;
18
 }
19
 
20
@@ -276,7 +280,7 @@ QByteArray QSslCertificate::serialNumber() const
21
 {
22
     QMutexLocker lock(QMutexPool::globalInstanceGet(d.data()));
23
     if (d->serialNumberString.isEmpty() && d->x509) {
24
-        ASN1_INTEGER *serialNumber = d->x509->cert_info->serialNumber;
25
+        ASN1_INTEGER *serialNumber = q_X509_get_serialNumber(d->x509);
26
         // if we cannot convert to a long, just output the hexadecimal number
27
         if (serialNumber->length > 4) {
28
             QByteArray hexString;
29
@@ -489,24 +493,33 @@ QSslKey QSslCertificate::publicKey() const
30
     QSslKey key;
31
 
32
     key.d->type = QSsl::PublicKey;
33
+#if OPENSSL_VERSION_NUMBER < 0x10100000L
34
     X509_PUBKEY *xkey = d->x509->cert_info->key;
35
+#else
36
+    X509_PUBKEY *xkey = q_X509_get_X509_PUBKEY(d->x509);
37
+#endif
38
     EVP_PKEY *pkey = q_X509_PUBKEY_get(xkey);
39
     Q_ASSERT(pkey);
40
 
41
-    if (q_EVP_PKEY_type(pkey->type) == EVP_PKEY_RSA) {
42
+    int key_id;
43
+#if OPENSSL_VERSION_NUMBER < 0x10100000L
44
+    key_id = q_EVP_PKEY_type(pkey->type);
45
+#else
46
+    key_id = q_EVP_PKEY_base_id(pkey);
47
+#endif
48
+    if (key_id == EVP_PKEY_RSA) {
49
         key.d->rsa = q_EVP_PKEY_get1_RSA(pkey);
50
         key.d->algorithm = QSsl::Rsa;
51
         key.d->isNull = false;
52
-    } else if (q_EVP_PKEY_type(pkey->type) == EVP_PKEY_DSA) {
53
+    } else if (key_id == EVP_PKEY_DSA) {
54
         key.d->dsa = q_EVP_PKEY_get1_DSA(pkey);
55
         key.d->algorithm = QSsl::Dsa;
56
         key.d->isNull = false;
57
-    } else if (q_EVP_PKEY_type(pkey->type) == EVP_PKEY_DH) {
58
+    } else if (key_id == EVP_PKEY_DH) {
59
         // DH unsupported
60
     } else {
61
         // error?
62
     }
63
-
64
     q_EVP_PKEY_free(pkey);
65
     return key;
66
 }
(-)net/qt4-network/files/patch-src_network_ssl_qsslkey.cpp (+22 lines)
Line 0 Link Here
1
--- src/network/ssl/qsslkey.cpp.orig	2015-05-07 14:14:44 UTC
2
+++ src/network/ssl/qsslkey.cpp
3
@@ -321,8 +321,19 @@ int QSslKey::length() const
4
 {
5
     if (d->isNull)
6
         return -1;
7
+#if OPENSSL_VERSION_NUMBER < 0x10100000L
8
     return (d->algorithm == QSsl::Rsa)
9
            ? q_BN_num_bits(d->rsa->n) : q_BN_num_bits(d->dsa->p);
10
+#else
11
+    if (d->algorithm == QSsl::Rsa) {
12
+        return q_RSA_bits(d->rsa);
13
+    }else{
14
+        BIGNUM *p = NULL;
15
+        q_DSA_get0_pqg(d->dsa, &p, NULL, NULL);
16
+	return q_BN_num_bits(p);
17
+    }
18
+#endif
19
+
20
 }
21
 
22
 /*!
(-)net/qt4-network/files/patch-src_network_ssl_qsslsocket__openssl.cpp (-4 / +102 lines)
Lines 1-8 Link Here
1
* Make availability of SSLv3 in Qt4 same as in Qt5, i.e. not part of SecureProtocols
2
*
3
--- src/network/ssl/qsslsocket_openssl.cpp.orig	2015-05-07 14:14:44 UTC
1
--- src/network/ssl/qsslsocket_openssl.cpp.orig	2015-05-07 14:14:44 UTC
4
+++ src/network/ssl/qsslsocket_openssl.cpp
2
+++ src/network/ssl/qsslsocket_openssl.cpp
5
@@ -267,9 +267,13 @@ init_context:
3
@@ -93,6 +93,7 @@ bool QSslSocketPrivate::s_libraryLoaded = false;
4
 bool QSslSocketPrivate::s_loadedCiphersAndCerts = false;
5
 bool QSslSocketPrivate::s_loadRootCertsOnDemand = false;
6
 
7
+#if OPENSSL_VERSION_NUMBER < 0x10100000L
8
 /* \internal
9
 
10
     From OpenSSL's thread(3) manual page:
11
@@ -174,6 +175,8 @@ static unsigned long id_function()
12
 }
13
 } // extern "C"
14
 
15
+#endif //OPENSSL_VERSION_NUMBER >= 0x10100000L
16
+
17
 QSslSocketBackendPrivate::QSslSocketBackendPrivate()
18
     : ssl(0),
19
       ctx(0),
20
@@ -222,9 +225,12 @@ QSslCipher QSslSocketBackendPrivate::QSslCipher_from_S
21
             ciph.d->encryptionMethod = descriptionList.at(4).mid(4);
22
         ciph.d->exportable = (descriptionList.size() > 6 && descriptionList.at(6) == QLatin1String("export"));
23
 
24
+#if OPENSSL_VERSION_NUMBER < 0x10100000L
25
         ciph.d->bits = cipher->strength_bits;
26
         ciph.d->supportedBits = cipher->alg_bits;
27
-
28
+#else
29
+	ciph.d->bits = q_SSL_CIPHER_get_bits(cipher, &ciph.d->supportedBits);
30
+#endif
31
     }
32
     return ciph;
33
 }
34
@@ -267,9 +273,13 @@ init_context:
6
 #endif
35
 #endif
7
         break;
36
         break;
8
     case QSsl::SslV3:
37
     case QSsl::SslV3:
Lines 17-23 Link Here
17
     case QSsl::TlsV1SslV3: // SslV2 will be disabled below
46
     case QSsl::TlsV1SslV3: // SslV2 will be disabled below
18
     case QSsl::AnyProtocol:
47
     case QSsl::AnyProtocol:
19
     default:
48
     default:
20
@@ -297,8 +301,10 @@ init_context:
49
@@ -297,8 +307,10 @@ init_context:
21
 
50
 
22
     // Enable bug workarounds.
51
     // Enable bug workarounds.
23
     long options;
52
     long options;
Lines 29-31 Link Here
29
     else
58
     else
30
         options = SSL_OP_ALL;
59
         options = SSL_OP_ALL;
31
 
60
 
61
@@ -363,7 +375,7 @@ init_context:
62
         //
63
         // See also: QSslContext::fromConfiguration()
64
         if (caCertificate.expiryDate() >= QDateTime::currentDateTime()) {
65
-            q_X509_STORE_add_cert(ctx->cert_store, (X509 *)caCertificate.handle());
66
+	  q_X509_STORE_add_cert(q_SSL_CTX_get_cert_store(ctx), (X509 *)caCertificate.handle());
67
         }
68
     }
69
 
70
@@ -500,8 +512,10 @@ void QSslSocketBackendPrivate::destroySslContext()
71
 */
72
 void QSslSocketPrivate::deinitialize()
73
 {
74
+#if OPENSSL_VERSION_NUMBER < 0x10100000L
75
     q_CRYPTO_set_id_callback(0);
76
     q_CRYPTO_set_locking_callback(0);
77
+#endif
78
 }
79
 
80
 /*!
81
@@ -522,13 +536,17 @@ bool QSslSocketPrivate::ensureLibraryLoaded()
82
         return false;
83
 
84
     // Check if the library itself needs to be initialized.
85
+#if OPENSSL_VERSION_NUMBER < 0x10100000L
86
     QMutexLocker locker(openssl_locks()->initLock());
87
+#endif
88
     if (!s_libraryLoaded) {
89
         s_libraryLoaded = true;
90
 
91
         // Initialize OpenSSL.
92
+#if OPENSSL_VERSION_NUMBER < 0x10100000L
93
         q_CRYPTO_set_id_callback(id_function);
94
         q_CRYPTO_set_locking_callback(locking_function);
95
+#endif
96
         if (q_SSL_library_init() != 1)
97
             return false;
98
         q_SSL_load_error_strings();
99
@@ -567,7 +585,9 @@ bool QSslSocketPrivate::ensureLibraryLoaded()
100
 
101
 void QSslSocketPrivate::ensureCiphersAndCertsLoaded()
102
 {
103
-    QMutexLocker locker(openssl_locks()->initLock());
104
+#if OPENSSL_VERSION_NUMBER < 0x10100000L
105
+  QMutexLocker locker(openssl_locks()->initLock());
106
+#endif
107
     if (s_loadedCiphersAndCerts)
108
         return;
109
     s_loadedCiphersAndCerts = true;
110
@@ -659,13 +679,18 @@ void QSslSocketPrivate::resetDefaultCiphers()
111
     STACK_OF(SSL_CIPHER) *supportedCiphers = q_SSL_get_ciphers(mySsl);
112
     for (int i = 0; i < q_sk_SSL_CIPHER_num(supportedCiphers); ++i) {
113
         if (SSL_CIPHER *cipher = q_sk_SSL_CIPHER_value(supportedCiphers, i)) {
114
-            if (cipher->valid) {
115
+
116
+#if OPENSSL_VERSION_NUMBER < 0x10100000L
117
+	  if (cipher->valid) {
118
+#endif
119
                 QSslCipher ciph = QSslSocketBackendPrivate::QSslCipher_from_SSL_CIPHER(cipher);
120
                 if (!ciph.isNull()) {
121
                     if (!ciph.name().toLower().startsWith(QLatin1String("adh")))
122
                         ciphers << ciph;
123
                 }
124
+#if OPENSSL_VERSION_NUMBER < 0x10100000L
125
             }
126
+#endif
127
         }
128
     }
129
 
(-)net/qt4-network/files/patch-src_network_ssl_qsslsocket__openssl__p.h (+13 lines)
Line 0 Link Here
1
--- src/network/ssl/qsslsocket_openssl_p.h.orig	2015-05-07 14:14:44 UTC
2
+++ src/network/ssl/qsslsocket_openssl_p.h
3
@@ -84,6 +84,10 @@
4
 #include <openssl/tls1.h>
5
 #endif
6
 
7
+#if OPENSSL_VERSION_NUMBER >= 0x10100000L
8
+#define OPENSSL_NO_SSL2
9
+#endif
10
+
11
 #if OPENSSL_VERSION_NUMBER >= 0x10000000L
12
 typedef _STACK STACK;
13
 #endif
(-)net/qt4-network/files/patch-src_network_ssl_qsslsocket__openssl__symbols.cpp (-5 / +279 lines)
Lines 1-9 Link Here
1
* Prepend the path of the SSL libraries used for building so the same libraries are
2
* found and loaded at runtime. Normal search finds base SSL libraries before ports.
3
*
4
--- src/network/ssl/qsslsocket_openssl_symbols.cpp.orig	2015-05-07 14:14:44 UTC
1
--- src/network/ssl/qsslsocket_openssl_symbols.cpp.orig	2015-05-07 14:14:44 UTC
5
+++ src/network/ssl/qsslsocket_openssl_symbols.cpp
2
+++ src/network/ssl/qsslsocket_openssl_symbols.cpp
6
@@ -511,9 +511,9 @@ static QPair<QLibrary*, QLibrary*> loadO
3
@@ -117,9 +117,11 @@ DEFINEFUNC3(int, BIO_read, BIO *a, a, void *b, b, int 
4
 DEFINEFUNC(BIO_METHOD *, BIO_s_mem, void, DUMMYARG, return 0, return)
5
 DEFINEFUNC3(int, BIO_write, BIO *a, a, const void *b, b, int c, c, return -1, return)
6
 DEFINEFUNC(int, BN_num_bits, const BIGNUM *a, a, return 0, return)
7
+#if OPENSSL_VERSION_NUMBER < 0x10100000L
8
 DEFINEFUNC(int, CRYPTO_num_locks, DUMMYARG, DUMMYARG, return 0, return)
9
 DEFINEFUNC(void, CRYPTO_set_locking_callback, void (*a)(int, int, const char *, int), a, return, DUMMYARG)
10
 DEFINEFUNC(void, CRYPTO_set_id_callback, unsigned long (*a)(), a, return, DUMMYARG)
11
+#endif
12
 DEFINEFUNC(void, CRYPTO_free, void *a, a, return, DUMMYARG)
13
 DEFINEFUNC(void, DSA_free, DSA *a, a, return, DUMMYARG)
14
 #if  OPENSSL_VERSION_NUMBER < 0x00908000L
15
@@ -157,6 +159,7 @@ DEFINEFUNC2(int, PEM_write_bio_RSA_PUBKEY, BIO *a, a, 
16
 DEFINEFUNC2(void, RAND_seed, const void *a, a, int b, b, return, DUMMYARG)
17
 DEFINEFUNC(int, RAND_status, void, DUMMYARG, return -1, return)
18
 DEFINEFUNC(void, RSA_free, RSA *a, a, return, DUMMYARG)
19
+#if OPENSSL_VERSION_NUMBER < 0x10100000L
20
 DEFINEFUNC(int, sk_num, STACK *a, a, return -1, return)
21
 DEFINEFUNC2(void, sk_pop_free, STACK *a, a, void (*b)(void*), b, return, DUMMYARG)
22
 #if OPENSSL_VERSION_NUMBER >= 0x10000000L
23
@@ -166,6 +169,12 @@ DEFINEFUNC2(void *, sk_value, STACK *a, a, int b, b, r
24
 DEFINEFUNC(void, sk_free, STACK *a, a, return, DUMMYARG)
25
 DEFINEFUNC2(char *, sk_value, STACK *a, a, int b, b, return 0, return)
26
 #endif
27
+#else
28
+DEFINEFUNC(int, OPENSSL_sk_num, STACK *a, a, return -1, return)
29
+DEFINEFUNC2(void, OPENSSL_sk_pop_free, STACK *a, a, void (*b)(void*), b, return, DUMMYARG)
30
+DEFINEFUNC(void, OPENSSL_sk_free, _STACK *a, a, return, DUMMYARG)
31
+DEFINEFUNC2(void *, OPENSSL_sk_value, STACK *a, a, int b, b, return 0, return)
32
+#endif
33
 DEFINEFUNC(int, SSL_accept, SSL *a, a, return -1, return)
34
 DEFINEFUNC(int, SSL_clear, SSL *a, a, return -1, return)
35
 DEFINEFUNC3(char *, SSL_CIPHER_description, SSL_CIPHER *a, a, char *b, b, int c, c, return 0, return)
36
@@ -213,8 +222,12 @@ DEFINEFUNC(long, SSL_get_verify_result, const SSL *a, 
37
 #else
38
 DEFINEFUNC(long, SSL_get_verify_result, SSL *a, a, return -1, return)
39
 #endif
40
+#if OPENSSL_VERSION_NUMBER < 0x10100000L
41
 DEFINEFUNC(int, SSL_library_init, void, DUMMYARG, return -1, return)
42
 DEFINEFUNC(void, SSL_load_error_strings, void, DUMMYARG, return, DUMMYARG)
43
+#else
44
+DEFINEFUNC2(int, OPENSSL_init_ssl, uint64_t opts, opts, void *settings, settings, return -1, return)
45
+#endif
46
 DEFINEFUNC(SSL *, SSL_new, SSL_CTX *a, a, return 0, return)
47
 #if OPENSSL_VERSION_NUMBER >= 0x0090806fL && !defined(OPENSSL_NO_TLSEXT)
48
 DEFINEFUNC4(long, SSL_ctrl, SSL *a, a, int cmd, cmd, long larg, larg, void *parg, parg, return -1, return)
49
@@ -229,13 +242,21 @@ DEFINEFUNC(int, SSL_shutdown, SSL *a, a, return -1, re
50
 DEFINEFUNC(const SSL_METHOD *, SSLv2_client_method, DUMMYARG, DUMMYARG, return 0, return)
51
 #endif
52
 DEFINEFUNC(const SSL_METHOD *, SSLv3_client_method, DUMMYARG, DUMMYARG, return 0, return)
53
+#if OPENSSL_VERSION_NUMBER < 0x10100000L
54
 DEFINEFUNC(const SSL_METHOD *, SSLv23_client_method, DUMMYARG, DUMMYARG, return 0, return)
55
+#else
56
+DEFINEFUNC(const SSL_METHOD *, TLS_client_method, DUMMYARG, DUMMYARG, return 0, return)
57
+#endif
58
 DEFINEFUNC(const SSL_METHOD *, TLSv1_client_method, DUMMYARG, DUMMYARG, return 0, return)
59
 #ifndef OPENSSL_NO_SSL2
60
 DEFINEFUNC(const SSL_METHOD *, SSLv2_server_method, DUMMYARG, DUMMYARG, return 0, return)
61
 #endif
62
 DEFINEFUNC(const SSL_METHOD *, SSLv3_server_method, DUMMYARG, DUMMYARG, return 0, return)
63
+#if OPENSSL_VERSION_NUMBER < 0x10100000L
64
 DEFINEFUNC(const SSL_METHOD *, SSLv23_server_method, DUMMYARG, DUMMYARG, return 0, return)
65
+#else
66
+DEFINEFUNC(const SSL_METHOD *, TLS_server_method, DUMMYARG, DUMMYARG, return 0, return)
67
+#endif
68
 DEFINEFUNC(const SSL_METHOD *, TLSv1_server_method, DUMMYARG, DUMMYARG, return 0, return)
69
 #else
70
 DEFINEFUNC(SSL_METHOD *, SSLv2_client_method, DUMMYARG, DUMMYARG, return 0, return)
71
@@ -274,7 +295,11 @@ DEFINEFUNC2(int, X509_STORE_CTX_set_purpose, X509_STOR
72
 DEFINEFUNC(int, X509_STORE_CTX_get_error, X509_STORE_CTX *a, a, return -1, return)
73
 DEFINEFUNC(int, X509_STORE_CTX_get_error_depth, X509_STORE_CTX *a, a, return -1, return)
74
 DEFINEFUNC(X509 *, X509_STORE_CTX_get_current_cert, X509_STORE_CTX *a, a, return 0, return)
75
+#if OPENSSL_VERSION_NUMBER < 0x10100000L
76
 DEFINEFUNC(STACK_OF(X509) *, X509_STORE_CTX_get_chain, X509_STORE_CTX *a, a, return 0, return)
77
+#else
78
+DEFINEFUNC(STACK_OF(X509) *, X509_STORE_CTX_get0_chain, X509_STORE_CTX *a, a, return 0, return)
79
+#endif
80
 DEFINEFUNC(X509_STORE_CTX *, X509_STORE_CTX_new, DUMMYARG, DUMMYARG, return 0, return)
81
 #ifdef SSLEAY_MACROS
82
 DEFINEFUNC2(int, i2d_DSAPrivateKey, const DSA *a, a, unsigned char **b, b, return -1, return)
83
@@ -282,11 +307,35 @@ DEFINEFUNC2(int, i2d_RSAPrivateKey, const RSA *a, a, u
84
 DEFINEFUNC3(RSA *, d2i_RSAPrivateKey, RSA **a, a, unsigned char **b, b, long c, c, return 0, return)
85
 DEFINEFUNC3(DSA *, d2i_DSAPrivateKey, DSA **a, a, unsigned char **b, b, long c, c, return 0, return)
86
 #endif
87
+#if OPENSSL_VERSION_NUMBER < 0x10100000L
88
 DEFINEFUNC(void, OPENSSL_add_all_algorithms_noconf, void, DUMMYARG, return, DUMMYARG)
89
 DEFINEFUNC(void, OPENSSL_add_all_algorithms_conf, void, DUMMYARG, return, DUMMYARG)
90
+#else
91
+DEFINEFUNC2(int, OPENSSL_init_crypto, uint64_t opts, opts, void *settings, settings, return -1, return)
92
+#endif
93
 DEFINEFUNC3(int, SSL_CTX_load_verify_locations, SSL_CTX *ctx, ctx, const char *CAfile, CAfile, const char *CApath, CApath, return 0, return)
94
+#if OPENSSL_VERSION_NUMBER < 0x10100000L
95
 DEFINEFUNC(long, SSLeay, void, DUMMYARG, return 0, return)
96
+#else
97
+DEFINEFUNC(unsigned long, OpenSSL_version_num, void, DUMMYARG, return 0, return)
98
+#endif
99
+DEFINEFUNC(X509_STORE *, SSL_CTX_get_cert_store, const SSL_CTX *ctx, ctx, return 0, return)
100
 
101
+DEFINEFUNC(ASN1_INTEGER *, X509_get_serialNumber, X509 *x, x, return 0, return)
102
+#if OPENSSL_VERSION_NUMBER >= 0x10100000L
103
+DEFINEFUNC(int, EVP_PKEY_id, const EVP_PKEY *pkey, pkey, return 0, return)
104
+DEFINEFUNC(int, EVP_PKEY_base_id, const EVP_PKEY *pkey, pkey, return 0, return)
105
+DEFINEFUNC2(int, SSL_CIPHER_get_bits, const SSL_CIPHER *cipher, cipher, int *alg_bits, alg_bits, return 0, return)
106
+DEFINEFUNC2(long, SSL_CTX_set_options, SSL_CTX *ctx, ctx, long options, options, return 0, return)
107
+DEFINEFUNC(long, X509_get_version, X509 *x, x, return 0, return)
108
+DEFINEFUNC(X509_PUBKEY *, X509_get_X509_PUBKEY, X509 *x, x, return 0, return)
109
+DEFINEFUNC(int, RSA_bits,  const RSA *rsa, rsa, return 0, return)
110
+DEFINEFUNC(int, DSA_security_bits, const DSA *dsa, dsa, return 0, return)
111
+DEFINEFUNC(ASN1_TIME *, X509_getm_notAfter, X509 *x, x, return 0, return)
112
+DEFINEFUNC(ASN1_TIME *, X509_getm_notBefore, X509 *x, x, return 0, return)
113
+DEFINEFUNC4(void, DSA_get0_pqg, const DSA *d, d, BIGNUM **p, p, BIGNUM **q, q, BIGNUM **g, g, return, return)
114
+#endif
115
+
116
 #ifdef Q_OS_SYMBIAN
117
 #define RESOLVEFUNC(func, ordinal, lib) \
118
     if (!(_q_##func = _q_PTR_##func(lib->resolve(#ordinal)))) \
119
@@ -511,9 +560,9 @@ static QPair<QLibrary*, QLibrary*> loadOpenSsl()
7
     libcrypto->setLoadHints(libcrypto->loadHints() | QLibrary::ImprovedSearchHeuristics);
120
     libcrypto->setLoadHints(libcrypto->loadHints() | QLibrary::ImprovedSearchHeuristics);
8
 #elif defined(SHLIB_VERSION_NUMBER)
121
 #elif defined(SHLIB_VERSION_NUMBER)
9
     // first attempt: the canonical name is libssl.so.<SHLIB_VERSION_NUMBER>
122
     // first attempt: the canonical name is libssl.so.<SHLIB_VERSION_NUMBER>
Lines 15-21 Link Here
15
     libcrypto->setLoadHints(libcrypto->loadHints() | QLibrary::ImprovedSearchHeuristics);
128
     libcrypto->setLoadHints(libcrypto->loadHints() | QLibrary::ImprovedSearchHeuristics);
16
     if (libcrypto->load() && libssl->load()) {
129
     if (libcrypto->load() && libssl->load()) {
17
         // libssl.so.<SHLIB_VERSION_NUMBER> and libcrypto.so.<SHLIB_VERSION_NUMBER> found
130
         // libssl.so.<SHLIB_VERSION_NUMBER> and libcrypto.so.<SHLIB_VERSION_NUMBER> found
18
@@ -525,8 +525,8 @@ static QPair<QLibrary*, QLibrary*> loadO
131
@@ -525,8 +574,8 @@ static QPair<QLibrary*, QLibrary*> loadOpenSsl()
19
 #endif
132
 #endif
20
 
133
 
21
     // second attempt: find the development files libssl.so and libcrypto.so
134
     // second attempt: find the development files libssl.so and libcrypto.so
Lines 26-28 Link Here
26
     if (libcrypto->load() && libssl->load()) {
139
     if (libcrypto->load() && libssl->load()) {
27
         // libssl.so.0 and libcrypto.so.0 found
140
         // libssl.so.0 and libcrypto.so.0 found
28
         return pair;
141
         return pair;
142
@@ -580,8 +629,12 @@ bool q_resolveOpenSslSymbols()
143
     static volatile bool symbolsResolved = false;
144
     static volatile bool triedToResolveSymbols = false;
145
 #ifndef QT_NO_THREAD
146
+#if OPENSSL_VERSION_NUMBER < 0x10100000L
147
     QMutexLocker locker(QMutexPool::globalInstanceGet((void *)&q_SSL_library_init));
148
+#else
149
+    QMutexLocker locker(QMutexPool::globalInstanceGet((void *)&q_OPENSSL_init_ssl));
150
 #endif
151
+#endif
152
     if (symbolsResolved)
153
         return true;
154
     if (triedToResolveSymbols)
155
@@ -614,9 +667,11 @@ bool q_resolveOpenSslSymbols()
156
     RESOLVEFUNC(BIO_write, 269, libs.second )
157
     RESOLVEFUNC(BN_num_bits, 387, libs.second )
158
     RESOLVEFUNC(CRYPTO_free, 469, libs.second )
159
+#if OPENSSL_VERSION_NUMBER < 0x10100000L
160
     RESOLVEFUNC(CRYPTO_num_locks, 500, libs.second )
161
     RESOLVEFUNC(CRYPTO_set_id_callback, 513, libs.second )
162
     RESOLVEFUNC(CRYPTO_set_locking_callback, 516, libs.second )
163
+#endif
164
     RESOLVEFUNC(DSA_free, 594, libs.second )
165
     RESOLVEFUNC(ERR_error_string, 744, libs.second )
166
     RESOLVEFUNC(ERR_get_error, 749, libs.second )
167
@@ -674,8 +729,10 @@ bool q_resolveOpenSslSymbols()
168
     RESOLVEFUNC(SSL_get_peer_cert_chain, 117, libs.first )
169
     RESOLVEFUNC(SSL_get_peer_certificate, 118, libs.first )
170
     RESOLVEFUNC(SSL_get_verify_result, 132, libs.first )
171
+#if OPENSSL_VERSION_NUMBER < 0x10100000L
172
     RESOLVEFUNC(SSL_library_init, 137, libs.first )
173
     RESOLVEFUNC(SSL_load_error_strings, 139, libs.first )
174
+#endif
175
     RESOLVEFUNC(SSL_new, 140, libs.first )
176
 #if OPENSSL_VERSION_NUMBER >= 0x0090806fL && !defined(OPENSSL_NO_TLSEXT)
177
     RESOLVEFUNC(SSL_ctrl, 95, libs.first )
178
@@ -747,9 +804,11 @@ bool q_resolveOpenSslSymbols()
179
     RESOLVEFUNC(BIO_write)
180
     RESOLVEFUNC(BN_num_bits)
181
     RESOLVEFUNC(CRYPTO_free)
182
+#if OPENSSL_VERSION_NUMBER < 0x10100000L
183
     RESOLVEFUNC(CRYPTO_num_locks)
184
     RESOLVEFUNC(CRYPTO_set_id_callback)
185
     RESOLVEFUNC(CRYPTO_set_locking_callback)
186
+#endif
187
     RESOLVEFUNC(DSA_free)
188
     RESOLVEFUNC(ERR_error_string)
189
     RESOLVEFUNC(ERR_get_error)
190
@@ -779,10 +838,17 @@ bool q_resolveOpenSslSymbols()
191
     RESOLVEFUNC(RAND_seed)
192
     RESOLVEFUNC(RAND_status)
193
     RESOLVEFUNC(RSA_free)
194
+#if OPENSSL_VERSION_NUMBER < 0x10100000L
195
     RESOLVEFUNC(sk_free)
196
     RESOLVEFUNC(sk_num)
197
     RESOLVEFUNC(sk_pop_free)
198
     RESOLVEFUNC(sk_value)
199
+#else
200
+    RESOLVEFUNC(OPENSSL_sk_free)
201
+    RESOLVEFUNC(OPENSSL_sk_num)
202
+    RESOLVEFUNC(OPENSSL_sk_pop_free)
203
+    RESOLVEFUNC(OPENSSL_sk_value)
204
+#endif
205
     RESOLVEFUNC(SSL_CIPHER_description)
206
     RESOLVEFUNC(SSL_CTX_check_private_key)
207
     RESOLVEFUNC(SSL_CTX_ctrl)
208
@@ -797,6 +863,7 @@ bool q_resolveOpenSslSymbols()
209
     RESOLVEFUNC(SSL_CTX_use_PrivateKey)
210
     RESOLVEFUNC(SSL_CTX_use_RSAPrivateKey)
211
     RESOLVEFUNC(SSL_CTX_use_PrivateKey_file)
212
+    RESOLVEFUNC(SSL_CTX_get_cert_store)
213
     RESOLVEFUNC(SSL_accept)
214
     RESOLVEFUNC(SSL_clear)
215
     RESOLVEFUNC(SSL_connect)
216
@@ -807,8 +874,12 @@ bool q_resolveOpenSslSymbols()
217
     RESOLVEFUNC(SSL_get_peer_cert_chain)
218
     RESOLVEFUNC(SSL_get_peer_certificate)
219
     RESOLVEFUNC(SSL_get_verify_result)
220
+#if OPENSSL_VERSION_NUMBER < 0x10100000L
221
     RESOLVEFUNC(SSL_library_init)
222
     RESOLVEFUNC(SSL_load_error_strings)
223
+#else
224
+    RESOLVEFUNC(OPENSSL_init_ssl)
225
+#endif
226
     RESOLVEFUNC(SSL_new)
227
 #if OPENSSL_VERSION_NUMBER >= 0x0090806fL && !defined(OPENSSL_NO_TLSEXT)
228
     RESOLVEFUNC(SSL_ctrl)
229
@@ -819,17 +890,42 @@ bool q_resolveOpenSslSymbols()
230
     RESOLVEFUNC(SSL_set_connect_state)
231
     RESOLVEFUNC(SSL_shutdown)
232
     RESOLVEFUNC(SSL_write)
233
+
234
+    RESOLVEFUNC(X509_get_serialNumber)
235
+#if OPENSSL_VERSION_NUMBER >= 0x10100000L
236
+    RESOLVEFUNC(SSL_CTX_ctrl)
237
+    RESOLVEFUNC(EVP_PKEY_id)
238
+    RESOLVEFUNC(EVP_PKEY_base_id)
239
+    RESOLVEFUNC(SSL_CIPHER_get_bits)
240
+    RESOLVEFUNC(SSL_CTX_set_options)
241
+    RESOLVEFUNC(X509_get_version)
242
+    RESOLVEFUNC(X509_get_X509_PUBKEY)
243
+    RESOLVEFUNC(RSA_bits)
244
+    RESOLVEFUNC(DSA_security_bits)
245
+    RESOLVEFUNC(X509_getm_notAfter)
246
+    RESOLVEFUNC(X509_getm_notBefore)
247
+    RESOLVEFUNC(DSA_get0_pqg)
248
+#endif
249
+
250
 #ifndef OPENSSL_NO_SSL2
251
     RESOLVEFUNC(SSLv2_client_method)
252
 #endif
253
     RESOLVEFUNC(SSLv3_client_method)
254
+#if OPENSSL_VERSION_NUMBER < 0x10100000L
255
     RESOLVEFUNC(SSLv23_client_method)
256
+#else
257
+    RESOLVEFUNC(TLS_client_method)
258
+#endif
259
     RESOLVEFUNC(TLSv1_client_method)
260
 #ifndef OPENSSL_NO_SSL2
261
     RESOLVEFUNC(SSLv2_server_method)
262
 #endif
263
     RESOLVEFUNC(SSLv3_server_method)
264
+#if OPENSSL_VERSION_NUMBER < 0x10100000L
265
     RESOLVEFUNC(SSLv23_server_method)
266
+#else
267
+    RESOLVEFUNC(TLS_server_method)
268
+#endif
269
     RESOLVEFUNC(TLSv1_server_method)
270
     RESOLVEFUNC(X509_NAME_entry_count)
271
     RESOLVEFUNC(X509_NAME_get_entry)
272
@@ -846,7 +942,11 @@ bool q_resolveOpenSslSymbols()
273
     RESOLVEFUNC(X509_STORE_CTX_get_error)
274
     RESOLVEFUNC(X509_STORE_CTX_get_error_depth)
275
     RESOLVEFUNC(X509_STORE_CTX_get_current_cert)
276
+#if OPENSSL_VERSION_NUMBER < 0x10100000L
277
     RESOLVEFUNC(X509_STORE_CTX_get_chain)
278
+#else
279
+    RESOLVEFUNC(X509_STORE_CTX_get0_chain)
280
+#endif
281
     RESOLVEFUNC(X509_cmp)
282
 #ifndef SSLEAY_MACROS
283
     RESOLVEFUNC(X509_dup)
284
@@ -867,10 +967,18 @@ bool q_resolveOpenSslSymbols()
285
     RESOLVEFUNC(d2i_DSAPrivateKey)
286
     RESOLVEFUNC(d2i_RSAPrivateKey)
287
 #endif
288
+#if OPENSSL_VERSION_NUMBER < 0x10100000L
289
     RESOLVEFUNC(OPENSSL_add_all_algorithms_noconf)
290
     RESOLVEFUNC(OPENSSL_add_all_algorithms_conf)
291
+#else
292
+    RESOLVEFUNC(OPENSSL_init_crypto)
293
+#endif
294
     RESOLVEFUNC(SSL_CTX_load_verify_locations)
295
+#if OPENSSL_VERSION_NUMBER < 0x10100000L
296
     RESOLVEFUNC(SSLeay)
297
+#else
298
+    RESOLVEFUNC(OpenSSL_version_num)
299
+#endif
300
 #endif // Q_OS_SYMBIAN
301
     symbolsResolved = true;
302
     delete libs.first;
(-)net/qt4-network/files/patch-src_network_ssl_qsslsocket__openssl__symbols__p.h (+158 lines)
Line 0 Link Here
1
--- src/network/ssl/qsslsocket_openssl_symbols_p.h.orig	2015-05-07 14:14:44 UTC
2
+++ src/network/ssl/qsslsocket_openssl_symbols_p.h
3
@@ -213,9 +213,15 @@ int q_BIO_read(BIO *a, void *b, int c);
4
 BIO_METHOD *q_BIO_s_mem();
5
 int q_BIO_write(BIO *a, const void *b, int c);
6
 int q_BN_num_bits(const BIGNUM *a);
7
+#if OPENSSL_VERSION_NUMBER < 0x10100000L
8
 int q_CRYPTO_num_locks();
9
 void q_CRYPTO_set_locking_callback(void (*a)(int, int, const char *, int));
10
 void q_CRYPTO_set_id_callback(unsigned long (*a)());
11
+#else
12
+#define q_CRYPTO_num_locks() 1
13
+#define q_CRYPTO_set_locking_callback(a)
14
+#define q_CRYPTO_set_id_callback(a)
15
+#endif
16
 void q_CRYPTO_free(void *a);
17
 void q_DSA_free(DSA *a);
18
 #if OPENSSL_VERSION_NUMBER >= 0x00908000L
19
@@ -258,6 +264,7 @@ int q_PEM_write_bio_RSA_PUBKEY(BIO *a, RSA *b);
20
 void q_RAND_seed(const void *a, int b);
21
 int q_RAND_status();
22
 void q_RSA_free(RSA *a);
23
+#if OPENSSL_VERSION_NUMBER < 0x10100000L
24
 int q_sk_num(STACK *a);
25
 void q_sk_pop_free(STACK *a, void (*b)(void *));
26
 #if OPENSSL_VERSION_NUMBER >= 0x10000000L
27
@@ -267,6 +274,16 @@ void * q_sk_value(STACK *a, int b);
28
 void q_sk_free(STACK *a);
29
 char * q_sk_value(STACK *a, int b);
30
 #endif
31
+#else
32
+int q_OPENSSL_sk_num(STACK *a);
33
+void q_OPENSSL_sk_pop_free(STACK *a, void (*b)(void *));
34
+void q_OPENSSL_sk_free(_STACK *a);
35
+void * q_OPENSSL_sk_value(STACK *a, int b);
36
+#define q_sk_num q_OPENSSL_sk_num
37
+#define q_sk_pop_free q_OPENSSL_sk_pop_free
38
+#define q_sk_free q_OPENSSL_sk_free
39
+#define q_sk_value q_OPENSSL_sk_value
40
+#endif
41
 int q_SSL_accept(SSL *a);
42
 int q_SSL_clear(SSL *a);
43
 char *q_SSL_CIPHER_description(SSL_CIPHER *a, char *b, int c);
44
@@ -314,8 +331,14 @@ long q_SSL_get_verify_result(const SSL *a);
45
 #else
46
 long q_SSL_get_verify_result(SSL *a);
47
 #endif
48
+#if OPENSSL_VERSION_NUMBER < 0x10100000L
49
 int q_SSL_library_init();
50
 void q_SSL_load_error_strings();
51
+#else
52
+int q_OPENSSL_init_ssl(uint64_t opts, void *settings);
53
+#define q_SSL_library_init() q_OPENSSL_init_ssl(0, NULL)
54
+#define q_SSL_load_error_strings() q_OPENSSL_init_ssl(OPENSSL_INIT_LOAD_SSL_STRINGS | OPENSSL_INIT_LOAD_CRYPTO_STRINGS, NULL)
55
+#endif
56
 SSL *q_SSL_new(SSL_CTX *a);
57
 #if OPENSSL_VERSION_NUMBER >= 0x0090806fL && !defined(OPENSSL_NO_TLSEXT)
58
 long q_SSL_ctrl(SSL *ssl,int cmd, long larg, void *parg);
59
@@ -328,11 +351,21 @@ int q_SSL_shutdown(SSL *a);
60
 #if OPENSSL_VERSION_NUMBER >= 0x10000000L
61
 const SSL_METHOD *q_SSLv2_client_method();
62
 const SSL_METHOD *q_SSLv3_client_method();
63
+#if OPENSSL_VERSION_NUMBER < 0x10100000L
64
 const SSL_METHOD *q_SSLv23_client_method();
65
+#else
66
+const SSL_METHOD *q_TLS_client_method();
67
+#define q_SSLv23_client_method q_TLS_client_method
68
+#endif
69
 const SSL_METHOD *q_TLSv1_client_method();
70
 const SSL_METHOD *q_SSLv2_server_method();
71
 const SSL_METHOD *q_SSLv3_server_method();
72
+#if OPENSSL_VERSION_NUMBER < 0x10100000L
73
 const SSL_METHOD *q_SSLv23_server_method();
74
+#else
75
+const SSL_METHOD *q_TLS_server_method();
76
+#define q_SSLv23_server_method q_TLS_server_method
77
+#endif
78
 const SSL_METHOD *q_TLSv1_server_method();
79
 #else
80
 SSL_METHOD *q_SSLv2_client_method();
81
@@ -377,7 +410,12 @@ int q_X509_STORE_CTX_set_purpose(X509_STORE_CTX *ctx, 
82
 int q_X509_STORE_CTX_get_error(X509_STORE_CTX *ctx);
83
 int q_X509_STORE_CTX_get_error_depth(X509_STORE_CTX *ctx);
84
 X509 *q_X509_STORE_CTX_get_current_cert(X509_STORE_CTX *ctx);
85
+#if OPENSSL_VERSION_NUMBER < 0x10100000L
86
 STACK_OF(X509) *q_X509_STORE_CTX_get_chain(X509_STORE_CTX *ctx);
87
+#else
88
+STACK_OF(X509) *q_X509_STORE_CTX_get0_chain(X509_STORE_CTX *ctx);
89
+#define q_X509_STORE_CTX_get_chain q_X509_STORE_CTX_get0_chain
90
+#endif
91
 
92
 #define q_BIO_get_mem_data(b, pp) (int)q_BIO_ctrl(b,BIO_CTRL_INFO,0,(char *)pp)
93
 #define q_BIO_pending(b) (int)q_BIO_ctrl(b,BIO_CTRL_PENDING,0,NULL)
94
@@ -399,7 +437,24 @@ DSA *q_d2i_DSAPrivateKey(DSA **a, unsigned char **pp, 
95
 		PEM_ASN1_write_bio((int (*)(void*, unsigned char**))q_i2d_DSAPrivateKey,PEM_STRING_DSA,\
96
 			bp,(char *)x,enc,kstr,klen,cb,u)
97
 #endif
98
+
99
+X509_STORE * q_SSL_CTX_get_cert_store(const SSL_CTX *ctx);
100
+ASN1_INTEGER * q_X509_get_serialNumber(X509 *x);
101
+
102
+#if OPENSSL_VERSION_NUMBER < 0x10100000L
103
 #define q_SSL_CTX_set_options(ctx,op) q_SSL_CTX_ctrl((ctx),SSL_CTRL_OPTIONS,(op),NULL)
104
+#else
105
+int q_EVP_PKEY_id(const EVP_PKEY *pkey);
106
+int q_EVP_PKEY_base_id(const EVP_PKEY *pkey);
107
+int q_SSL_CIPHER_get_bits(const SSL_CIPHER *cipher, int *alg_bits);
108
+long q_SSL_CTX_set_options(SSL_CTX *ctx, long options);
109
+long q_X509_get_version(X509 *x);
110
+X509_PUBKEY * q_X509_get_X509_PUBKEY(X509 *x);
111
+int q_RSA_bits(const RSA *rsa);
112
+int q_DSA_security_bits(const DSA *dsa);
113
+void q_DSA_get0_pqg(const DSA *d, BIGNUM **p, BIGNUM **q, BIGNUM **g);
114
+#endif
115
+
116
 #define q_SKM_sk_num(type, st) ((int (*)(const STACK_OF(type) *))q_sk_num)(st)
117
 #define q_SKM_sk_value(type, st,i) ((type * (*)(const STACK_OF(type) *, int))q_sk_value)(st, i)
118
 #define q_sk_GENERAL_NAME_num(st) q_SKM_sk_num(GENERAL_NAME, (st))
119
@@ -410,8 +465,17 @@ DSA *q_d2i_DSAPrivateKey(DSA **a, unsigned char **pp, 
120
 #define q_sk_SSL_CIPHER_value(st, i) q_SKM_sk_value(SSL_CIPHER, (st), (i))
121
 #define q_SSL_CTX_add_extra_chain_cert(ctx,x509) \
122
         q_SSL_CTX_ctrl(ctx,SSL_CTRL_EXTRA_CHAIN_CERT,0,(char *)x509)
123
+
124
+#if OPENSSL_VERSION_NUMBER < 0x10100000L
125
 #define q_X509_get_notAfter(x) X509_get_notAfter(x)
126
 #define q_X509_get_notBefore(x) X509_get_notBefore(x)
127
+#else
128
+ASN1_TIME *q_X509_getm_notAfter(X509 *x);
129
+ASN1_TIME *q_X509_getm_notBefore(X509 *x);
130
+#define q_X509_get_notAfter(x) q_X509_getm_notAfter(x)
131
+#define q_X509_get_notBefore(x) q_X509_getm_notBefore(x)
132
+#endif
133
+
134
 #define q_EVP_PKEY_assign_RSA(pkey,rsa) q_EVP_PKEY_assign((pkey),EVP_PKEY_RSA,\
135
 					(char *)(rsa))
136
 #define q_EVP_PKEY_assign_DSA(pkey,dsa) q_EVP_PKEY_assign((pkey),EVP_PKEY_DSA,\
137
@@ -421,10 +485,21 @@ DSA *q_d2i_DSAPrivateKey(DSA **a, unsigned char **pp, 
138
 #else
139
 #define q_OpenSSL_add_all_algorithms() q_OPENSSL_add_all_algorithms_noconf()
140
 #endif
141
+#if OPENSSL_VERSION_NUMBER < 0x10100000L
142
 void q_OPENSSL_add_all_algorithms_noconf();
143
 void q_OPENSSL_add_all_algorithms_conf();
144
+#else
145
+int q_OPENSSL_init_crypto(uint64_t opts, void *settings);
146
+#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)
147
+#  define q_OPENSSL_add_all_algorithms_noconf() q_OPENSSL_init_crypto(OPENSSL_INIT_ADD_ALL_CIPHERS | OPENSSL_INIT_ADD_ALL_DIGESTS, NULL)
148
+#endif
149
 int q_SSL_CTX_load_verify_locations(SSL_CTX *ctx, const char *CAfile, const char *CApath);
150
+#if OPENSSL_VERSION_NUMBER < 0x10100000L
151
 long q_SSLeay();
152
+#else
153
+unsigned long q_OpenSSL_version_num();
154
+#define q_SSLeay q_OpenSSL_version_num
155
+#endif
156
 
157
 // Helper function
158
 class QDateTime;

Return to bug 214691