From 747de3e067c80de0063fdbaa3054ba9003b9e5a4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Klitzing?= Date: Fri, 18 May 2018 12:20:50 +0200 Subject: Fix build if openssl is configured with no-des or no-rc2 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit A custom build of openssl can disable DES or RC2. This allows to build Qt against those builds. Change-Id: I9b91c943fab4d217a791381e81a7d87a9ff5031a Reviewed-by: Mårten Nordheim Reviewed-by: Timur Pocheptsov --- src/network/ssl/qsslkey_openssl.cpp | 41 ++++++++++++++++---------- src/network/ssl/qsslsocket_openssl_symbols.cpp | 8 +++++ src/network/ssl/qsslsocket_openssl_symbols_p.h | 4 +++ 3 files changed, 37 insertions(+), 16 deletions(-) (limited to 'src') diff --git a/src/network/ssl/qsslkey_openssl.cpp b/src/network/ssl/qsslkey_openssl.cpp index aa81b735b9..58df544a0e 100644 --- a/src/network/ssl/qsslkey_openssl.cpp +++ b/src/network/ssl/qsslkey_openssl.cpp @@ -193,6 +193,16 @@ QByteArray QSslKeyPrivate::toPem(const QByteArray &passPhrase) const if (!QSslSocket::supportsSsl() || isNull || algorithm == QSsl::Opaque) return QByteArray(); + // ### the cipher should be selectable in the API: + const EVP_CIPHER *cipher = nullptr; + if (type == QSsl::PrivateKey && !passPhrase.isEmpty()) { +#ifndef OPENSSL_NO_DES + cipher = q_EVP_des_ede3_cbc(); +#else + return QByteArray(); +#endif + } + BIO *bio = q_BIO_new(q_BIO_s_mem()); if (!bio) return QByteArray(); @@ -205,9 +215,7 @@ QByteArray QSslKeyPrivate::toPem(const QByteArray &passPhrase) const fail = true; } else { if (!q_PEM_write_bio_RSAPrivateKey( - bio, rsa, - // ### the cipher should be selectable in the API: - passPhrase.isEmpty() ? (const EVP_CIPHER *)0 : q_EVP_des_ede3_cbc(), + bio, rsa, cipher, const_cast((const uchar *)passPhrase.data()), passPhrase.size(), 0, 0)) { fail = true; } @@ -218,9 +226,7 @@ QByteArray QSslKeyPrivate::toPem(const QByteArray &passPhrase) const fail = true; } else { if (!q_PEM_write_bio_DSAPrivateKey( - bio, dsa, - // ### the cipher should be selectable in the API: - passPhrase.isEmpty() ? (const EVP_CIPHER *)0 : q_EVP_des_ede3_cbc(), + bio, dsa, cipher, const_cast((const uchar *)passPhrase.data()), passPhrase.size(), 0, 0)) { fail = true; } @@ -232,9 +238,7 @@ QByteArray QSslKeyPrivate::toPem(const QByteArray &passPhrase) const fail = true; } else { if (!q_PEM_write_bio_ECPrivateKey( - bio, ec, - // ### the cipher should be selectable in the API: - passPhrase.isEmpty() ? (const EVP_CIPHER *)0 : q_EVP_des_ede3_cbc(), + bio, ec, cipher, const_cast((const uchar *)passPhrase.data()), passPhrase.size(), 0, 0)) { fail = true; } @@ -274,34 +278,39 @@ Qt::HANDLE QSslKeyPrivate::handle() const static QByteArray doCrypt(QSslKeyPrivate::Cipher cipher, const QByteArray &data, const QByteArray &key, const QByteArray &iv, int enc) { -#if QT_CONFIG(opensslv11) - EVP_CIPHER_CTX *ctx = q_EVP_CIPHER_CTX_new(); -#else - EVP_CIPHER_CTX evpCipherContext; - EVP_CIPHER_CTX *ctx = &evpCipherContext; -#endif - const EVP_CIPHER* type = 0; int i = 0, len = 0; switch (cipher) { case QSslKeyPrivate::DesCbc: +#ifndef OPENSSL_NO_DES type = q_EVP_des_cbc(); +#endif break; case QSslKeyPrivate::DesEde3Cbc: +#ifndef OPENSSL_NO_DES type = q_EVP_des_ede3_cbc(); +#endif break; case QSslKeyPrivate::Rc2Cbc: +#ifndef OPENSSL_NO_RC2 type = q_EVP_rc2_cbc(); +#endif break; } + if (type == nullptr) + return QByteArray(); + QByteArray output; output.resize(data.size() + EVP_MAX_BLOCK_LENGTH); #if QT_CONFIG(opensslv11) + EVP_CIPHER_CTX *ctx = q_EVP_CIPHER_CTX_new(); q_EVP_CIPHER_CTX_reset(ctx); #else + EVP_CIPHER_CTX evpCipherContext; + EVP_CIPHER_CTX *ctx = &evpCipherContext; q_EVP_CIPHER_CTX_init(ctx); #endif diff --git a/src/network/ssl/qsslsocket_openssl_symbols.cpp b/src/network/ssl/qsslsocket_openssl_symbols.cpp index 82ff5e9e3a..466eba0bd0 100644 --- a/src/network/ssl/qsslsocket_openssl_symbols.cpp +++ b/src/network/ssl/qsslsocket_openssl_symbols.cpp @@ -322,9 +322,13 @@ DEFINEFUNC5(int, EVP_CipherInit, EVP_CIPHER_CTX *ctx, ctx, const EVP_CIPHER *typ DEFINEFUNC6(int, EVP_CipherInit_ex, EVP_CIPHER_CTX *ctx, ctx, const EVP_CIPHER *cipher, cipher, ENGINE *impl, impl, const unsigned char *key, key, const unsigned char *iv, iv, int enc, enc, return 0, return) DEFINEFUNC5(int, EVP_CipherUpdate, EVP_CIPHER_CTX *ctx, ctx, unsigned char *out, out, int *outl, outl, const unsigned char *in, in, int inl, inl, return 0, return) DEFINEFUNC3(int, EVP_CipherFinal, EVP_CIPHER_CTX *ctx, ctx, unsigned char *out, out, int *outl, outl, return 0, return) +#ifndef OPENSSL_NO_DES DEFINEFUNC(const EVP_CIPHER *, EVP_des_cbc, DUMMYARG, DUMMYARG, return 0, return) DEFINEFUNC(const EVP_CIPHER *, EVP_des_ede3_cbc, DUMMYARG, DUMMYARG, return 0, return) +#endif +#ifndef OPENSSL_NO_RC2 DEFINEFUNC(const EVP_CIPHER *, EVP_rc2_cbc, DUMMYARG, DUMMYARG, return 0, return) +#endif DEFINEFUNC(const EVP_MD *, EVP_sha1, DUMMYARG, DUMMYARG, return 0, return) DEFINEFUNC3(int, EVP_PKEY_assign, EVP_PKEY *a, a, int b, b, char *c, c, return -1, return) DEFINEFUNC2(int, EVP_PKEY_set1_RSA, EVP_PKEY *a, a, RSA *b, b, return -1, return) @@ -1042,9 +1046,13 @@ bool q_resolveOpenSslSymbols() RESOLVEFUNC(EVP_CipherInit_ex) RESOLVEFUNC(EVP_CipherUpdate) RESOLVEFUNC(EVP_CipherFinal) +#ifndef OPENSSL_NO_DES RESOLVEFUNC(EVP_des_cbc) RESOLVEFUNC(EVP_des_ede3_cbc) +#endif +#ifndef OPENSSL_NO_RC2 RESOLVEFUNC(EVP_rc2_cbc) +#endif RESOLVEFUNC(EVP_sha1) RESOLVEFUNC(EVP_PKEY_assign) RESOLVEFUNC(EVP_PKEY_set1_RSA) diff --git a/src/network/ssl/qsslsocket_openssl_symbols_p.h b/src/network/ssl/qsslsocket_openssl_symbols_p.h index 4fb8f26cf6..68b519d74e 100644 --- a/src/network/ssl/qsslsocket_openssl_symbols_p.h +++ b/src/network/ssl/qsslsocket_openssl_symbols_p.h @@ -266,9 +266,13 @@ int q_EVP_CipherInit(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *type, const unsigned int q_EVP_CipherInit_ex(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *cipher, ENGINE *impl, const unsigned char *key, const unsigned char *iv, int enc); int q_EVP_CipherUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl, const unsigned char *in, int inl); int q_EVP_CipherFinal(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl); +#ifndef OPENSSL_NO_DES const EVP_CIPHER *q_EVP_des_cbc(); const EVP_CIPHER *q_EVP_des_ede3_cbc(); +#endif +#ifndef OPENSSL_NO_RC2 const EVP_CIPHER *q_EVP_rc2_cbc(); +#endif const EVP_MD *q_EVP_sha1(); int q_EVP_PKEY_assign(EVP_PKEY *a, int b, char *c); Q_AUTOTEST_EXPORT int q_EVP_PKEY_set1_RSA(EVP_PKEY *a, RSA *b); -- cgit v1.2.3 From 56b04fe42ff3f6b98cf78a03f1910c45fada26bd Mon Sep 17 00:00:00 2001 From: Samuel Gaist Date: Fri, 20 Oct 2017 23:18:13 +0200 Subject: Add translation for unsupported_android_version for fr and de More recent versions of Android lint triggers an error when a translation is missing. The solution is to either provide translations for all languages supported or add translatable="false" as property to the strings that are not yet fully translated. Task-number: QTBUG-63952 Change-Id: I5afa8a23d3e2285b5c93ee493d9b02397c328f2d Reviewed-by: Robert Loehning Reviewed-by: BogDan Vatra --- src/android/java/res/values-de/strings.xml | 1 + src/android/java/res/values-fr/strings.xml | 1 + 2 files changed, 2 insertions(+) (limited to 'src') diff --git a/src/android/java/res/values-de/strings.xml b/src/android/java/res/values-de/strings.xml index 320d9ec33f..21881ec97f 100644 --- a/src/android/java/res/values-de/strings.xml +++ b/src/android/java/res/values-de/strings.xml @@ -3,4 +3,5 @@ Ministro-Dienst wurde nicht gefunden.\nAnwendung kann nicht gestartet werden Diese Anwendung benötigt den Ministro-Dienst. Möchten Sie ihn installieren? In Ihrer Anwendung ist ein schwerwiegender Fehler aufgetreten, sie kann nicht fortgesetzt werden + Diese Android-Version wird nicht unterstützt. diff --git a/src/android/java/res/values-fr/strings.xml b/src/android/java/res/values-fr/strings.xml index efc0fb6e1e..ce8e5f5af1 100644 --- a/src/android/java/res/values-fr/strings.xml +++ b/src/android/java/res/values-fr/strings.xml @@ -3,4 +3,5 @@ Le service Ministro est introuvable.\nL\'application ne peut pas démarrer. Cette application requiert le service Ministro. Voulez-vous l\'installer? Votre application a rencontré une erreur fatale et ne peut pas continuer. + Cette version d\'Android n\'est pas supportée. -- cgit v1.2.3 From 8050f1c287490ec6130e85e83beb55dccab0294d Mon Sep 17 00:00:00 2001 From: Liang Qi Date: Fri, 25 May 2018 10:10:24 +0200 Subject: Fix build for Android with android-clang kernel/qnetworkinterface_linux.cpp:204:17: error: comparison of integers of different signs: '__u32' (aka 'unsigned int') and 'qsizetype' (aka 'int') [-Werror,-Wsign-compare] if (NLMSG_OK(hdr, len)) ^~~~~~~~~~~~~~~~~~ This amends 09cb23f342fd2eae7ca85a99fa0a10b7ab103443. Change-Id: Ib966a60b7a7117d63ed758cba7b556abd90eca0c Reviewed-by: Mikhail Svetkin Reviewed-by: BogDan Vatra Reviewed-by: Thiago Macieira --- src/network/kernel/qnetworkinterface_linux.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/network/kernel/qnetworkinterface_linux.cpp b/src/network/kernel/qnetworkinterface_linux.cpp index b3b5e242b4..25aba5836e 100644 --- a/src/network/kernel/qnetworkinterface_linux.cpp +++ b/src/network/kernel/qnetworkinterface_linux.cpp @@ -201,7 +201,7 @@ template struct ProcessNetlinkRequest } #ifndef QT_NO_DEBUG - if (NLMSG_OK(hdr, len)) + if (NLMSG_OK(hdr, quint32(len))) qWarning("QNetworkInterface/AF_NETLINK: received unknown packet type (%d) or too short (%u)", hdr->nlmsg_type, hdr->nlmsg_len); else -- cgit v1.2.3 From e15fc26e9fdbff141890a3e2e8dc4ef935d022a0 Mon Sep 17 00:00:00 2001 From: Christian Ehrlicher Date: Fri, 25 May 2018 21:06:43 +0200 Subject: QSortFilterProxyModel: don't assert when old model gets destroyed When a new model was set with setSourceModel() and the mapping was built up, the destruction of the old model caused a reset in the QSortFilterProxyModel which lead to an empty view or an assertion. Now we properly disconnect the old model again and also clean up the old mapping/persistent indexes when a new source model is set. Task-number: QTBUG-44962 Task-number: QTBUG-67948 Task-number: QTBUG-68427 Change-Id: I2e0612899c210bde3ac0cfa59aefd78269deee5b Reviewed-by: David Faure --- src/corelib/itemmodels/qsortfilterproxymodel.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/corelib/itemmodels/qsortfilterproxymodel.cpp b/src/corelib/itemmodels/qsortfilterproxymodel.cpp index 78093727b8..08279cb244 100644 --- a/src/corelib/itemmodels/qsortfilterproxymodel.cpp +++ b/src/corelib/itemmodels/qsortfilterproxymodel.cpp @@ -1910,7 +1910,10 @@ void QSortFilterProxyModel::setSourceModel(QAbstractItemModel *sourceModel) disconnect(d->model, SIGNAL(modelAboutToBeReset()), this, SLOT(_q_sourceAboutToBeReset())); disconnect(d->model, SIGNAL(modelReset()), this, SLOT(_q_sourceReset())); - d->_q_sourceModelDestroyed(); + // same as in _q_sourceReset() + d->invalidatePersistentIndexes(); + d->_q_clearMapping(); + QAbstractProxyModel::setSourceModel(sourceModel); connect(d->model, SIGNAL(dataChanged(QModelIndex,QModelIndex,QVector)), -- cgit v1.2.3