From 69da80a0afdc135a1fa2bdfb8020d3cd0cfdcd8cea26c127651ceafc3ca9b968 Mon Sep 17 00:00:00 2001 From: Dominique Leuenberger Date: Sat, 23 Dec 2017 11:15:29 +0000 Subject: [PATCH] Accepting request 558896 from KDE:Qt5 - Add 0001-Fix-custom-page-size-handling-in-the-Unix-print-dial.patch to fix custom page size handling in the Unix print dialog (QTBUG-58733) - Add patches from upstream to reintroduce the advanced tab in the Qt printer properties dialog: 0001-Remove-QPrintDialogPrivate-applyPrinterProperties-no.patch 0002-Remove-QUnixPrintWidgetPrivate-applyPrinterPropertie.patch 0003-Remove-QPrintPropertiesDialog-applyPrinterProperties.patch 0004-Remove-QCupsJobWidget-setPrinter.patch 0005-Remove-QPrintPropertiesDialog-selectPrinter.patch 0006-Remove-QPageSetupWidget-selectPrinter.patch 0007-Introduce-QPrintDevice-property-setProperty.patch 0008-Allow-access-to-ppd-file-and-ppdMarkOption-via-QPpdP.patch 0009-QPlatformPrintDevice-use-QVector-not-QList-in-the-AP.patch 0010-Reintroduce-the-Advanced-tab-in-the-QPrintProperties.patch 0011-QtPrintSupport-Fix-build.patch - Small change in 0001-Add-remote-print-queue-support.patch so 0007-Allow-access-to-ppd-file-and-ppdMarkOption-via-QPpdP.patch applies cleanly. - Update the license tag (boo#967696) - Update to 5.10.0 final * New bugfix release - Update to 5.10.0 RC 2 * New bugfix release - Update to 5.10.0 RC 1 * New bugfix release OBS-URL: https://build.opensuse.org/request/show/558896 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/libqt5-qtbase?expand=0&rev=71 --- 0001-Add-remote-print-queue-support.patch | 51 +- ...size-handling-in-the-Unix-print-dial.patch | 127 + 0001-QSslSocket-OpenSSL-1.1-backend.patch | 4238 ----------------- ...logPrivate-applyPrinterProperties-no.patch | 41 + ...tWidgetPrivate-applyPrinterPropertie.patch | 123 + ...pertiesDialog-applyPrinterProperties.patch | 85 + 0004-Remove-QCupsJobWidget-setPrinter.patch | 75 + ...QPrintPropertiesDialog-selectPrinter.patch | 91 + ...emove-QPageSetupWidget-selectPrinter.patch | 83 + ...ce-QPrintDevice-property-setProperty.patch | 113 + ...ppd-file-and-ppdMarkOption-via-QPpdP.patch | 97 + ...vice-use-QVector-not-QList-in-the-AP.patch | 240 + ...Advanced-tab-in-the-QPrintProperties.patch | 527 ++ 0011-QtPrintSupport-Fix-build.patch | 32 + libqt5-prioritise-gtk2-platformtheme.patch | 8 +- libqt5-qtbase.changes | 136 + libqt5-qtbase.spec | 115 +- qtbase-everywhere-src-5.10.0.tar.xz | 3 + qtbase-opensource-src-5.9.3.tar.xz | 3 - tell-the-truth-about-private-api.patch | 10 +- 20 files changed, 1889 insertions(+), 4309 deletions(-) create mode 100644 0001-Fix-custom-page-size-handling-in-the-Unix-print-dial.patch delete mode 100644 0001-QSslSocket-OpenSSL-1.1-backend.patch create mode 100644 0001-Remove-QPrintDialogPrivate-applyPrinterProperties-no.patch create mode 100644 0002-Remove-QUnixPrintWidgetPrivate-applyPrinterPropertie.patch create mode 100644 0003-Remove-QPrintPropertiesDialog-applyPrinterProperties.patch create mode 100644 0004-Remove-QCupsJobWidget-setPrinter.patch create mode 100644 0005-Remove-QPrintPropertiesDialog-selectPrinter.patch create mode 100644 0006-Remove-QPageSetupWidget-selectPrinter.patch create mode 100644 0007-Introduce-QPrintDevice-property-setProperty.patch create mode 100644 0008-Allow-access-to-ppd-file-and-ppdMarkOption-via-QPpdP.patch create mode 100644 0009-QPlatformPrintDevice-use-QVector-not-QList-in-the-AP.patch create mode 100644 0010-Reintroduce-the-Advanced-tab-in-the-QPrintProperties.patch create mode 100644 0011-QtPrintSupport-Fix-build.patch create mode 100644 qtbase-everywhere-src-5.10.0.tar.xz delete mode 100644 qtbase-opensource-src-5.9.3.tar.xz diff --git a/0001-Add-remote-print-queue-support.patch b/0001-Add-remote-print-queue-support.patch index 596e461..e4f25c6 100644 --- a/0001-Add-remote-print-queue-support.patch +++ b/0001-Add-remote-print-queue-support.patch @@ -18,10 +18,10 @@ Change-Id: Ib70715d331e8f380a3c9039011bb8521986652aa src/plugins/printsupport/cups/qppdprintdevice.cpp | 33 +++++++- 4 files changed, 160 insertions(+), 11 deletions(-) -diff --git a/src/plugins/printsupport/cups/qcupsprintengine.cpp b/src/plugins/printsupport/cups/qcupsprintengine.cpp -index a16eb3abb5..6dc123fb51 100644 ---- a/src/plugins/printsupport/cups/qcupsprintengine.cpp -+++ b/src/plugins/printsupport/cups/qcupsprintengine.cpp +Index: qtbase-everywhere-src-5.10.0/src/plugins/printsupport/cups/qcupsprintengine.cpp +=================================================================== +--- qtbase-everywhere-src-5.10.0.orig/src/plugins/printsupport/cups/qcupsprintengine.cpp ++++ qtbase-everywhere-src-5.10.0/src/plugins/printsupport/cups/qcupsprintengine.cpp @@ -48,6 +48,7 @@ #include #include "private/qcups_p.h" // Only needed for PPK_CupsOptions @@ -30,7 +30,7 @@ index a16eb3abb5..6dc123fb51 100644 #include -@@ -241,8 +242,40 @@ void QCupsPrintEnginePrivate::closePrintDevice() +@@ -241,8 +242,40 @@ void QCupsPrintEnginePrivate::closePrint // Print the file. cups_option_t* optPtr = cupsOptStruct.size() ? &cupsOptStruct.first() : 0; @@ -72,10 +72,10 @@ index a16eb3abb5..6dc123fb51 100644 QFile::remove(tempFile); } -diff --git a/src/plugins/printsupport/cups/qcupsprintersupport.cpp b/src/plugins/printsupport/cups/qcupsprintersupport.cpp -index 1887625406..a145beaf18 100644 ---- a/src/plugins/printsupport/cups/qcupsprintersupport.cpp -+++ b/src/plugins/printsupport/cups/qcupsprintersupport.cpp +Index: qtbase-everywhere-src-5.10.0/src/plugins/printsupport/cups/qcupsprintersupport.cpp +=================================================================== +--- qtbase-everywhere-src-5.10.0.orig/src/plugins/printsupport/cups/qcupsprintersupport.cpp ++++ qtbase-everywhere-src-5.10.0/src/plugins/printsupport/cups/qcupsprintersupport.cpp @@ -52,6 +52,35 @@ # include #endif @@ -112,7 +112,7 @@ index 1887625406..a145beaf18 100644 QT_BEGIN_NAMESPACE QCupsPrinterSupport::QCupsPrinterSupport() -@@ -81,17 +110,35 @@ QPrintDevice QCupsPrinterSupport::createPrintDevice(const QString &id) +@@ -81,17 +110,35 @@ QPrintDevice QCupsPrinterSupport::create QStringList QCupsPrinterSupport::availablePrintDeviceIds() const { @@ -153,7 +153,7 @@ index 1887625406..a145beaf18 100644 return list; } -@@ -99,8 +146,18 @@ QString QCupsPrinterSupport::defaultPrintDeviceId() const +@@ -99,8 +146,18 @@ QString QCupsPrinterSupport::defaultPrin { QString printerId; cups_dest_t *dests; @@ -174,7 +174,7 @@ index 1887625406..a145beaf18 100644 if (dests[i].is_default) { printerId = QString::fromLocal8Bit(dests[i].name); if (dests[i].instance) { -@@ -109,8 +166,30 @@ QString QCupsPrinterSupport::defaultPrintDeviceId() const +@@ -109,8 +166,30 @@ QString QCupsPrinterSupport::defaultPrin } } } @@ -206,10 +206,10 @@ index 1887625406..a145beaf18 100644 + + QT_END_NAMESPACE -diff --git a/src/plugins/printsupport/cups/qcupsprintersupport_p.h b/src/plugins/printsupport/cups/qcupsprintersupport_p.h -index 13f64b5e69..81eaa09882 100644 ---- a/src/plugins/printsupport/cups/qcupsprintersupport_p.h -+++ b/src/plugins/printsupport/cups/qcupsprintersupport_p.h +Index: qtbase-everywhere-src-5.10.0/src/plugins/printsupport/cups/qcupsprintersupport_p.h +=================================================================== +--- qtbase-everywhere-src-5.10.0.orig/src/plugins/printsupport/cups/qcupsprintersupport_p.h ++++ qtbase-everywhere-src-5.10.0/src/plugins/printsupport/cups/qcupsprintersupport_p.h @@ -56,6 +56,8 @@ #include @@ -234,18 +234,18 @@ index 13f64b5e69..81eaa09882 100644 }; QT_END_NAMESPACE -diff --git a/src/plugins/printsupport/cups/qppdprintdevice.cpp b/src/plugins/printsupport/cups/qppdprintdevice.cpp -index 9efa83d409..5b7222902d 100644 ---- a/src/plugins/printsupport/cups/qppdprintdevice.cpp -+++ b/src/plugins/printsupport/cups/qppdprintdevice.cpp -@@ -41,6 +41,7 @@ +Index: qtbase-everywhere-src-5.10.0/src/plugins/printsupport/cups/qppdprintdevice.cpp +=================================================================== +--- qtbase-everywhere-src-5.10.0.orig/src/plugins/printsupport/cups/qppdprintdevice.cpp ++++ qtbase-everywhere-src-5.10.0/src/plugins/printsupport/cups/qppdprintdevice.cpp +@@ -39,6 +39,7 @@ + #include "qppdprintdevice.h" + ++#include "qcupsprintersupport_p.h" #include #include -+#include "qcupsprintersupport_p.h" - #ifndef QT_LINUXBASE // LSB merges everything into cups.h - #include @@ -451,10 +452,38 @@ void QPpdPrintDevice::loadPrinter() m_cupsDest = 0; } @@ -287,6 +287,3 @@ index 9efa83d409..5b7222902d 100644 if (ppdFile) { m_ppd = ppdOpenFile(ppdFile); unlink(ppdFile); --- -2.13.0 - diff --git a/0001-Fix-custom-page-size-handling-in-the-Unix-print-dial.patch b/0001-Fix-custom-page-size-handling-in-the-Unix-print-dial.patch new file mode 100644 index 0000000..a2456c9 --- /dev/null +++ b/0001-Fix-custom-page-size-handling-in-the-Unix-print-dial.patch @@ -0,0 +1,127 @@ +From 49c7939b6b3472af756412324442170d0af5d08f Mon Sep 17 00:00:00 2001 +From: Albert Astals Cid +Date: Wed, 20 Dec 2017 10:41:33 +0100 +Subject: [PATCH] Fix custom page size handling in the Unix print dialog + +There were several problems that i've fixed in a single commit since they are very interwinded + + * The dialog used QPageSize::Custom for two things, the custom sizes coming from + the printer and the "user can write whatever size they want" size. Now only + the printer custom sizes use QPageSize::Custom and we use m_realCustomPageSizeIndex + for the "user can write whatever size they want" one. + + * The dialog stored the QPageSize id as the combo userData, that doesn't work + when the printer has multiple custom sizes since they all share QPageSize::Custom + so now it stores the QPageSize itself + +Task-number: QTBUG-58733 +Change-Id: Ie640a07bb5e24b753db83c091c836e8af4ff126c +--- + src/printsupport/dialogs/qpagesetupdialog_unix.cpp | 30 ++++++++++++++-------- + src/printsupport/dialogs/qpagesetupdialog_unix_p.h | 1 + + 2 files changed, 20 insertions(+), 11 deletions(-) + +diff --git a/src/printsupport/dialogs/qpagesetupdialog_unix.cpp b/src/printsupport/dialogs/qpagesetupdialog_unix.cpp +index 6f3bb0dd55..55ac913df8 100644 +--- a/src/printsupport/dialogs/qpagesetupdialog_unix.cpp ++++ b/src/printsupport/dialogs/qpagesetupdialog_unix.cpp +@@ -234,10 +234,14 @@ QPageSetupWidget::QPageSetupWidget(QWidget *parent) + m_printer(0), + m_outputFormat(QPrinter::PdfFormat), + m_units(QPageLayout::Point), +- m_blockSignals(false) ++ m_blockSignals(false), ++ m_realCustomPageSizeIndex(-1) + { + m_ui.setupUi(this); + ++ if (!QMetaType::hasRegisteredComparators()) ++ QMetaType::registerEqualsComparator(); ++ + QVBoxLayout *lay = new QVBoxLayout(m_ui.preview); + m_pagePreview = new QPagePreview(m_ui.preview); + m_pagePreview->setPagePreviewLayout(1, 1); +@@ -341,15 +345,18 @@ void QPageSetupWidget::initPageSizes() + + m_ui.pageSizeCombo->clear(); + ++ m_realCustomPageSizeIndex = -1; ++ + if (m_outputFormat == QPrinter::NativeFormat && !m_printerName.isEmpty()) { + QPlatformPrinterSupport *ps = QPlatformPrinterSupportPlugin::get(); + if (ps) { + QPrintDevice printDevice = ps->createPrintDevice(m_printerName); + const auto pageSizes = printDevice.supportedPageSizes(); + for (const QPageSize &pageSize : pageSizes) +- m_ui.pageSizeCombo->addItem(pageSize.name(), QVariant::fromValue(pageSize.id())); ++ m_ui.pageSizeCombo->addItem(pageSize.name(), QVariant::fromValue(pageSize)); + if (m_ui.pageSizeCombo->count() > 0 && printDevice.supportsCustomPageSizes()) { +- m_ui.pageSizeCombo->addItem(tr("Custom"), QVariant::fromValue(QPageSize::Custom)); ++ m_ui.pageSizeCombo->addItem(tr("Custom")); ++ m_realCustomPageSizeIndex = m_ui.pageSizeCombo->count() - 1; + m_blockSignals = false; + return; + } +@@ -359,10 +366,11 @@ void QPageSetupWidget::initPageSizes() + // If PdfFormat or no available printer page sizes, populate with all page sizes + for (int id = 0; id < QPageSize::LastPageSize; ++id) { + if (QPageSize::PageSizeId(id) == QPageSize::Custom) { +- m_ui.pageSizeCombo->addItem(tr("Custom"), QVariant::fromValue(QPageSize::Custom)); ++ m_ui.pageSizeCombo->addItem(tr("Custom")); ++ m_realCustomPageSizeIndex = m_ui.pageSizeCombo->count() - 1; + } else { + QPageSize pageSize = QPageSize(QPageSize::PageSizeId(id)); +- m_ui.pageSizeCombo->addItem(pageSize.name(), QVariant::fromValue(pageSize.id())); ++ m_ui.pageSizeCombo->addItem(pageSize.name(), QVariant::fromValue(pageSize)); + } + } + +@@ -434,7 +442,9 @@ void QPageSetupWidget::updateWidget() + + m_ui.unitCombo->setCurrentIndex(m_ui.unitCombo->findData(QVariant::fromValue(m_units))); + +- m_ui.pageSizeCombo->setCurrentIndex(m_ui.pageSizeCombo->findData(QVariant::fromValue(m_pageLayout.pageSize().id()))); ++ const bool isCustom = m_ui.pageSizeCombo->currentIndex() == m_realCustomPageSizeIndex && m_realCustomPageSizeIndex != -1; ++ if (!isCustom) ++ m_ui.pageSizeCombo->setCurrentIndex(m_ui.pageSizeCombo->findData(QVariant::fromValue(m_pageLayout.pageSize()))); + + QMarginsF min; + QMarginsF max; +@@ -467,8 +477,6 @@ void QPageSetupWidget::updateWidget() + m_ui.bottomMargin->setMaximum(max.bottom()); + m_ui.bottomMargin->setValue(m_pageLayout.margins().bottom()); + +- bool isCustom = m_ui.pageSizeCombo->currentData().value() == QPageSize::Custom; +- + m_ui.pageWidth->setSuffix(suffix); + m_ui.pageWidth->setValue(m_pageLayout.fullRect(m_units).width()); + m_ui.pageWidth->setEnabled(isCustom); +@@ -513,10 +521,10 @@ void QPageSetupWidget::pageSizeChanged() + if (m_blockSignals) + return; + +- QPageSize::PageSizeId id = m_ui.pageSizeCombo->currentData().value(); +- if (id != QPageSize::Custom) { ++ if (m_ui.pageSizeCombo->currentIndex() != m_realCustomPageSizeIndex) { ++ const QPageSize pageSize = m_ui.pageSizeCombo->currentData().value(); + // TODO Set layout margin min/max to printer custom min/max +- m_pageLayout.setPageSize(QPageSize(id)); ++ m_pageLayout.setPageSize(pageSize); + } else { + QSizeF customSize; + if (m_pageLayout.orientation() == QPageLayout::Landscape) +diff --git a/src/printsupport/dialogs/qpagesetupdialog_unix_p.h b/src/printsupport/dialogs/qpagesetupdialog_unix_p.h +index 574569de29..292cccd7ea 100644 +--- a/src/printsupport/dialogs/qpagesetupdialog_unix_p.h ++++ b/src/printsupport/dialogs/qpagesetupdialog_unix_p.h +@@ -102,6 +102,7 @@ private: + QPageLayout m_pageLayout; + QPageLayout::Unit m_units; + bool m_blockSignals; ++ int m_realCustomPageSizeIndex; + }; + + QT_END_NAMESPACE +-- +2.15.1 + diff --git a/0001-QSslSocket-OpenSSL-1.1-backend.patch b/0001-QSslSocket-OpenSSL-1.1-backend.patch deleted file mode 100644 index 21fcb1e..0000000 --- a/0001-QSslSocket-OpenSSL-1.1-backend.patch +++ /dev/null @@ -1,4238 +0,0 @@ -From c181441ae0ab7ebc0bfa846eb46060ce12bd2112 Mon Sep 17 00:00:00 2001 -From: "Richard J. Moore" -Date: Thu, 23 Mar 2017 12:43:22 +0100 -Subject: [PATCH] QSslSocket: OpenSSL 1.1 backend -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -This patch-set implements a new QSslSocket backend based on OpenSSL 1.1. - -1. General. - -The code in this patch was organized to achieve these (somewhat contradicting) -objectives: -- keep the new code free of #if-ery, as far as possible; -- make it easy to clean away dead code when we're eventually able to retire - out-dated OpenSSL versions; -- reduce the amount of code duplication. - -If changes in some file/component were insignificant (~5 one-liners per file), -we still use pp-checks like: #if QT_CONFIG(opensslv11) ... #else ... #endif - -the logic is simple and it's still easy to clean the code if we remove the legacy -back-end. Where it saved #if-ery, we also introduced 'forward-compatible' -macros implementing equivalents of 1.1 functions using older OpenSSL. - -In case some class contains a lot of version-specific ifdefs (particularly where -nested #if-ery was complex) we choose to split code into: "pre11" h/cpp files, -"shared" h/cpp files (they preserve their original names, e.g qsslsocket_openssl.cpp) -and "11" h/cpp files. If in future we remove the legacy back-end, "pre11" should be -removed; "shared" and "11" parts - merged. - -2. Configuration. - -We introduced a new feature 'opensslv11' which complements the pre-existing -'openssl' and 'openssl-linked' features. The 'opensslv11' feature is enabled -by a simple test which either compiles successfully or ends in a compilation -error, depending on a value of the OPENSSL_VERSION_NUMBER constant. If the -feature was enabled, we also append an additional compilation flag --DOPENSSL_API_COMPAT=0x10100000L to make sure our new code does not contain -deprecated structures, function calls, macro-invocations from OpenSSL < 1.1. - -Change-Id: I2064efbe9685def5d2bb2233a66f7581954fb74a -Reviewed-by: AndrĂ© Klitzing -Reviewed-by: Allan Sandfeld Jensen ---- - config.tests/unix/openssl11/openssl.cpp | 48 +++ - config.tests/unix/openssl11/openssl.pro | 2 + - src/network/configure.json | 11 + - src/network/ssl/qsslcertificate_openssl.cpp | 57 +-- - src/network/ssl/qsslcontext_openssl.cpp | 309 +------------- - src/network/ssl/qsslcontext_openssl11.cpp | 277 ++++++++++++ - src/network/ssl/qsslcontext_opensslpre11.cpp | 354 ++++++++++++++++ - .../ssl/qssldiffiehellmanparameters_openssl.cpp | 38 +- - src/network/ssl/qsslellipticcurve.h | 1 + - src/network/ssl/qsslellipticcurve_openssl.cpp | 8 +- - src/network/ssl/qsslkey_openssl.cpp | 79 ++-- - src/network/ssl/qsslsocket_openssl.cpp | 368 ++-------------- - src/network/ssl/qsslsocket_openssl11.cpp | 285 +++++++++++++ - src/network/ssl/qsslsocket_openssl11_symbols_p.h | 132 ++++++ - src/network/ssl/qsslsocket_openssl_p.h | 8 +- - src/network/ssl/qsslsocket_openssl_symbols.cpp | 471 ++++++++++++++------- - src/network/ssl/qsslsocket_openssl_symbols_p.h | 117 +---- - src/network/ssl/qsslsocket_opensslpre11.cpp | 424 +++++++++++++++++++ - .../ssl/qsslsocket_opensslpre11_symbols_p.h | 230 ++++++++++ - src/network/ssl/ssl.pri | 18 +- - 20 files changed, 2280 insertions(+), 957 deletions(-) - create mode 100644 config.tests/unix/openssl11/openssl.cpp - create mode 100644 config.tests/unix/openssl11/openssl.pro - create mode 100644 src/network/ssl/qsslcontext_openssl11.cpp - create mode 100644 src/network/ssl/qsslcontext_opensslpre11.cpp - create mode 100644 src/network/ssl/qsslsocket_openssl11.cpp - create mode 100644 src/network/ssl/qsslsocket_openssl11_symbols_p.h - create mode 100644 src/network/ssl/qsslsocket_opensslpre11.cpp - create mode 100644 src/network/ssl/qsslsocket_opensslpre11_symbols_p.h - -Index: qtbase-opensource-src-5.9.2/config.tests/unix/openssl11/openssl.cpp -=================================================================== ---- /dev/null -+++ qtbase-opensource-src-5.9.2/config.tests/unix/openssl11/openssl.cpp -@@ -0,0 +1,48 @@ -+/**************************************************************************** -+** -+** Copyright (C) 2017 The Qt Company Ltd. -+** Contact: https://www.qt.io/licensing/ -+** -+** This file is part of the config.tests of the Qt Toolkit. -+** -+** $QT_BEGIN_LICENSE:LGPL$ -+** Commercial License Usage -+** Licensees holding valid commercial Qt licenses may use this file in -+** accordance with the commercial license agreement provided with the -+** Software or, alternatively, in accordance with the terms contained in -+** a written agreement between you and The Qt Company. For licensing terms -+** and conditions see https://www.qt.io/terms-conditions. For further -+** information use the contact form at https://www.qt.io/contact-us. -+** -+** GNU Lesser General Public License Usage -+** Alternatively, this file may be used under the terms of the GNU Lesser -+** General Public License version 3 as published by the Free Software -+** Foundation and appearing in the file LICENSE.LGPL3 included in the -+** packaging of this file. Please review the following information to -+** ensure the GNU Lesser General Public License version 3 requirements -+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -+** -+** GNU General Public License Usage -+** Alternatively, this file may be used under the terms of the GNU -+** General Public License version 2.0 or (at your option) the GNU General -+** Public license version 3 or any later version approved by the KDE Free -+** Qt Foundation. The licenses are as published by the Free Software -+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -+** included in the packaging of this file. Please review the following -+** information to ensure the GNU General Public License requirements will -+** be met: https://www.gnu.org/licenses/gpl-2.0.html and -+** https://www.gnu.org/licenses/gpl-3.0.html. -+** -+** $QT_END_LICENSE$ -+** -+****************************************************************************/ -+ -+#include -+ -+#if !defined(OPENSSL_VERSION_NUMBER) || OPENSSL_VERSION_NUMBER-0 < 0x10100000L -+# error "OpenSSL >= 1.1 is required" -+#endif -+ -+int main() -+{ -+} -Index: qtbase-opensource-src-5.9.2/config.tests/unix/openssl11/openssl.pro -=================================================================== ---- /dev/null -+++ qtbase-opensource-src-5.9.2/config.tests/unix/openssl11/openssl.pro -@@ -0,0 +1,2 @@ -+SOURCES = openssl.cpp -+CONFIG -= x11 qt -Index: qtbase-opensource-src-5.9.2/src/network/configure.json -=================================================================== ---- qtbase-opensource-src-5.9.2.orig/src/network/configure.json -+++ qtbase-opensource-src-5.9.2/src/network/configure.json -@@ -154,6 +154,12 @@ - ] - }, - "use": "network" -+ }, -+ "openssl11": { -+ "label": "OpenSSL v. 1.1 support", -+ "type": "compile", -+ "test": "unix/openssl11", -+ "use": "network" - } - }, - -@@ -221,6 +227,11 @@ - "condition": "config.winrt || features.securetransport || features.openssl", - "output": [ "publicFeature", "feature" ] - }, -+ "opensslv11": { -+ "label": "OpenSSL v. 1.1", -+ "condition": "tests.openssl11", -+ "output": ["publicFeature", "feature"] -+ }, - "sctp": { - "label": "SCTP", - "autoDetect": false, -Index: qtbase-opensource-src-5.9.2/src/network/ssl/qsslcertificate_openssl.cpp -=================================================================== ---- qtbase-opensource-src-5.9.2.orig/src/network/ssl/qsslcertificate_openssl.cpp -+++ qtbase-opensource-src-5.9.2/src/network/ssl/qsslcertificate_openssl.cpp -@@ -1,6 +1,7 @@ - /**************************************************************************** - ** --** Copyright (C) 2016 The Qt Company Ltd. -+** Copyright (C) 2017 The Qt Company Ltd. -+** Copyright (C) 2016 Richard J. Moore - ** Contact: https://www.qt.io/licensing/ - ** - ** This file is part of the QtNetwork module of the Qt Toolkit. -@@ -64,12 +65,14 @@ bool QSslCertificate::operator==(const Q - uint qHash(const QSslCertificate &key, uint seed) Q_DECL_NOTHROW - { - if (X509 * const x509 = key.d->x509) { -- (void)q_X509_cmp(x509, x509); // populate x509->sha1_hash -- // (if someone knows a better way...) -- return qHashBits(x509->sha1_hash, SHA_DIGEST_LENGTH, seed); -- } else { -- return seed; -+ const EVP_MD *sha1 = q_EVP_sha1(); -+ unsigned int len = 0; -+ unsigned char md[EVP_MAX_MD_SIZE]; -+ q_X509_digest(x509, sha1, md, &len); -+ return qHashBits(md, len, seed); - } -+ -+ return seed; - } - - bool QSslCertificate::isNull() const -@@ -89,8 +92,7 @@ QByteArray QSslCertificate::version() co - { - QMutexLocker lock(QMutexPool::globalInstanceGet(d.data())); - if (d->versionString.isEmpty() && d->x509) -- d->versionString = -- QByteArray::number(qlonglong(q_ASN1_INTEGER_get(d->x509->cert_info->version)) + 1); -+ d->versionString = QByteArray::number(qlonglong(q_X509_get_version(d->x509)) + 1); - - return d->versionString; - } -@@ -99,7 +101,7 @@ QByteArray QSslCertificate::serialNumber - { - QMutexLocker lock(QMutexPool::globalInstanceGet(d.data())); - if (d->serialNumberString.isEmpty() && d->x509) { -- ASN1_INTEGER *serialNumber = d->x509->cert_info->serialNumber; -+ ASN1_INTEGER *serialNumber = q_X509_get_serialNumber(d->x509); - QByteArray hexString; - hexString.reserve(serialNumber->length * 3); - for (int a = 0; a < serialNumber->length; ++a) { -@@ -199,14 +201,15 @@ QMultiMap(q_ASN1_STRING_data(genName->d.ia5)); -+ const char *altNameStr = reinterpret_cast(q_ASN1_STRING_get0_data(genName->d.ia5)); - const QString altName = QString::fromLatin1(altNameStr, len); - if (genName->type == GEN_DNS) - result.insert(QSsl::DnsEntry, altName); - else if (genName->type == GEN_EMAIL) - result.insert(QSsl::EmailEntry, altName); - } -- q_sk_pop_free((STACK*)altNames, reinterpret_cast(q_sk_free)); -+ -+ q_OPENSSL_sk_pop_free((OPENSSL_STACK*)altNames, reinterpret_cast(q_OPENSSL_sk_free)); - } - - return result; -@@ -235,25 +238,26 @@ QSslKey QSslCertificate::publicKey() con - QSslKey key; - - key.d->type = QSsl::PublicKey; -- X509_PUBKEY *xkey = d->x509->cert_info->key; -- EVP_PKEY *pkey = q_X509_PUBKEY_get(xkey); -+ -+ EVP_PKEY *pkey = q_X509_get_pubkey(d->x509); - Q_ASSERT(pkey); -+ const int keyType = q_EVP_PKEY_type(q_EVP_PKEY_base_id(pkey)); - -- if (q_EVP_PKEY_type(pkey->type) == EVP_PKEY_RSA) { -+ if (keyType == EVP_PKEY_RSA) { - key.d->rsa = q_EVP_PKEY_get1_RSA(pkey); - key.d->algorithm = QSsl::Rsa; - key.d->isNull = false; -- } else if (q_EVP_PKEY_type(pkey->type) == EVP_PKEY_DSA) { -+ } else if (keyType == EVP_PKEY_DSA) { - key.d->dsa = q_EVP_PKEY_get1_DSA(pkey); - key.d->algorithm = QSsl::Dsa; - key.d->isNull = false; - #ifndef OPENSSL_NO_EC -- } else if (q_EVP_PKEY_type(pkey->type) == EVP_PKEY_EC) { -+ } else if (keyType == EVP_PKEY_EC) { - key.d->ec = q_EVP_PKEY_get1_EC_KEY(pkey); - key.d->algorithm = QSsl::Ec; - key.d->isNull = false; - #endif -- } else if (q_EVP_PKEY_type(pkey->type) == EVP_PKEY_DH) { -+ } else if (keyType == EVP_PKEY_DH) { - // DH unsupported - } else { - // error? -@@ -275,7 +279,7 @@ static QVariant x509UnknownExtensionToVa - X509V3_EXT_METHOD *meth = const_cast(q_X509V3_EXT_get(ext)); - if (!meth) { - ASN1_OCTET_STRING *value = q_X509_EXTENSION_get_data(ext); -- QByteArray result( reinterpret_cast(q_ASN1_STRING_data(value)), -+ QByteArray result( reinterpret_cast(q_ASN1_STRING_get0_data(value)), - q_ASN1_STRING_length(value)); - return result; - } -@@ -371,7 +375,7 @@ static QVariant x509ExtensionToValue(X50 - continue; - } - -- const char *uriStr = reinterpret_cast(q_ASN1_STRING_data(name->d.uniformResourceIdentifier)); -+ const char *uriStr = reinterpret_cast(q_ASN1_STRING_get0_data(name->d.uniformResourceIdentifier)); - const QString uri = QString::fromUtf8(uriStr, len); - - result[QString::fromUtf8(QSslCertificatePrivate::asn1ObjectName(ad->method))] = uri; -@@ -380,11 +384,7 @@ static QVariant x509ExtensionToValue(X50 - } - } - --#if OPENSSL_VERSION_NUMBER >= 0x10000000L -- q_sk_pop_free((_STACK*)info, reinterpret_cast(q_sk_free)); --#else -- q_sk_pop_free((STACK*)info, reinterpret_cast(q_sk_free)); --#endif -+ q_OPENSSL_sk_pop_free((OPENSSL_STACK*)info, reinterpret_cast(q_OPENSSL_sk_free)); - return result; - } - break; -@@ -607,7 +607,11 @@ static QMap _q_mapF - unsigned char *data = 0; - int size = q_ASN1_STRING_to_UTF8(&data, q_X509_NAME_ENTRY_get_data(e)); - info.insertMulti(name, QString::fromUtf8((char*)data, size)); -+#if QT_CONFIG(opensslv11) -+ q_CRYPTO_free(data, 0, 0); -+#else - q_CRYPTO_free(data); -+#endif - } - - return info; -@@ -619,8 +623,9 @@ QSslCertificate QSslCertificatePrivate:: - if (!x509 || !QSslSocket::supportsSsl()) - return certificate; - -- ASN1_TIME *nbef = q_X509_get_notBefore(x509); -- ASN1_TIME *naft = q_X509_get_notAfter(x509); -+ ASN1_TIME *nbef = q_X509_getm_notBefore(x509); -+ ASN1_TIME *naft = q_X509_getm_notAfter(x509); -+ - certificate.d->notValidBefore = q_getTimeFromASN1(nbef); - certificate.d->notValidAfter = q_getTimeFromASN1(naft); - certificate.d->null = false; -Index: qtbase-opensource-src-5.9.2/src/network/ssl/qsslcontext_openssl.cpp -=================================================================== ---- qtbase-opensource-src-5.9.2.orig/src/network/ssl/qsslcontext_openssl.cpp -+++ qtbase-opensource-src-5.9.2/src/network/ssl/qsslcontext_openssl.cpp -@@ -1,6 +1,6 @@ - /**************************************************************************** - ** --** Copyright (C) 2016 The Qt Company Ltd. -+** Copyright (C) 2017 The Qt Company Ltd. - ** Copyright (C) 2014 BlackBerry Limited. All rights reserved. - ** Copyright (C) 2014 Governikus GmbH & Co. KG. - ** Contact: https://www.qt.io/licensing/ -@@ -41,22 +41,14 @@ - - - #include --#include --#include - - #include "private/qssl_p.h" - #include "private/qsslcontext_openssl_p.h" --#include "private/qsslsocket_p.h" - #include "private/qsslsocket_openssl_p.h" - #include "private/qsslsocket_openssl_symbols_p.h" --#include "private/qssldiffiehellmanparameters_p.h" - - QT_BEGIN_NAMESPACE - --// defined in qsslsocket_openssl.cpp: --extern int q_X509Callback(int ok, X509_STORE_CTX *ctx); --extern QString getErrorsFromOpenSsl(); -- - QSslContext::QSslContext() - : ctx(0), - pkey(0), -@@ -78,301 +70,6 @@ QSslContext::~QSslContext() - q_SSL_SESSION_free(session); - } - --static inline QString msgErrorSettingEllipticCurves(const QString &why) --{ -- return QSslSocket::tr("Error when setting the elliptic curves (%1)").arg(why); --} -- --// static --void QSslContext::initSslContext(QSslContext *sslContext, QSslSocket::SslMode mode, const QSslConfiguration &configuration, bool allowRootCertOnDemandLoading) --{ -- sslContext->sslConfiguration = configuration; -- sslContext->errorCode = QSslError::NoError; -- -- bool client = (mode == QSslSocket::SslClientMode); -- -- bool reinitialized = false; -- bool unsupportedProtocol = false; --init_context: -- switch (sslContext->sslConfiguration.protocol()) { -- case QSsl::SslV2: --#ifndef OPENSSL_NO_SSL2 -- sslContext->ctx = q_SSL_CTX_new(client ? q_SSLv2_client_method() : q_SSLv2_server_method()); --#else -- // SSL 2 not supported by the system, but chosen deliberately -> error -- sslContext->ctx = 0; -- unsupportedProtocol = true; --#endif -- break; -- case QSsl::SslV3: --#ifndef OPENSSL_NO_SSL3_METHOD -- sslContext->ctx = q_SSL_CTX_new(client ? q_SSLv3_client_method() : q_SSLv3_server_method()); --#else -- // SSL 3 not supported by the system, but chosen deliberately -> error -- sslContext->ctx = 0; -- unsupportedProtocol = true; --#endif -- break; -- case QSsl::SecureProtocols: -- // SSLv2 and SSLv3 will be disabled by SSL options -- // But we need q_SSLv23_server_method() otherwise AnyProtocol will be unable to connect on Win32. -- case QSsl::TlsV1SslV3: -- // SSLv2 will will be disabled by SSL options -- case QSsl::AnyProtocol: -- default: -- sslContext->ctx = q_SSL_CTX_new(client ? q_SSLv23_client_method() : q_SSLv23_server_method()); -- break; -- case QSsl::TlsV1_0: -- sslContext->ctx = q_SSL_CTX_new(client ? q_TLSv1_client_method() : q_TLSv1_server_method()); -- break; -- case QSsl::TlsV1_1: --#if OPENSSL_VERSION_NUMBER >= 0x10001000L -- sslContext->ctx = q_SSL_CTX_new(client ? q_TLSv1_1_client_method() : q_TLSv1_1_server_method()); --#else -- // TLS 1.1 not supported by the system, but chosen deliberately -> error -- sslContext->ctx = 0; -- unsupportedProtocol = true; --#endif -- break; -- case QSsl::TlsV1_2: --#if OPENSSL_VERSION_NUMBER >= 0x10001000L -- sslContext->ctx = q_SSL_CTX_new(client ? q_TLSv1_2_client_method() : q_TLSv1_2_server_method()); --#else -- // TLS 1.2 not supported by the system, but chosen deliberately -> error -- sslContext->ctx = 0; -- unsupportedProtocol = true; --#endif -- break; -- case QSsl::TlsV1_0OrLater: -- // Specific protocols will be specified via SSL options. -- sslContext->ctx = q_SSL_CTX_new(client ? q_SSLv23_client_method() : q_SSLv23_server_method()); -- break; -- case QSsl::TlsV1_1OrLater: -- case QSsl::TlsV1_2OrLater: --#if OPENSSL_VERSION_NUMBER >= 0x10001000L -- // Specific protocols will be specified via SSL options. -- sslContext->ctx = q_SSL_CTX_new(client ? q_SSLv23_client_method() : q_SSLv23_server_method()); --#else -- // TLS 1.1/1.2 not supported by the system, but chosen deliberately -> error -- sslContext->ctx = 0; -- unsupportedProtocol = true; --#endif -- break; -- } -- -- if (!sslContext->ctx) { -- // After stopping Flash 10 the SSL library looses its ciphers. Try re-adding them -- // by re-initializing the library. -- if (!reinitialized) { -- reinitialized = true; -- if (q_SSL_library_init() == 1) -- goto init_context; -- } -- -- sslContext->errorStr = QSslSocket::tr("Error creating SSL context (%1)").arg( -- unsupportedProtocol ? QSslSocket::tr("unsupported protocol") : QSslSocketBackendPrivate::getErrorsFromOpenSsl() -- ); -- sslContext->errorCode = QSslError::UnspecifiedError; -- return; -- } -- -- // Enable bug workarounds. -- long options = QSslSocketBackendPrivate::setupOpenSslOptions(configuration.protocol(), configuration.d->sslOptions); -- q_SSL_CTX_set_options(sslContext->ctx, options); -- --#if OPENSSL_VERSION_NUMBER >= 0x10000000L -- // Tell OpenSSL to release memory early -- // http://www.openssl.org/docs/ssl/SSL_CTX_set_mode.html -- if (q_SSLeay() >= 0x10000000L) -- q_SSL_CTX_set_mode(sslContext->ctx, SSL_MODE_RELEASE_BUFFERS); --#endif -- -- // Initialize ciphers -- QByteArray cipherString; -- bool first = true; -- QList ciphers = sslContext->sslConfiguration.ciphers(); -- if (ciphers.isEmpty()) -- ciphers = QSslSocketPrivate::defaultCiphers(); -- for (const QSslCipher &cipher : qAsConst(ciphers)) { -- if (first) -- first = false; -- else -- cipherString.append(':'); -- cipherString.append(cipher.name().toLatin1()); -- } -- -- if (!q_SSL_CTX_set_cipher_list(sslContext->ctx, cipherString.data())) { -- sslContext->errorStr = QSslSocket::tr("Invalid or empty cipher list (%1)").arg(QSslSocketBackendPrivate::getErrorsFromOpenSsl()); -- sslContext->errorCode = QSslError::UnspecifiedError; -- return; -- } -- -- const QDateTime now = QDateTime::currentDateTimeUtc(); -- -- // Add all our CAs to this store. -- const auto caCertificates = sslContext->sslConfiguration.caCertificates(); -- for (const QSslCertificate &caCertificate : caCertificates) { -- // From https://www.openssl.org/docs/ssl/SSL_CTX_load_verify_locations.html: -- // -- // If several CA certificates matching the name, key identifier, and -- // serial number condition are available, only the first one will be -- // examined. This may lead to unexpected results if the same CA -- // certificate is available with different expiration dates. If a -- // ``certificate expired'' verification error occurs, no other -- // certificate will be searched. Make sure to not have expired -- // certificates mixed with valid ones. -- // -- // See also: QSslSocketBackendPrivate::verify() -- if (caCertificate.expiryDate() >= now) { -- q_X509_STORE_add_cert(q_SSL_CTX_get_cert_store(sslContext->ctx), (X509 *)caCertificate.handle()); -- } -- } -- -- if (QSslSocketPrivate::s_loadRootCertsOnDemand && allowRootCertOnDemandLoading) { -- // tell OpenSSL the directories where to look up the root certs on demand -- const QList unixDirs = QSslSocketPrivate::unixRootCertDirectories(); -- for (const QByteArray &unixDir : unixDirs) -- q_SSL_CTX_load_verify_locations(sslContext->ctx, 0, unixDir.constData()); -- } -- -- if (!sslContext->sslConfiguration.localCertificate().isNull()) { -- // Require a private key as well. -- if (sslContext->sslConfiguration.privateKey().isNull()) { -- sslContext->errorStr = QSslSocket::tr("Cannot provide a certificate with no key, %1").arg(QSslSocketBackendPrivate::getErrorsFromOpenSsl()); -- sslContext->errorCode = QSslError::UnspecifiedError; -- return; -- } -- -- // Load certificate -- if (!q_SSL_CTX_use_certificate(sslContext->ctx, (X509 *)sslContext->sslConfiguration.localCertificate().handle())) { -- sslContext->errorStr = QSslSocket::tr("Error loading local certificate, %1").arg(QSslSocketBackendPrivate::getErrorsFromOpenSsl()); -- sslContext->errorCode = QSslError::UnspecifiedError; -- return; -- } -- -- if (configuration.d->privateKey.algorithm() == QSsl::Opaque) { -- sslContext->pkey = reinterpret_cast(configuration.d->privateKey.handle()); -- } else { -- // Load private key -- sslContext->pkey = q_EVP_PKEY_new(); -- // before we were using EVP_PKEY_assign_R* functions and did not use EVP_PKEY_free. -- // this lead to a memory leak. Now we use the *_set1_* functions which do not -- // take ownership of the RSA/DSA key instance because the QSslKey already has ownership. -- if (configuration.d->privateKey.algorithm() == QSsl::Rsa) -- q_EVP_PKEY_set1_RSA(sslContext->pkey, reinterpret_cast(configuration.d->privateKey.handle())); -- else if (configuration.d->privateKey.algorithm() == QSsl::Dsa) -- q_EVP_PKEY_set1_DSA(sslContext->pkey, reinterpret_cast(configuration.d->privateKey.handle())); --#ifndef OPENSSL_NO_EC -- else if (configuration.d->privateKey.algorithm() == QSsl::Ec) -- q_EVP_PKEY_set1_EC_KEY(sslContext->pkey, reinterpret_cast(configuration.d->privateKey.handle())); --#endif -- } -- -- if (!q_SSL_CTX_use_PrivateKey(sslContext->ctx, sslContext->pkey)) { -- sslContext->errorStr = QSslSocket::tr("Error loading private key, %1").arg(QSslSocketBackendPrivate::getErrorsFromOpenSsl()); -- sslContext->errorCode = QSslError::UnspecifiedError; -- return; -- } -- if (configuration.d->privateKey.algorithm() == QSsl::Opaque) -- sslContext->pkey = 0; // Don't free the private key, it belongs to QSslKey -- -- // Check if the certificate matches the private key. -- if (!q_SSL_CTX_check_private_key(sslContext->ctx)) { -- sslContext->errorStr = QSslSocket::tr("Private key does not certify public key, %1").arg(QSslSocketBackendPrivate::getErrorsFromOpenSsl()); -- sslContext->errorCode = QSslError::UnspecifiedError; -- return; -- } -- -- // If we have any intermediate certificates then we need to add them to our chain -- bool first = true; -- for (const QSslCertificate &cert : qAsConst(configuration.d->localCertificateChain)) { -- if (first) { -- first = false; -- continue; -- } -- q_SSL_CTX_ctrl(sslContext->ctx, SSL_CTRL_EXTRA_CHAIN_CERT, 0, -- q_X509_dup(reinterpret_cast(cert.handle()))); -- } -- } -- -- // Initialize peer verification. -- if (sslContext->sslConfiguration.peerVerifyMode() == QSslSocket::VerifyNone) { -- q_SSL_CTX_set_verify(sslContext->ctx, SSL_VERIFY_NONE, 0); -- } else { -- q_SSL_CTX_set_verify(sslContext->ctx, SSL_VERIFY_PEER, q_X509Callback); -- } -- -- // Set verification depth. -- if (sslContext->sslConfiguration.peerVerifyDepth() != 0) -- q_SSL_CTX_set_verify_depth(sslContext->ctx, sslContext->sslConfiguration.peerVerifyDepth()); -- -- // set persisted session if the user set it -- if (!configuration.sessionTicket().isEmpty()) -- sslContext->setSessionASN1(configuration.sessionTicket()); -- -- // Set temp DH params -- QSslDiffieHellmanParameters dhparams = configuration.diffieHellmanParameters(); -- -- if (!dhparams.isValid()) { -- sslContext->errorStr = QSslSocket::tr("Diffie-Hellman parameters are not valid"); -- sslContext->errorCode = QSslError::UnspecifiedError; -- return; -- } -- -- if (!dhparams.isEmpty()) { -- const QByteArray ¶ms = dhparams.d->derData; -- const char *ptr = params.constData(); -- DH *dh = q_d2i_DHparams(NULL, reinterpret_cast(&ptr), params.length()); -- if (dh == NULL) -- qFatal("q_d2i_DHparams failed to convert QSslDiffieHellmanParameters to DER form"); -- q_SSL_CTX_set_tmp_dh(sslContext->ctx, dh); -- q_DH_free(dh); -- } -- --#ifndef OPENSSL_NO_EC --#if OPENSSL_VERSION_NUMBER >= 0x10002000L -- if (q_SSLeay() >= 0x10002000L) { -- q_SSL_CTX_ctrl(sslContext->ctx, SSL_CTRL_SET_ECDH_AUTO, 1, NULL); -- } else --#endif -- { -- // Set temp ECDH params -- EC_KEY *ecdh = 0; -- ecdh = q_EC_KEY_new_by_curve_name(NID_X9_62_prime256v1); -- q_SSL_CTX_set_tmp_ecdh(sslContext->ctx, ecdh); -- q_EC_KEY_free(ecdh); -- } --#endif // OPENSSL_NO_EC -- --#if OPENSSL_VERSION_NUMBER >= 0x10001000L && !defined(OPENSSL_NO_PSK) -- if (!client) -- q_SSL_CTX_use_psk_identity_hint(sslContext->ctx, sslContext->sslConfiguration.preSharedKeyIdentityHint().constData()); --#endif // OPENSSL_VERSION_NUMBER >= 0x10001000L && !defined(OPENSSL_NO_PSK) -- -- const QVector qcurves = sslContext->sslConfiguration.ellipticCurves(); -- if (!qcurves.isEmpty()) { --#if OPENSSL_VERSION_NUMBER >= 0x10002000L && !defined(OPENSSL_NO_EC) -- // Set the curves to be used -- if (q_SSLeay() >= 0x10002000L) { -- // SSL_CTX_ctrl wants a non-const pointer as last argument, -- // but let's avoid a copy into a temporary array -- if (!q_SSL_CTX_ctrl(sslContext->ctx, -- SSL_CTRL_SET_CURVES, -- qcurves.size(), -- const_cast(reinterpret_cast(qcurves.data())))) { -- sslContext->errorStr = msgErrorSettingEllipticCurves(QSslSocketBackendPrivate::getErrorsFromOpenSsl()); -- sslContext->errorCode = QSslError::UnspecifiedError; -- } -- } else --#endif // OPENSSL_VERSION_NUMBER >= 0x10002000L && !defined(OPENSSL_NO_EC) -- { -- // specific curves requested, but not possible to set -> error -- sslContext->errorStr = msgErrorSettingEllipticCurves(QSslSocket::tr("OpenSSL version too old, need at least v1.0.2")); -- sslContext->errorCode = QSslError::UnspecifiedError; -- } -- } --} -- - QSslContext* QSslContext::fromConfiguration(QSslSocket::SslMode mode, const QSslConfiguration &configuration, bool allowRootCertOnDemandLoading) - { - QSslContext *sslContext = new QSslContext(); -@@ -463,7 +160,7 @@ SSL* QSslContext::createSsl() - m_npnContext.len = m_supportedNPNVersions.count(); - m_npnContext.status = QSslConfiguration::NextProtocolNegotiationNone; - #if OPENSSL_VERSION_NUMBER >= 0x10002000L -- if (q_SSLeay() >= 0x10002000L) { -+ if (QSslSocket::sslLibraryVersionNumber() >= 0x10002000L) { - // Callback's type has a parameter 'const unsigned char ** out' - // since it was introduced in 1.0.2. Internally, OpenSSL's own code - // (tests/examples) cast it to unsigned char * (since it's 'out'). -@@ -508,7 +205,7 @@ bool QSslContext::cacheSession(SSL* ssl) - unsigned char *data = reinterpret_cast(m_sessionASN1.data()); - if (!q_i2d_SSL_SESSION(session, &data)) - qCWarning(lcSsl, "could not store persistent version of SSL session"); -- m_sessionTicketLifeTimeHint = session->tlsext_tick_lifetime_hint; -+ m_sessionTicketLifeTimeHint = q_SSL_SESSION_get_ticket_lifetime_hint(session); - } - } - -Index: qtbase-opensource-src-5.9.2/src/network/ssl/qsslcontext_openssl11.cpp -=================================================================== ---- /dev/null -+++ qtbase-opensource-src-5.9.2/src/network/ssl/qsslcontext_openssl11.cpp -@@ -0,0 +1,277 @@ -+/**************************************************************************** -+** -+** Copyright (C) 2017 The Qt Company Ltd. -+** Copyright (C) 2014 BlackBerry Limited. All rights reserved. -+** Copyright (C) 2014 Governikus GmbH & Co. KG. -+** Copyright (C) 2016 Richard J. Moore -+** Contact: https://www.qt.io/licensing/ -+** -+** This file is part of the QtNetwork module of the Qt Toolkit. -+** -+** $QT_BEGIN_LICENSE:LGPL$ -+** Commercial License Usage -+** Licensees holding valid commercial Qt licenses may use this file in -+** accordance with the commercial license agreement provided with the -+** Software or, alternatively, in accordance with the terms contained in -+** a written agreement between you and The Qt Company. For licensing terms -+** and conditions see https://www.qt.io/terms-conditions. For further -+** information use the contact form at https://www.qt.io/contact-us. -+** -+** GNU Lesser General Public License Usage -+** Alternatively, this file may be used under the terms of the GNU Lesser -+** General Public License version 3 as published by the Free Software -+** Foundation and appearing in the file LICENSE.LGPL3 included in the -+** packaging of this file. Please review the following information to -+** ensure the GNU Lesser General Public License version 3 requirements -+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -+** -+** GNU General Public License Usage -+** Alternatively, this file may be used under the terms of the GNU -+** General Public License version 2.0 or (at your option) the GNU General -+** Public license version 3 or any later version approved by the KDE Free -+** Qt Foundation. The licenses are as published by the Free Software -+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -+** included in the packaging of this file. Please review the following -+** information to ensure the GNU General Public License requirements will -+** be met: https://www.gnu.org/licenses/gpl-2.0.html and -+** https://www.gnu.org/licenses/gpl-3.0.html. -+** -+** $QT_END_LICENSE$ -+** -+****************************************************************************/ -+ -+ -+#include -+#include -+ -+#include "private/qssl_p.h" -+#include "private/qsslcontext_openssl_p.h" -+#include "private/qsslsocket_p.h" -+#include "private/qsslsocket_openssl_p.h" -+#include "private/qsslsocket_openssl_symbols_p.h" -+#include "private/qssldiffiehellmanparameters_p.h" -+ -+#include -+ -+QT_BEGIN_NAMESPACE -+ -+// defined in qsslsocket_openssl.cpp: -+extern int q_X509Callback(int ok, X509_STORE_CTX *ctx); -+extern QString getErrorsFromOpenSsl(); -+ -+static inline QString msgErrorSettingEllipticCurves(const QString &why) -+{ -+ return QSslSocket::tr("Error when setting the elliptic curves (%1)").arg(why); -+} -+ -+// static -+void QSslContext::initSslContext(QSslContext *sslContext, QSslSocket::SslMode mode, const QSslConfiguration &configuration, bool allowRootCertOnDemandLoading) -+{ -+ sslContext->sslConfiguration = configuration; -+ sslContext->errorCode = QSslError::NoError; -+ -+ bool client = (mode == QSslSocket::SslClientMode); -+ -+ bool reinitialized = false; -+ bool unsupportedProtocol = false; -+init_context: -+ if (sslContext->sslConfiguration.protocol() == QSsl::SslV2) { -+ // SSL 2 is no longer supported, but chosen deliberately -> error -+ sslContext->ctx = nullptr; -+ unsupportedProtocol = true; -+ } else { -+ // The ssl options will actually control the supported methods -+ sslContext->ctx = q_SSL_CTX_new(client ? q_TLS_client_method() : q_TLS_server_method()); -+ } -+ -+ if (!sslContext->ctx) { -+ // After stopping Flash 10 the SSL library loses its ciphers. Try re-adding them -+ // by re-initializing the library. -+ if (!reinitialized) { -+ reinitialized = true; -+ if (q_OPENSSL_init_ssl(0, nullptr) == 1) -+ goto init_context; -+ } -+ -+ sslContext->errorStr = QSslSocket::tr("Error creating SSL context (%1)").arg( -+ unsupportedProtocol ? QSslSocket::tr("unsupported protocol") : QSslSocketBackendPrivate::getErrorsFromOpenSsl() -+ ); -+ sslContext->errorCode = QSslError::UnspecifiedError; -+ return; -+ } -+ -+ // Enable bug workarounds. -+ long options = QSslSocketBackendPrivate::setupOpenSslOptions(configuration.protocol(), configuration.d->sslOptions); -+ q_SSL_CTX_set_options(sslContext->ctx, options); -+ -+ // Tell OpenSSL to release memory early -+ // http://www.openssl.org/docs/ssl/SSL_CTX_set_mode.html -+ q_SSL_CTX_set_mode(sslContext->ctx, SSL_MODE_RELEASE_BUFFERS); -+ -+ // Initialize ciphers -+ QByteArray cipherString; -+ bool first = true; -+ QList ciphers = sslContext->sslConfiguration.ciphers(); -+ if (ciphers.isEmpty()) -+ ciphers = QSslSocketPrivate::defaultCiphers(); -+ for (const QSslCipher &cipher : qAsConst(ciphers)) { -+ if (first) -+ first = false; -+ else -+ cipherString.append(':'); -+ cipherString.append(cipher.name().toLatin1()); -+ } -+ -+ if (!q_SSL_CTX_set_cipher_list(sslContext->ctx, cipherString.data())) { -+ sslContext->errorStr = QSslSocket::tr("Invalid or empty cipher list (%1)").arg(QSslSocketBackendPrivate::getErrorsFromOpenSsl()); -+ sslContext->errorCode = QSslError::UnspecifiedError; -+ return; -+ } -+ -+ const QDateTime now = QDateTime::currentDateTimeUtc(); -+ -+ // Add all our CAs to this store. -+ const auto caCertificates = sslContext->sslConfiguration.caCertificates(); -+ for (const QSslCertificate &caCertificate : caCertificates) { -+ // From https://www.openssl.org/docs/ssl/SSL_CTX_load_verify_locations.html: -+ // -+ // If several CA certificates matching the name, key identifier, and -+ // serial number condition are available, only the first one will be -+ // examined. This may lead to unexpected results if the same CA -+ // certificate is available with different expiration dates. If a -+ // ``certificate expired'' verification error occurs, no other -+ // certificate will be searched. Make sure to not have expired -+ // certificates mixed with valid ones. -+ // -+ // See also: QSslSocketBackendPrivate::verify() -+ if (caCertificate.expiryDate() >= now) { -+ q_X509_STORE_add_cert(q_SSL_CTX_get_cert_store(sslContext->ctx), (X509 *)caCertificate.handle()); -+ } -+ } -+ -+ if (QSslSocketPrivate::s_loadRootCertsOnDemand && allowRootCertOnDemandLoading) { -+ // tell OpenSSL the directories where to look up the root certs on demand -+ const QList unixDirs = QSslSocketPrivate::unixRootCertDirectories(); -+ for (const QByteArray &unixDir : unixDirs) -+ q_SSL_CTX_load_verify_locations(sslContext->ctx, nullptr, unixDir.constData()); -+ } -+ -+ if (!sslContext->sslConfiguration.localCertificate().isNull()) { -+ // Require a private key as well. -+ if (sslContext->sslConfiguration.privateKey().isNull()) { -+ sslContext->errorStr = QSslSocket::tr("Cannot provide a certificate with no key, %1").arg(QSslSocketBackendPrivate::getErrorsFromOpenSsl()); -+ sslContext->errorCode = QSslError::UnspecifiedError; -+ return; -+ } -+ -+ // Load certificate -+ if (!q_SSL_CTX_use_certificate(sslContext->ctx, (X509 *)sslContext->sslConfiguration.localCertificate().handle())) { -+ sslContext->errorStr = QSslSocket::tr("Error loading local certificate, %1").arg(QSslSocketBackendPrivate::getErrorsFromOpenSsl()); -+ sslContext->errorCode = QSslError::UnspecifiedError; -+ return; -+ } -+ -+ if (configuration.d->privateKey.algorithm() == QSsl::Opaque) { -+ sslContext->pkey = reinterpret_cast(configuration.d->privateKey.handle()); -+ } else { -+ // Load private key -+ sslContext->pkey = q_EVP_PKEY_new(); -+ // before we were using EVP_PKEY_assign_R* functions and did not use EVP_PKEY_free. -+ // this lead to a memory leak. Now we use the *_set1_* functions which do not -+ // take ownership of the RSA/DSA key instance because the QSslKey already has ownership. -+ if (configuration.d->privateKey.algorithm() == QSsl::Rsa) -+ q_EVP_PKEY_set1_RSA(sslContext->pkey, reinterpret_cast(configuration.d->privateKey.handle())); -+ else if (configuration.d->privateKey.algorithm() == QSsl::Dsa) -+ q_EVP_PKEY_set1_DSA(sslContext->pkey, reinterpret_cast(configuration.d->privateKey.handle())); -+#ifndef OPENSSL_NO_EC -+ else if (configuration.d->privateKey.algorithm() == QSsl::Ec) -+ q_EVP_PKEY_set1_EC_KEY(sslContext->pkey, reinterpret_cast(configuration.d->privateKey.handle())); -+#endif -+ } -+ -+ if (!q_SSL_CTX_use_PrivateKey(sslContext->ctx, sslContext->pkey)) { -+ sslContext->errorStr = QSslSocket::tr("Error loading private key, %1").arg(QSslSocketBackendPrivate::getErrorsFromOpenSsl()); -+ sslContext->errorCode = QSslError::UnspecifiedError; -+ return; -+ } -+ if (configuration.d->privateKey.algorithm() == QSsl::Opaque) -+ sslContext->pkey = nullptr; // Don't free the private key, it belongs to QSslKey -+ -+ // Check if the certificate matches the private key. -+ if (!q_SSL_CTX_check_private_key(sslContext->ctx)) { -+ sslContext->errorStr = QSslSocket::tr("Private key does not certify public key, %1").arg(QSslSocketBackendPrivate::getErrorsFromOpenSsl()); -+ sslContext->errorCode = QSslError::UnspecifiedError; -+ return; -+ } -+ -+ // If we have any intermediate certificates then we need to add them to our chain -+ bool first = true; -+ for (const QSslCertificate &cert : qAsConst(configuration.d->localCertificateChain)) { -+ if (first) { -+ first = false; -+ continue; -+ } -+ q_SSL_CTX_ctrl(sslContext->ctx, SSL_CTRL_EXTRA_CHAIN_CERT, 0, -+ q_X509_dup(reinterpret_cast(cert.handle()))); -+ } -+ } -+ -+ // Initialize peer verification. -+ if (sslContext->sslConfiguration.peerVerifyMode() == QSslSocket::VerifyNone) { -+ q_SSL_CTX_set_verify(sslContext->ctx, SSL_VERIFY_NONE, nullptr); -+ } else { -+ q_SSL_CTX_set_verify(sslContext->ctx, SSL_VERIFY_PEER, q_X509Callback); -+ } -+ -+ // Set verification depth. -+ if (sslContext->sslConfiguration.peerVerifyDepth() != 0) -+ q_SSL_CTX_set_verify_depth(sslContext->ctx, sslContext->sslConfiguration.peerVerifyDepth()); -+ -+ // set persisted session if the user set it -+ if (!configuration.sessionTicket().isEmpty()) -+ sslContext->setSessionASN1(configuration.sessionTicket()); -+ -+ // Set temp DH params -+ QSslDiffieHellmanParameters dhparams = configuration.diffieHellmanParameters(); -+ -+ if (!dhparams.isValid()) { -+ sslContext->errorStr = QSslSocket::tr("Diffie-Hellman parameters are not valid"); -+ sslContext->errorCode = QSslError::UnspecifiedError; -+ return; -+ } -+ -+ if (!dhparams.isEmpty()) { -+ const QByteArray ¶ms = dhparams.d->derData; -+ const char *ptr = params.constData(); -+ DH *dh = q_d2i_DHparams(NULL, reinterpret_cast(&ptr), params.length()); -+ if (dh == NULL) -+ qFatal("q_d2i_DHparams failed to convert QSslDiffieHellmanParameters to DER form"); -+ q_SSL_CTX_set_tmp_dh(sslContext->ctx, dh); -+ q_DH_free(dh); -+ } -+ -+#ifndef OPENSSL_NO_PSK -+ if (!client) -+ q_SSL_CTX_use_psk_identity_hint(sslContext->ctx, sslContext->sslConfiguration.preSharedKeyIdentityHint().constData()); -+#endif // !OPENSSL_NO_PSK -+ -+ const QVector qcurves = sslContext->sslConfiguration.ellipticCurves(); -+ if (!qcurves.isEmpty()) { -+#ifdef OPENSSL_NO_EC -+ sslContext->errorStr = msgErrorSettingEllipticCurves(QSslSocket::tr("OpenSSL version with disabled elliptic curves")); -+ sslContext->errorCode = QSslError::UnspecifiedError; -+#else -+ // Set the curves to be used. -+ std::vector curves; -+ curves.reserve(qcurves.size()); -+ for (const auto &sslCurve : qcurves) -+ curves.push_back(sslCurve.id); -+ if (!q_SSL_CTX_ctrl(sslContext->ctx, SSL_CTRL_SET_CURVES, long(curves.size()), &curves[0])) { -+ sslContext->errorStr = msgErrorSettingEllipticCurves(QSslSocketBackendPrivate::getErrorsFromOpenSsl()); -+ sslContext->errorCode = QSslError::UnspecifiedError; -+ } -+#endif -+ } -+} -+ -+QT_END_NAMESPACE -Index: qtbase-opensource-src-5.9.2/src/network/ssl/qsslcontext_opensslpre11.cpp -=================================================================== ---- /dev/null -+++ qtbase-opensource-src-5.9.2/src/network/ssl/qsslcontext_opensslpre11.cpp -@@ -0,0 +1,354 @@ -+/**************************************************************************** -+** -+** Copyright (C) 2017 The Qt Company Ltd. -+** Copyright (C) 2014 BlackBerry Limited. All rights reserved. -+** Copyright (C) 2014 Governikus GmbH & Co. KG. -+** Contact: https://www.qt.io/licensing/ -+** -+** This file is part of the QtNetwork module of the Qt Toolkit. -+** -+** $QT_BEGIN_LICENSE:LGPL$ -+** Commercial License Usage -+** Licensees holding valid commercial Qt licenses may use this file in -+** accordance with the commercial license agreement provided with the -+** Software or, alternatively, in accordance with the terms contained in -+** a written agreement between you and The Qt Company. For licensing terms -+** and conditions see https://www.qt.io/terms-conditions. For further -+** information use the contact form at https://www.qt.io/contact-us. -+** -+** GNU Lesser General Public License Usage -+** Alternatively, this file may be used under the terms of the GNU Lesser -+** General Public License version 3 as published by the Free Software -+** Foundation and appearing in the file LICENSE.LGPL3 included in the -+** packaging of this file. Please review the following information to -+** ensure the GNU Lesser General Public License version 3 requirements -+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -+** -+** GNU General Public License Usage -+** Alternatively, this file may be used under the terms of the GNU -+** General Public License version 2.0 or (at your option) the GNU General -+** Public license version 3 or any later version approved by the KDE Free -+** Qt Foundation. The licenses are as published by the Free Software -+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -+** included in the packaging of this file. Please review the following -+** information to ensure the GNU General Public License requirements will -+** be met: https://www.gnu.org/licenses/gpl-2.0.html and -+** https://www.gnu.org/licenses/gpl-3.0.html. -+** -+** $QT_END_LICENSE$ -+** -+****************************************************************************/ -+ -+ -+#include -+#include -+ -+#include "private/qssl_p.h" -+#include "private/qsslcontext_openssl_p.h" -+#include "private/qsslsocket_p.h" -+#include "private/qsslsocket_openssl_p.h" -+#include "private/qsslsocket_openssl_symbols_p.h" -+#include "private/qssldiffiehellmanparameters_p.h" -+ -+QT_BEGIN_NAMESPACE -+ -+// defined in qsslsocket_openssl.cpp: -+extern int q_X509Callback(int ok, X509_STORE_CTX *ctx); -+extern QString getErrorsFromOpenSsl(); -+ -+static inline QString msgErrorSettingEllipticCurves(const QString &why) -+{ -+ return QSslSocket::tr("Error when setting the elliptic curves (%1)").arg(why); -+} -+ -+// static -+void QSslContext::initSslContext(QSslContext *sslContext, QSslSocket::SslMode mode, const QSslConfiguration &configuration, bool allowRootCertOnDemandLoading) -+{ -+ sslContext->sslConfiguration = configuration; -+ sslContext->errorCode = QSslError::NoError; -+ -+ bool client = (mode == QSslSocket::SslClientMode); -+ -+ bool reinitialized = false; -+ bool unsupportedProtocol = false; -+init_context: -+ switch (sslContext->sslConfiguration.protocol()) { -+ case QSsl::SslV2: -+#ifndef OPENSSL_NO_SSL2 -+ sslContext->ctx = q_SSL_CTX_new(client ? q_SSLv2_client_method() : q_SSLv2_server_method()); -+#else -+ // SSL 2 not supported by the system, but chosen deliberately -> error -+ sslContext->ctx = 0; -+ unsupportedProtocol = true; -+#endif -+ break; -+ case QSsl::SslV3: -+#ifndef OPENSSL_NO_SSL3_METHOD -+ sslContext->ctx = q_SSL_CTX_new(client ? q_SSLv3_client_method() : q_SSLv3_server_method()); -+#else -+ // SSL 3 not supported by the system, but chosen deliberately -> error -+ sslContext->ctx = 0; -+ unsupportedProtocol = true; -+#endif -+ break; -+ case QSsl::SecureProtocols: -+ // SSLv2 and SSLv3 will be disabled by SSL options -+ // But we need q_SSLv23_server_method() otherwise AnyProtocol will be unable to connect on Win32. -+ case QSsl::TlsV1SslV3: -+ // SSLv2 will will be disabled by SSL options -+ case QSsl::AnyProtocol: -+ default: -+ sslContext->ctx = q_SSL_CTX_new(client ? q_SSLv23_client_method() : q_SSLv23_server_method()); -+ break; -+ case QSsl::TlsV1_0: -+ sslContext->ctx = q_SSL_CTX_new(client ? q_TLSv1_client_method() : q_TLSv1_server_method()); -+ break; -+ case QSsl::TlsV1_1: -+#if OPENSSL_VERSION_NUMBER >= 0x10001000L -+ sslContext->ctx = q_SSL_CTX_new(client ? q_TLSv1_1_client_method() : q_TLSv1_1_server_method()); -+#else -+ // TLS 1.1 not supported by the system, but chosen deliberately -> error -+ sslContext->ctx = 0; -+ unsupportedProtocol = true; -+#endif -+ break; -+ case QSsl::TlsV1_2: -+#if OPENSSL_VERSION_NUMBER >= 0x10001000L -+ sslContext->ctx = q_SSL_CTX_new(client ? q_TLSv1_2_client_method() : q_TLSv1_2_server_method()); -+#else -+ // TLS 1.2 not supported by the system, but chosen deliberately -> error -+ sslContext->ctx = 0; -+ unsupportedProtocol = true; -+#endif -+ break; -+ case QSsl::TlsV1_0OrLater: -+ // Specific protocols will be specified via SSL options. -+ sslContext->ctx = q_SSL_CTX_new(client ? q_SSLv23_client_method() : q_SSLv23_server_method()); -+ break; -+ case QSsl::TlsV1_1OrLater: -+ case QSsl::TlsV1_2OrLater: -+#if OPENSSL_VERSION_NUMBER >= 0x10001000L -+ // Specific protocols will be specified via SSL options. -+ sslContext->ctx = q_SSL_CTX_new(client ? q_SSLv23_client_method() : q_SSLv23_server_method()); -+#else -+ // TLS 1.1/1.2 not supported by the system, but chosen deliberately -> error -+ sslContext->ctx = 0; -+ unsupportedProtocol = true; -+#endif -+ break; -+ } -+ -+ if (!sslContext->ctx) { -+ // After stopping Flash 10 the SSL library loses its ciphers. Try re-adding them -+ // by re-initializing the library. -+ if (!reinitialized) { -+ reinitialized = true; -+ if (q_SSL_library_init() == 1) -+ goto init_context; -+ } -+ -+ sslContext->errorStr = QSslSocket::tr("Error creating SSL context (%1)").arg( -+ unsupportedProtocol ? QSslSocket::tr("unsupported protocol") : QSslSocketBackendPrivate::getErrorsFromOpenSsl() -+ ); -+ sslContext->errorCode = QSslError::UnspecifiedError; -+ return; -+ } -+ -+ // Enable bug workarounds. -+ long options = QSslSocketBackendPrivate::setupOpenSslOptions(configuration.protocol(), configuration.d->sslOptions); -+ q_SSL_CTX_set_options(sslContext->ctx, options); -+ -+#if OPENSSL_VERSION_NUMBER >= 0x10000000L -+ // Tell OpenSSL to release memory early -+ // http://www.openssl.org/docs/ssl/SSL_CTX_set_mode.html -+ if (q_SSLeay() >= 0x10000000L) -+ q_SSL_CTX_set_mode(sslContext->ctx, SSL_MODE_RELEASE_BUFFERS); -+#endif -+ -+ // Initialize ciphers -+ QByteArray cipherString; -+ bool first = true; -+ QList ciphers = sslContext->sslConfiguration.ciphers(); -+ if (ciphers.isEmpty()) -+ ciphers = QSslSocketPrivate::defaultCiphers(); -+ for (const QSslCipher &cipher : qAsConst(ciphers)) { -+ if (first) -+ first = false; -+ else -+ cipherString.append(':'); -+ cipherString.append(cipher.name().toLatin1()); -+ } -+ -+ if (!q_SSL_CTX_set_cipher_list(sslContext->ctx, cipherString.data())) { -+ sslContext->errorStr = QSslSocket::tr("Invalid or empty cipher list (%1)").arg(QSslSocketBackendPrivate::getErrorsFromOpenSsl()); -+ sslContext->errorCode = QSslError::UnspecifiedError; -+ return; -+ } -+ -+ const QDateTime now = QDateTime::currentDateTimeUtc(); -+ -+ // Add all our CAs to this store. -+ const auto caCertificates = sslContext->sslConfiguration.caCertificates(); -+ for (const QSslCertificate &caCertificate : caCertificates) { -+ // From https://www.openssl.org/docs/ssl/SSL_CTX_load_verify_locations.html: -+ // -+ // If several CA certificates matching the name, key identifier, and -+ // serial number condition are available, only the first one will be -+ // examined. This may lead to unexpected results if the same CA -+ // certificate is available with different expiration dates. If a -+ // ``certificate expired'' verification error occurs, no other -+ // certificate will be searched. Make sure to not have expired -+ // certificates mixed with valid ones. -+ // -+ // See also: QSslSocketBackendPrivate::verify() -+ if (caCertificate.expiryDate() >= now) { -+ q_X509_STORE_add_cert(q_SSL_CTX_get_cert_store(sslContext->ctx), (X509 *)caCertificate.handle()); -+ } -+ } -+ -+ if (QSslSocketPrivate::s_loadRootCertsOnDemand && allowRootCertOnDemandLoading) { -+ // tell OpenSSL the directories where to look up the root certs on demand -+ const QList unixDirs = QSslSocketPrivate::unixRootCertDirectories(); -+ for (const QByteArray &unixDir : unixDirs) -+ q_SSL_CTX_load_verify_locations(sslContext->ctx, 0, unixDir.constData()); -+ } -+ -+ if (!sslContext->sslConfiguration.localCertificate().isNull()) { -+ // Require a private key as well. -+ if (sslContext->sslConfiguration.privateKey().isNull()) { -+ sslContext->errorStr = QSslSocket::tr("Cannot provide a certificate with no key, %1").arg(QSslSocketBackendPrivate::getErrorsFromOpenSsl()); -+ sslContext->errorCode = QSslError::UnspecifiedError; -+ return; -+ } -+ -+ // Load certificate -+ if (!q_SSL_CTX_use_certificate(sslContext->ctx, (X509 *)sslContext->sslConfiguration.localCertificate().handle())) { -+ sslContext->errorStr = QSslSocket::tr("Error loading local certificate, %1").arg(QSslSocketBackendPrivate::getErrorsFromOpenSsl()); -+ sslContext->errorCode = QSslError::UnspecifiedError; -+ return; -+ } -+ -+ if (configuration.d->privateKey.algorithm() == QSsl::Opaque) { -+ sslContext->pkey = reinterpret_cast(configuration.d->privateKey.handle()); -+ } else { -+ // Load private key -+ sslContext->pkey = q_EVP_PKEY_new(); -+ // before we were using EVP_PKEY_assign_R* functions and did not use EVP_PKEY_free. -+ // this lead to a memory leak. Now we use the *_set1_* functions which do not -+ // take ownership of the RSA/DSA key instance because the QSslKey already has ownership. -+ if (configuration.d->privateKey.algorithm() == QSsl::Rsa) -+ q_EVP_PKEY_set1_RSA(sslContext->pkey, reinterpret_cast(configuration.d->privateKey.handle())); -+ else if (configuration.d->privateKey.algorithm() == QSsl::Dsa) -+ q_EVP_PKEY_set1_DSA(sslContext->pkey, reinterpret_cast(configuration.d->privateKey.handle())); -+#ifndef OPENSSL_NO_EC -+ else if (configuration.d->privateKey.algorithm() == QSsl::Ec) -+ q_EVP_PKEY_set1_EC_KEY(sslContext->pkey, reinterpret_cast(configuration.d->privateKey.handle())); -+#endif -+ } -+ -+ if (!q_SSL_CTX_use_PrivateKey(sslContext->ctx, sslContext->pkey)) { -+ sslContext->errorStr = QSslSocket::tr("Error loading private key, %1").arg(QSslSocketBackendPrivate::getErrorsFromOpenSsl()); -+ sslContext->errorCode = QSslError::UnspecifiedError; -+ return; -+ } -+ if (configuration.d->privateKey.algorithm() == QSsl::Opaque) -+ sslContext->pkey = 0; // Don't free the private key, it belongs to QSslKey -+ -+ // Check if the certificate matches the private key. -+ if (!q_SSL_CTX_check_private_key(sslContext->ctx)) { -+ sslContext->errorStr = QSslSocket::tr("Private key does not certify public key, %1").arg(QSslSocketBackendPrivate::getErrorsFromOpenSsl()); -+ sslContext->errorCode = QSslError::UnspecifiedError; -+ return; -+ } -+ -+ // If we have any intermediate certificates then we need to add them to our chain -+ bool first = true; -+ for (const QSslCertificate &cert : qAsConst(configuration.d->localCertificateChain)) { -+ if (first) { -+ first = false; -+ continue; -+ } -+ q_SSL_CTX_ctrl(sslContext->ctx, SSL_CTRL_EXTRA_CHAIN_CERT, 0, -+ q_X509_dup(reinterpret_cast(cert.handle()))); -+ } -+ } -+ -+ // Initialize peer verification. -+ if (sslContext->sslConfiguration.peerVerifyMode() == QSslSocket::VerifyNone) { -+ q_SSL_CTX_set_verify(sslContext->ctx, SSL_VERIFY_NONE, 0); -+ } else { -+ q_SSL_CTX_set_verify(sslContext->ctx, SSL_VERIFY_PEER, q_X509Callback); -+ } -+ -+ // Set verification depth. -+ if (sslContext->sslConfiguration.peerVerifyDepth() != 0) -+ q_SSL_CTX_set_verify_depth(sslContext->ctx, sslContext->sslConfiguration.peerVerifyDepth()); -+ -+ // set persisted session if the user set it -+ if (!configuration.sessionTicket().isEmpty()) -+ sslContext->setSessionASN1(configuration.sessionTicket()); -+ -+ // Set temp DH params -+ QSslDiffieHellmanParameters dhparams = configuration.diffieHellmanParameters(); -+ -+ if (!dhparams.isValid()) { -+ sslContext->errorStr = QSslSocket::tr("Diffie-Hellman parameters are not valid"); -+ sslContext->errorCode = QSslError::UnspecifiedError; -+ return; -+ } -+ -+ if (!dhparams.isEmpty()) { -+ const QByteArray ¶ms = dhparams.d->derData; -+ const char *ptr = params.constData(); -+ DH *dh = q_d2i_DHparams(NULL, reinterpret_cast(&ptr), params.length()); -+ if (dh == NULL) -+ qFatal("q_d2i_DHparams failed to convert QSslDiffieHellmanParameters to DER form"); -+ q_SSL_CTX_set_tmp_dh(sslContext->ctx, dh); -+ q_DH_free(dh); -+ } -+ -+#ifndef OPENSSL_NO_EC -+#if OPENSSL_VERSION_NUMBER >= 0x10002000L -+ if (q_SSLeay() >= 0x10002000L) { -+ q_SSL_CTX_ctrl(sslContext->ctx, SSL_CTRL_SET_ECDH_AUTO, 1, NULL); -+ } else -+#endif -+ { -+ // Set temp ECDH params -+ EC_KEY *ecdh = 0; -+ ecdh = q_EC_KEY_new_by_curve_name(NID_X9_62_prime256v1); -+ q_SSL_CTX_set_tmp_ecdh(sslContext->ctx, ecdh); -+ q_EC_KEY_free(ecdh); -+ } -+#endif // OPENSSL_NO_EC -+ -+#if OPENSSL_VERSION_NUMBER >= 0x10001000L && !defined(OPENSSL_NO_PSK) -+ if (!client) -+ q_SSL_CTX_use_psk_identity_hint(sslContext->ctx, sslContext->sslConfiguration.preSharedKeyIdentityHint().constData()); -+#endif // OPENSSL_VERSION_NUMBER >= 0x10001000L && !defined(OPENSSL_NO_PSK) -+ -+ const QVector qcurves = sslContext->sslConfiguration.ellipticCurves(); -+ if (!qcurves.isEmpty()) { -+#if OPENSSL_VERSION_NUMBER >= 0x10002000L && !defined(OPENSSL_NO_EC) -+ // Set the curves to be used -+ if (q_SSLeay() >= 0x10002000L) { -+ // SSL_CTX_ctrl wants a non-const pointer as last argument, -+ // but let's avoid a copy into a temporary array -+ if (!q_SSL_CTX_ctrl(sslContext->ctx, -+ SSL_CTRL_SET_CURVES, -+ qcurves.size(), -+ const_cast(reinterpret_cast(qcurves.data())))) { -+ sslContext->errorStr = msgErrorSettingEllipticCurves(QSslSocketBackendPrivate::getErrorsFromOpenSsl()); -+ sslContext->errorCode = QSslError::UnspecifiedError; -+ } -+ } else -+#endif // OPENSSL_VERSION_NUMBER >= 0x10002000L && !defined(OPENSSL_NO_EC) -+ { -+ // specific curves requested, but not possible to set -> error -+ sslContext->errorStr = msgErrorSettingEllipticCurves(QSslSocket::tr("OpenSSL version too old, need at least v1.0.2")); -+ sslContext->errorCode = QSslError::UnspecifiedError; -+ } -+ } -+} -+ -+QT_END_NAMESPACE -Index: qtbase-opensource-src-5.9.2/src/network/ssl/qssldiffiehellmanparameters_openssl.cpp -=================================================================== ---- qtbase-opensource-src-5.9.2.orig/src/network/ssl/qssldiffiehellmanparameters_openssl.cpp -+++ qtbase-opensource-src-5.9.2/src/network/ssl/qssldiffiehellmanparameters_openssl.cpp -@@ -1,6 +1,7 @@ - /**************************************************************************** - ** - ** Copyright (C) 2015 Mikkel Krautz -+** Copyright (C) 2016 Richard J. Moore - ** Contact: https://www.qt.io/licensing/ - ** - ** This file is part of the QtNetwork module of the Qt Toolkit. -@@ -50,8 +51,8 @@ - #include - #endif - --// For q_BN_is_word. - #include -+#include - - QT_BEGIN_NAMESPACE - -@@ -62,13 +63,6 @@ static bool isSafeDH(DH *dh) - - QSslSocketPrivate::ensureInitialized(); - -- // Mark p < 1024 bits as unsafe. -- if (q_BN_num_bits(dh->p) < 1024) { -- return false; -- } -- -- if (q_DH_check(dh, &status) != 1) -- return false; - - // From https://wiki.openssl.org/index.php/Diffie-Hellman_parameters: - // -@@ -81,11 +75,39 @@ static bool isSafeDH(DH *dh) - // Without the test, the IETF parameters would - // fail validation. For details, see Diffie-Hellman - // Parameter Check (when g = 2, must p mod 24 == 11?). -+#if QT_CONFIG(opensslv11) -+ // Mark p < 1024 bits as unsafe. -+ if (q_DH_bits(dh) < 1024) -+ return false; -+ -+ if (q_DH_check(dh, &status) != 1) -+ return false; -+ -+ const BIGNUM *p = nullptr; -+ const BIGNUM *q = nullptr; -+ const BIGNUM *g = nullptr; -+ q_DH_get0_pqg(dh, &p, &q, &g); -+ -+ if (q_BN_is_word(const_cast(g), DH_GENERATOR_2)) { -+ long residue = q_BN_mod_word(p, 24); -+ if (residue == 11 || residue == 23) -+ status &= ~DH_NOT_SUITABLE_GENERATOR; -+ } -+ -+#else -+ // Mark p < 1024 bits as unsafe. -+ if (q_BN_num_bits(dh->p) < 1024) -+ return false; -+ -+ if (q_DH_check(dh, &status) != 1) -+ return false; -+ - if (q_BN_is_word(dh->g, DH_GENERATOR_2)) { - long residue = q_BN_mod_word(dh->p, 24); - if (residue == 11 || residue == 23) - status &= ~DH_NOT_SUITABLE_GENERATOR; - } -+#endif - - bad |= DH_CHECK_P_NOT_PRIME; - bad |= DH_CHECK_P_NOT_SAFE_PRIME; -Index: qtbase-opensource-src-5.9.2/src/network/ssl/qsslellipticcurve.h -=================================================================== ---- qtbase-opensource-src-5.9.2.orig/src/network/ssl/qsslellipticcurve.h -+++ qtbase-opensource-src-5.9.2/src/network/ssl/qsslellipticcurve.h -@@ -80,6 +80,7 @@ private: - friend Q_DECL_CONSTEXPR bool operator==(QSslEllipticCurve lhs, QSslEllipticCurve rhs) Q_DECL_NOTHROW; - friend Q_DECL_CONSTEXPR uint qHash(QSslEllipticCurve curve, uint seed) Q_DECL_NOTHROW; - -+ friend class QSslContext; - friend class QSslSocketPrivate; - friend class QSslSocketBackendPrivate; - }; -Index: qtbase-opensource-src-5.9.2/src/network/ssl/qsslellipticcurve_openssl.cpp -=================================================================== ---- qtbase-opensource-src-5.9.2.orig/src/network/ssl/qsslellipticcurve_openssl.cpp -+++ qtbase-opensource-src-5.9.2/src/network/ssl/qsslellipticcurve_openssl.cpp -@@ -1,6 +1,7 @@ - /**************************************************************************** - ** - ** Copyright (C) 2014 Governikus GmbH & Co. KG. -+** Copyright (C) 2016 Richard J. Moore - ** Contact: https://www.qt.io/licensing/ - ** - ** This file is part of the QtNetwork module of the Qt Toolkit. -@@ -78,17 +79,18 @@ QSslEllipticCurve QSslEllipticCurve::fro - QSslEllipticCurve result; - - #ifndef OPENSSL_NO_EC -- const QByteArray curveNameLatin1 = name.toLatin1(); - -+ const QByteArray curveNameLatin1 = name.toLatin1(); - int nid = q_OBJ_sn2nid(curveNameLatin1.data()); - - #if OPENSSL_VERSION_NUMBER >= 0x10002000L -- if (nid == 0 && q_SSLeay() >= 0x10002000L) -+ if (nid == 0 && QSslSocket::sslLibraryVersionNumber() >= 0x10002000L) - nid = q_EC_curve_nist2nid(curveNameLatin1.data()); - #endif // OPENSSL_VERSION_NUMBER >= 0x10002000L - - result.id = nid; --#endif -+ -+#endif // !OPENSSL_NO_EC - - return result; - } -Index: qtbase-opensource-src-5.9.2/src/network/ssl/qsslkey_openssl.cpp -=================================================================== ---- qtbase-opensource-src-5.9.2.orig/src/network/ssl/qsslkey_openssl.cpp -+++ qtbase-opensource-src-5.9.2/src/network/ssl/qsslkey_openssl.cpp -@@ -1,6 +1,7 @@ - /**************************************************************************** - ** --** Copyright (C) 2016 The Qt Company Ltd. -+** Copyright (C) 2017 The Qt Company Ltd. -+** Copyright (C) 2016 Richard J. Moore - ** Contact: https://www.qt.io/licensing/ - ** - ** This file is part of the QtNetwork module of the Qt Toolkit. -@@ -87,33 +88,30 @@ bool QSslKeyPrivate::fromEVP_PKEY(EVP_PK - if (pkey == nullptr) - return false; - -- if (pkey->type == EVP_PKEY_RSA) { -+#if QT_CONFIG(opensslv11) -+ const int keyType = q_EVP_PKEY_type(q_EVP_PKEY_base_id(pkey)); -+#else -+ const int keyType = pkey->type; -+#endif -+ if (keyType == EVP_PKEY_RSA) { - isNull = false; - algorithm = QSsl::Rsa; - type = QSsl::PrivateKey; -- -- rsa = q_RSA_new(); -- memcpy(rsa, q_EVP_PKEY_get1_RSA(pkey), sizeof(RSA)); -- -+ rsa = q_EVP_PKEY_get1_RSA(pkey); - return true; -- } -- else if (pkey->type == EVP_PKEY_DSA) { -+ } else if (keyType == EVP_PKEY_DSA) { - isNull = false; - algorithm = QSsl::Dsa; - type = QSsl::PrivateKey; -- -- dsa = q_DSA_new(); -- memcpy(dsa, q_EVP_PKEY_get1_DSA(pkey), sizeof(DSA)); -- -+ dsa = q_EVP_PKEY_get1_DSA(pkey); - return true; - } - #ifndef OPENSSL_NO_EC -- else if (pkey->type == EVP_PKEY_EC) { -+ else if (keyType == EVP_PKEY_EC) { - isNull = false; - algorithm = QSsl::Ec; - type = QSsl::PrivateKey; -- ec = q_EC_KEY_dup(q_EVP_PKEY_get1_EC_KEY(pkey)); -- -+ ec = q_EVP_PKEY_get1_EC_KEY(pkey); - return true; - } - #endif -@@ -181,8 +179,8 @@ int QSslKeyPrivate::length() const - return -1; - - switch (algorithm) { -- case QSsl::Rsa: return q_BN_num_bits(rsa->n); -- case QSsl::Dsa: return q_BN_num_bits(dsa->p); -+ case QSsl::Rsa: return q_RSA_bits(rsa); -+ case QSsl::Dsa: return q_DSA_bits(dsa); - #ifndef OPENSSL_NO_EC - case QSsl::Ec: return q_EC_GROUP_get_degree(q_EC_KEY_get0_group(ec)); - #endif -@@ -276,7 +274,13 @@ Qt::HANDLE QSslKeyPrivate::handle() cons - - static QByteArray doCrypt(QSslKeyPrivate::Cipher cipher, const QByteArray &data, const QByteArray &key, const QByteArray &iv, int enc) - { -- EVP_CIPHER_CTX ctx; -+#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; - -@@ -294,21 +298,44 @@ static QByteArray doCrypt(QSslKeyPrivate - - QByteArray output; - output.resize(data.size() + EVP_MAX_BLOCK_LENGTH); -- q_EVP_CIPHER_CTX_init(&ctx); -- q_EVP_CipherInit(&ctx, type, NULL, NULL, enc); -- q_EVP_CIPHER_CTX_set_key_length(&ctx, key.size()); -+ -+#if QT_CONFIG(opensslv11) -+ q_EVP_CIPHER_CTX_reset(ctx); -+#else -+ q_EVP_CIPHER_CTX_init(ctx); -+#endif -+ -+ q_EVP_CipherInit(ctx, type, NULL, NULL, enc); -+ q_EVP_CIPHER_CTX_set_key_length(ctx, key.size()); - if (cipher == QSslKeyPrivate::Rc2Cbc) -- q_EVP_CIPHER_CTX_ctrl(&ctx, EVP_CTRL_SET_RC2_KEY_BITS, 8 * key.size(), NULL); -- q_EVP_CipherInit(&ctx, NULL, -+ q_EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_SET_RC2_KEY_BITS, 8 * key.size(), NULL); -+ -+#if QT_CONFIG(opensslv11) -+ // EVP_CipherInit in 1.1 resets the context thus making the calls above useless. -+ // We call EVP_CipherInit_ex instead. -+ q_EVP_CipherInit_ex(ctx, nullptr, nullptr, -+ reinterpret_cast(key.constData()), -+ reinterpret_cast(iv.constData()), -+ enc); -+#else -+ q_EVP_CipherInit(ctx, NULL, - reinterpret_cast(key.constData()), - reinterpret_cast(iv.constData()), enc); -- q_EVP_CipherUpdate(&ctx, -+#endif // opensslv11 -+ -+ q_EVP_CipherUpdate(ctx, - reinterpret_cast(output.data()), &len, - reinterpret_cast(data.constData()), data.size()); -- q_EVP_CipherFinal(&ctx, -+ q_EVP_CipherFinal(ctx, - reinterpret_cast(output.data()) + len, &i); - len += i; -- q_EVP_CIPHER_CTX_cleanup(&ctx); -+ -+#if QT_CONFIG(opensslv11) -+ q_EVP_CIPHER_CTX_reset(ctx); -+ q_EVP_CIPHER_CTX_free(ctx); -+#else -+ q_EVP_CIPHER_CTX_cleanup(ctx); -+#endif - - return output.left(len); - } -Index: qtbase-opensource-src-5.9.2/src/network/ssl/qsslsocket_openssl.cpp -=================================================================== ---- qtbase-opensource-src-5.9.2.orig/src/network/ssl/qsslsocket_openssl.cpp -+++ qtbase-opensource-src-5.9.2/src/network/ssl/qsslsocket_openssl.cpp -@@ -1,6 +1,6 @@ - /**************************************************************************** - ** --** Copyright (C) 2016 The Qt Company Ltd. -+** Copyright (C) 2017 The Qt Company Ltd. - ** Copyright (C) 2014 Governikus GmbH & Co. KG - ** Contact: https://www.qt.io/licensing/ - ** -@@ -97,70 +97,6 @@ bool QSslSocketPrivate::s_loadRootCertsO - int QSslSocketBackendPrivate::s_indexForSSLExtraData = -1; - #endif - --/* \internal -- -- From OpenSSL's thread(3) manual page: -- -- OpenSSL can safely be used in multi-threaded applications provided that at -- least two callback functions are set. -- -- locking_function(int mode, int n, const char *file, int line) is needed to -- perform locking on shared data structures. (Note that OpenSSL uses a -- number of global data structures that will be implicitly shared -- whenever multiple threads use OpenSSL.) Multi-threaded -- applications will crash at random if it is not set. ... -- ... -- id_function(void) is a function that returns a thread ID. It is not -- needed on Windows nor on platforms where getpid() returns a different -- ID for each thread (most notably Linux) --*/ --class QOpenSslLocks --{ --public: -- inline QOpenSslLocks() -- : initLocker(QMutex::Recursive), -- locksLocker(QMutex::Recursive) -- { -- QMutexLocker locker(&locksLocker); -- int numLocks = q_CRYPTO_num_locks(); -- locks = new QMutex *[numLocks]; -- memset(locks, 0, numLocks * sizeof(QMutex *)); -- } -- inline ~QOpenSslLocks() -- { -- QMutexLocker locker(&locksLocker); -- for (int i = 0; i < q_CRYPTO_num_locks(); ++i) -- delete locks[i]; -- delete [] locks; -- -- QSslSocketPrivate::deinitialize(); -- } -- inline QMutex *lock(int num) -- { -- QMutexLocker locker(&locksLocker); -- QMutex *tmp = locks[num]; -- if (!tmp) -- tmp = locks[num] = new QMutex(QMutex::Recursive); -- return tmp; -- } -- -- QMutex *globalLock() -- { -- return &locksLocker; -- } -- -- QMutex *initLock() -- { -- return &initLocker; -- } -- --private: -- QMutex initLocker; -- QMutex locksLocker; -- QMutex **locks; --}; --Q_GLOBAL_STATIC(QOpenSslLocks, openssl_locks) -- - QString QSslSocketBackendPrivate::getErrorsFromOpenSsl() - { - QString errorString; -@@ -175,20 +111,6 @@ QString QSslSocketBackendPrivate::getErr - } - - extern "C" { --static void locking_function(int mode, int lockNumber, const char *, int) --{ -- QMutex *mutex = openssl_locks()->lock(lockNumber); -- -- // Lock or unlock it -- if (mode & CRYPTO_LOCK) -- mutex->lock(); -- else -- mutex->unlock(); --} --static unsigned long id_function() --{ -- return (quintptr)QThread::currentThreadId(); --} - - #if OPENSSL_VERSION_NUMBER >= 0x10001000L && !defined(OPENSSL_NO_PSK) - static unsigned int q_ssl_psk_client_callback(SSL *ssl, -@@ -227,7 +149,7 @@ QSslSocketBackendPrivate::~QSslSocketBac - destroySslContext(); - } - --QSslCipher QSslSocketBackendPrivate::QSslCipher_from_SSL_CIPHER(SSL_CIPHER *cipher) -+QSslCipher QSslSocketBackendPrivate::QSslCipher_from_SSL_CIPHER(const SSL_CIPHER *cipher) - { - QSslCipher ciph; - -@@ -283,6 +205,7 @@ struct QSslErrorList - QMutex mutex; - QVector errors; - }; -+ - Q_GLOBAL_STATIC(QSslErrorList, _q_sslErrorList) - - int q_X509Callback(int ok, X509_STORE_CTX *ctx) -@@ -312,7 +235,7 @@ int q_X509Callback(int ok, X509_STORE_CT - } - #endif - } -- // Always return OK to allow verification to continue. We're handle the -+ // Always return OK to allow verification to continue. We handle the - // errors gracefully after collecting all errors, after verification has - // completed. - return 1; -@@ -397,7 +320,7 @@ bool QSslSocketBackendPrivate::initSslCo - if (configuration.protocol != QSsl::SslV2 && - configuration.protocol != QSsl::SslV3 && - configuration.protocol != QSsl::UnknownProtocol && -- mode == QSslSocket::SslClientMode && q_SSLeay() >= 0x00090806fL) { -+ mode == QSslSocket::SslClientMode && QSslSocket::sslLibraryVersionNumber() >= 0x00090806fL) { - // Set server hostname on TLS extension. RFC4366 section 3.1 requires it in ACE format. - QString tlsHostName = verificationPeerName.isEmpty() ? q->peerName() : verificationPeerName; - if (tlsHostName.isEmpty()) -@@ -438,13 +361,13 @@ bool QSslSocketBackendPrivate::initSslCo - - #if OPENSSL_VERSION_NUMBER >= 0x10001000L - // Save a pointer to this object into the SSL structure. -- if (q_SSLeay() >= 0x10001000L) -+ if (QSslSocket::sslLibraryVersionNumber() >= 0x10001000L) - q_SSL_set_ex_data(ssl, s_indexForSSLExtraData, this); - #endif - - #if OPENSSL_VERSION_NUMBER >= 0x10001000L && !defined(OPENSSL_NO_PSK) - // Set the client callback for PSK -- if (q_SSLeay() >= 0x10001000L) { -+ if (QSslSocket::sslLibraryVersionNumber() >= 0x10001000L) { - if (mode == QSslSocket::SslClientMode) - q_SSL_set_psk_client_callback(ssl, &q_ssl_psk_client_callback); - else if (mode == QSslSocket::SslServerMode) -@@ -466,16 +389,6 @@ void QSslSocketBackendPrivate::destroySs - - /*! - \internal --*/ --void QSslSocketPrivate::deinitialize() --{ -- q_CRYPTO_set_id_callback(0); -- q_CRYPTO_set_locking_callback(0); -- q_ERR_free_strings(); --} -- --/*! -- \internal - - Does the minimum amount of initialization to determine whether SSL - is supported or not. -@@ -486,92 +399,6 @@ bool QSslSocketPrivate::supportsSsl() - return ensureLibraryLoaded(); - } - --bool QSslSocketPrivate::ensureLibraryLoaded() --{ -- if (!q_resolveOpenSslSymbols()) -- return false; -- -- // Check if the library itself needs to be initialized. -- QMutexLocker locker(openssl_locks()->initLock()); -- -- if (!s_libraryLoaded) { -- s_libraryLoaded = true; -- -- // Initialize OpenSSL. -- q_CRYPTO_set_id_callback(id_function); -- q_CRYPTO_set_locking_callback(locking_function); -- if (q_SSL_library_init() != 1) -- return false; -- q_SSL_load_error_strings(); -- q_OpenSSL_add_all_algorithms(); -- --#if OPENSSL_VERSION_NUMBER >= 0x10001000L -- if (q_SSLeay() >= 0x10001000L) -- QSslSocketBackendPrivate::s_indexForSSLExtraData = q_SSL_get_ex_new_index(0L, NULL, NULL, NULL, NULL); --#endif -- -- // Initialize OpenSSL's random seed. -- if (!q_RAND_status()) { -- qWarning("Random number generator not seeded, disabling SSL support"); -- return false; -- } -- } -- return true; --} -- --void QSslSocketPrivate::ensureCiphersAndCertsLoaded() --{ -- QMutexLocker locker(openssl_locks()->initLock()); -- if (s_loadedCiphersAndCerts) -- return; -- s_loadedCiphersAndCerts = true; -- -- resetDefaultCiphers(); -- resetDefaultEllipticCurves(); -- --#if QT_CONFIG(library) -- //load symbols needed to receive certificates from system store --#if defined(Q_OS_WIN) -- HINSTANCE hLib = LoadLibraryW(L"Crypt32"); -- if (hLib) { -- ptrCertOpenSystemStoreW = (PtrCertOpenSystemStoreW)GetProcAddress(hLib, "CertOpenSystemStoreW"); -- ptrCertFindCertificateInStore = (PtrCertFindCertificateInStore)GetProcAddress(hLib, "CertFindCertificateInStore"); -- ptrCertCloseStore = (PtrCertCloseStore)GetProcAddress(hLib, "CertCloseStore"); -- if (!ptrCertOpenSystemStoreW || !ptrCertFindCertificateInStore || !ptrCertCloseStore) -- qCWarning(lcSsl, "could not resolve symbols in crypt32 library"); // should never happen -- } else { -- qCWarning(lcSsl, "could not load crypt32 library"); // should never happen -- } --#elif defined(Q_OS_QNX) -- s_loadRootCertsOnDemand = true; --#elif defined(Q_OS_UNIX) && !defined(Q_OS_MAC) -- // check whether we can enable on-demand root-cert loading (i.e. check whether the sym links are there) -- QList dirs = unixRootCertDirectories(); -- QStringList symLinkFilter; -- symLinkFilter << QLatin1String("[0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f].[0-9]"); -- for (int a = 0; a < dirs.count(); ++a) { -- QDirIterator iterator(QLatin1String(dirs.at(a)), symLinkFilter, QDir::Files); -- if (iterator.hasNext()) { -- s_loadRootCertsOnDemand = true; -- break; -- } -- } --#endif --#endif // QT_CONFIG(library) -- // if on-demand loading was not enabled, load the certs now -- if (!s_loadRootCertsOnDemand) -- setDefaultCaCertificates(systemCaCertificates()); --#ifdef Q_OS_WIN -- //Enabled for fetching additional root certs from windows update on windows 6+ -- //This flag is set false by setDefaultCaCertificates() indicating the app uses -- //its own cert bundle rather than the system one. -- //Same logic that disables the unix on demand cert loading. -- //Unlike unix, we do preload the certificates from the cert store. -- if ((QSysInfo::windowsVersion() & QSysInfo::WV_NT_based) >= QSysInfo::WV_6_0) -- s_loadRootCertsOnDemand = true; --#endif --} -- - /*! - \internal - -@@ -587,26 +414,6 @@ void QSslSocketPrivate::ensureInitialize - ensureCiphersAndCertsLoaded(); - } - --long QSslSocketPrivate::sslLibraryVersionNumber() --{ -- if (!supportsSsl()) -- return 0; -- -- return q_SSLeay(); --} -- --QString QSslSocketPrivate::sslLibraryVersionString() --{ -- if (!supportsSsl()) -- return QString(); -- -- const char *versionString = q_SSLeay_version(SSLEAY_VERSION); -- if (!versionString) -- return QString(); -- -- return QString::fromLatin1(versionString); --} -- - long QSslSocketPrivate::sslLibraryBuildVersionNumber() - { - return OPENSSL_VERSION_NUMBER; -@@ -628,7 +435,11 @@ QString QSslSocketPrivate::sslLibraryBui - */ - void QSslSocketPrivate::resetDefaultCiphers() - { -+#if QT_CONFIG(opensslv11) -+ SSL_CTX *myCtx = q_SSL_CTX_new(q_TLS_client_method()); -+#else - SSL_CTX *myCtx = q_SSL_CTX_new(q_SSLv23_client_method()); -+#endif - SSL *mySsl = q_SSL_new(myCtx); - - QList ciphers; -@@ -665,7 +476,7 @@ void QSslSocketPrivate::resetDefaultElli - QVector curves; - - #ifndef OPENSSL_NO_EC -- const size_t curveCount = q_EC_get_builtin_curves(NULL, 0); -+ const size_t curveCount = q_EC_get_builtin_curves(nullptr, 0); - - QVarLengthArray builtinCurves(static_cast(curveCount)); - -@@ -699,13 +510,14 @@ QList QSslSocketPrivate - if (ptrCertOpenSystemStoreW && ptrCertFindCertificateInStore && ptrCertCloseStore) { - HCERTSTORE hSystemStore; - hSystemStore = ptrCertOpenSystemStoreW(0, L"ROOT"); -- if(hSystemStore) { -- PCCERT_CONTEXT pc = NULL; -- while(1) { -- pc = ptrCertFindCertificateInStore( hSystemStore, X509_ASN_ENCODING, 0, CERT_FIND_ANY, NULL, pc); -- if(!pc) -+ if (hSystemStore) { -+ PCCERT_CONTEXT pc = nullptr; -+ while (1) { -+ pc = ptrCertFindCertificateInStore(hSystemStore, X509_ASN_ENCODING, 0, CERT_FIND_ANY, nullptr, pc); -+ if (!pc) - break; -- QByteArray der((const char *)(pc->pbCertEncoded), static_cast(pc->cbCertEncoded)); -+ QByteArray der(reinterpret_cast(pc->pbCertEncoded), -+ static_cast(pc->cbCertEncoded)); - QSslCertificate cert(der, QSsl::Der); - systemCerts.append(cert); - } -@@ -1503,14 +1315,8 @@ QSslCipher QSslSocketBackendPrivate::ses - { - if (!ssl) - return QSslCipher(); --#if OPENSSL_VERSION_NUMBER >= 0x10000000L -- // FIXME This is fairly evil, but needed to keep source level compatibility -- // with the OpenSSL 0.9.x implementation at maximum -- some other functions -- // don't take a const SSL_CIPHER* when they should -- SSL_CIPHER *sessionCipher = const_cast(q_SSL_get_current_cipher(ssl)); --#else -- SSL_CIPHER *sessionCipher = q_SSL_get_current_cipher(ssl); --#endif -+ -+ const SSL_CIPHER *sessionCipher = q_SSL_get_current_cipher(ssl); - return sessionCipher ? QSslCipher_from_SSL_CIPHER(sessionCipher) : QSslCipher(); - } - -@@ -1536,112 +1342,6 @@ QSsl::SslProtocol QSslSocketBackendPriva - return QSsl::UnknownProtocol; - } - --void QSslSocketBackendPrivate::continueHandshake() --{ -- Q_Q(QSslSocket); -- // if we have a max read buffer size, reset the plain socket's to match -- if (readBufferMaxSize) -- plainSocket->setReadBufferSize(readBufferMaxSize); -- -- if (q_SSL_ctrl((ssl), SSL_CTRL_GET_SESSION_REUSED, 0, NULL)) -- configuration.peerSessionShared = true; -- --#ifdef QT_DECRYPT_SSL_TRAFFIC -- if (ssl->session && ssl->s3) { -- const char *mk = reinterpret_cast(ssl->session->master_key); -- QByteArray masterKey(mk, ssl->session->master_key_length); -- const char *random = reinterpret_cast(ssl->s3->client_random); -- QByteArray clientRandom(random, SSL3_RANDOM_SIZE); -- -- // different format, needed for e.g. older Wireshark versions: --// const char *sid = reinterpret_cast(ssl->session->session_id); --// QByteArray sessionID(sid, ssl->session->session_id_length); --// QByteArray debugLineRSA("RSA Session-ID:"); --// debugLineRSA.append(sessionID.toHex().toUpper()); --// debugLineRSA.append(" Master-Key:"); --// debugLineRSA.append(masterKey.toHex().toUpper()); --// debugLineRSA.append("\n"); -- -- QByteArray debugLineClientRandom("CLIENT_RANDOM "); -- debugLineClientRandom.append(clientRandom.toHex().toUpper()); -- debugLineClientRandom.append(" "); -- debugLineClientRandom.append(masterKey.toHex().toUpper()); -- debugLineClientRandom.append("\n"); -- -- QString sslKeyFile = QDir::tempPath() + QLatin1String("/qt-ssl-keys"); -- QFile file(sslKeyFile); -- if (!file.open(QIODevice::Append)) -- qCWarning(lcSsl) << "could not open file" << sslKeyFile << "for appending"; -- if (!file.write(debugLineClientRandom)) -- qCWarning(lcSsl) << "could not write to file" << sslKeyFile; -- file.close(); -- } else { -- qCWarning(lcSsl, "could not decrypt SSL traffic"); -- } --#endif -- -- // Cache this SSL session inside the QSslContext -- if (!(configuration.sslOptions & QSsl::SslOptionDisableSessionSharing)) { -- if (!sslContextPointer->cacheSession(ssl)) { -- sslContextPointer.clear(); // we could not cache the session -- } else { -- // Cache the session for permanent usage as well -- if (!(configuration.sslOptions & QSsl::SslOptionDisableSessionPersistence)) { -- if (!sslContextPointer->sessionASN1().isEmpty()) -- configuration.sslSession = sslContextPointer->sessionASN1(); -- configuration.sslSessionTicketLifeTimeHint = sslContextPointer->sessionTicketLifeTimeHint(); -- } -- } -- } -- --#if OPENSSL_VERSION_NUMBER >= 0x1000100fL && !defined(OPENSSL_NO_NEXTPROTONEG) -- -- configuration.nextProtocolNegotiationStatus = sslContextPointer->npnContext().status; -- if (sslContextPointer->npnContext().status == QSslConfiguration::NextProtocolNegotiationUnsupported) { -- // we could not agree -> be conservative and use HTTP/1.1 -- configuration.nextNegotiatedProtocol = QByteArrayLiteral("http/1.1"); -- } else { -- const unsigned char *proto = 0; -- unsigned int proto_len = 0; --#if OPENSSL_VERSION_NUMBER >= 0x10002000L -- if (q_SSLeay() >= 0x10002000L) { -- q_SSL_get0_alpn_selected(ssl, &proto, &proto_len); -- if (proto_len && mode == QSslSocket::SslClientMode) { -- // Client does not have a callback that sets it ... -- configuration.nextProtocolNegotiationStatus = QSslConfiguration::NextProtocolNegotiationNegotiated; -- } -- } -- -- if (!proto_len) { // Test if NPN was more lucky ... --#else -- { --#endif -- q_SSL_get0_next_proto_negotiated(ssl, &proto, &proto_len); -- } -- -- if (proto_len) -- configuration.nextNegotiatedProtocol = QByteArray(reinterpret_cast(proto), proto_len); -- else -- configuration.nextNegotiatedProtocol.clear(); -- } --#endif // OPENSSL_VERSION_NUMBER >= 0x1000100fL ... -- --#if OPENSSL_VERSION_NUMBER >= 0x10002000L -- if (q_SSLeay() >= 0x10002000L && mode == QSslSocket::SslClientMode) { -- EVP_PKEY *key; -- if (q_SSL_get_server_tmp_key(ssl, &key)) -- configuration.ephemeralServerKey = QSslKey(key, QSsl::PublicKey); -- } --#endif // OPENSSL_VERSION_NUMBER >= 0x10002000L ... -- -- connectionEncrypted = true; -- emit q->encrypted(); -- if (autoStartHandshake && pendingClose) { -- pendingClose = false; -- q->disconnectFromHost(); -- } --} -- - QList QSslSocketBackendPrivate::STACKOFX509_to_QSslCertificates(STACK_OF(X509) *x509) - { - ensureInitialized(); -@@ -1695,12 +1395,12 @@ QList QSslSocketBackendPrivat - QMutexLocker sslErrorListMutexLocker(&_q_sslErrorList()->mutex); - - // Register a custom callback to get all verification errors. -- X509_STORE_set_verify_cb_func(certStore, q_X509Callback); -+ q_X509_STORE_set_verify_cb(certStore, q_X509Callback); - - // Build the chain of intermediate certificates - STACK_OF(X509) *intermediates = 0; - if (certificateChain.length() > 1) { -- intermediates = (STACK_OF(X509) *) q_sk_new_null(); -+ intermediates = (STACK_OF(X509) *) q_OPENSSL_sk_new_null(); - - if (!intermediates) { - q_X509_STORE_free(certStore); -@@ -1714,11 +1414,8 @@ QList QSslSocketBackendPrivat - first = false; - continue; - } --#if OPENSSL_VERSION_NUMBER >= 0x10000000L -- q_sk_push( (_STACK *)intermediates, reinterpret_cast(cert.handle())); --#else -- q_sk_push( (STACK *)intermediates, reinterpret_cast(cert.handle())); --#endif -+ -+ q_OPENSSL_sk_push((OPENSSL_STACK *)intermediates, reinterpret_cast(cert.handle())); - } - } - -@@ -1742,11 +1439,7 @@ QList QSslSocketBackendPrivat - (void) q_X509_verify_cert(storeContext); - - q_X509_STORE_CTX_free(storeContext); --#if OPENSSL_VERSION_NUMBER >= 0x10000000L -- q_sk_free( (_STACK *) intermediates); --#else -- q_sk_free( (STACK *) intermediates); --#endif -+ q_OPENSSL_sk_free((OPENSSL_STACK *)intermediates); - - // Now process the errors - const auto errorList = std::move(_q_sslErrorList()->errors); -@@ -1820,7 +1513,8 @@ bool QSslSocketBackendPrivate::importPkc - // Convert to Qt types - if (!key->d->fromEVP_PKEY(pkey)) { - qCWarning(lcSsl, "Unable to convert private key"); -- q_sk_pop_free(reinterpret_cast(ca), reinterpret_cast(q_sk_free)); -+ q_OPENSSL_sk_pop_free(reinterpret_cast(ca), -+ reinterpret_cast(q_OPENSSL_sk_free)); - q_X509_free(x509); - q_EVP_PKEY_free(pkey); - q_PKCS12_free(p12); -@@ -1835,7 +1529,11 @@ bool QSslSocketBackendPrivate::importPkc - *caCertificates = QSslSocketBackendPrivate::STACKOFX509_to_QSslCertificates(ca); - - // Clean up -- q_sk_pop_free(reinterpret_cast(ca), reinterpret_cast(q_sk_free)); -+ // TODO: verify ASAP, in the past we had sk_pop_free with q_OPENSSL_sk_free -+ // which seems to be blatantly wrong and even crashes with 1.1. -+ q_OPENSSL_sk_pop_free(reinterpret_cast(ca), -+ reinterpret_cast(q_X509_free)); -+ - q_X509_free(x509); - q_EVP_PKEY_free(pkey); - q_PKCS12_free(p12); -Index: qtbase-opensource-src-5.9.2/src/network/ssl/qsslsocket_openssl11.cpp -=================================================================== ---- /dev/null -+++ qtbase-opensource-src-5.9.2/src/network/ssl/qsslsocket_openssl11.cpp -@@ -0,0 +1,285 @@ -+/**************************************************************************** -+** -+** Copyright (C) 2017 The Qt Company Ltd. -+** Copyright (C) 2014 Governikus GmbH & Co. KG -+** Copyright (C) 2016 Richard J. Moore -+** Contact: https://www.qt.io/licensing/ -+** -+** This file is part of the QtNetwork module of the Qt Toolkit. -+** -+** $QT_BEGIN_LICENSE:LGPL$ -+** Commercial License Usage -+** Licensees holding valid commercial Qt licenses may use this file in -+** accordance with the commercial license agreement provided with the -+** Software or, alternatively, in accordance with the terms contained in -+** a written agreement between you and The Qt Company. For licensing terms -+** and conditions see https://www.qt.io/terms-conditions. For further -+** information use the contact form at https://www.qt.io/contact-us. -+** -+** GNU Lesser General Public License Usage -+** Alternatively, this file may be used under the terms of the GNU Lesser -+** General Public License version 3 as published by the Free Software -+** Foundation and appearing in the file LICENSE.LGPL3 included in the -+** packaging of this file. Please review the following information to -+** ensure the GNU Lesser General Public License version 3 requirements -+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -+** -+** GNU General Public License Usage -+** Alternatively, this file may be used under the terms of the GNU -+** General Public License version 2.0 or (at your option) the GNU General -+** Public license version 3 or any later version approved by the KDE Free -+** Qt Foundation. The licenses are as published by the Free Software -+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -+** included in the packaging of this file. Please review the following -+** information to ensure the GNU General Public License requirements will -+** be met: https://www.gnu.org/licenses/gpl-2.0.html and -+** https://www.gnu.org/licenses/gpl-3.0.html. -+** -+** $QT_END_LICENSE$ -+** -+****************************************************************************/ -+ -+/**************************************************************************** -+** -+** In addition, as a special exception, the copyright holders listed above give -+** permission to link the code of its release of Qt with the OpenSSL project's -+** "OpenSSL" library (or modified versions of the "OpenSSL" library that use the -+** same license as the original version), and distribute the linked executables. -+** -+** You must comply with the GNU General Public License version 2 in all -+** respects for all of the code used other than the "OpenSSL" code. If you -+** modify this file, you may extend this exception to your version of the file, -+** but you are not obligated to do so. If you do not wish to do so, delete -+** this exception statement from your version of this file. -+** -+****************************************************************************/ -+ -+//#define QT_DECRYPT_SSL_TRAFFIC -+ -+#include "qssl_p.h" -+#include "qsslsocket_openssl_p.h" -+#include "qsslsocket_openssl_symbols_p.h" -+#include "qsslsocket.h" -+#include "qsslkey.h" -+ -+#include -+#include -+#include -+#include -+#include -+#include -+ -+QT_BEGIN_NAMESPACE -+ -+Q_GLOBAL_STATIC_WITH_ARGS(QMutex, qt_opensslInitMutex, (QMutex::Recursive)) -+ -+/*! -+ \internal -+*/ -+void QSslSocketPrivate::deinitialize() -+{ -+ // This function exists only for compatibility with the pre-11 code, -+ // where deinitialize() actually does some cleanup. To be discarded -+ // once we retire < 1.1. -+} -+ -+bool QSslSocketPrivate::ensureLibraryLoaded() -+{ -+ if (!q_resolveOpenSslSymbols()) -+ return false; -+ -+ const QMutexLocker locker(qt_opensslInitMutex); -+ -+ if (!s_libraryLoaded) { -+ s_libraryLoaded = true; -+ -+ // Initialize OpenSSL. -+ if (q_OPENSSL_init_ssl(0, nullptr) != 1) -+ return false; -+ q_SSL_load_error_strings(); -+ q_OpenSSL_add_all_algorithms(); -+ -+ QSslSocketBackendPrivate::s_indexForSSLExtraData -+ = q_CRYPTO_get_ex_new_index(CRYPTO_EX_INDEX_SSL, 0L, nullptr, nullptr, -+ nullptr, nullptr); -+ -+ // Initialize OpenSSL's random seed. -+ if (!q_RAND_status()) { -+ qWarning("Random number generator not seeded, disabling SSL support"); -+ return false; -+ } -+ } -+ return true; -+} -+ -+void QSslSocketPrivate::ensureCiphersAndCertsLoaded() -+{ -+ const QMutexLocker locker(qt_opensslInitMutex); -+ -+ if (s_loadedCiphersAndCerts) -+ return; -+ s_loadedCiphersAndCerts = true; -+ -+ resetDefaultCiphers(); -+ resetDefaultEllipticCurves(); -+ -+#if QT_CONFIG(library) -+ //load symbols needed to receive certificates from system store -+#if defined(Q_OS_WIN) -+ HINSTANCE hLib = LoadLibraryW(L"Crypt32"); -+ if (hLib) { -+ ptrCertOpenSystemStoreW = (PtrCertOpenSystemStoreW)GetProcAddress(hLib, "CertOpenSystemStoreW"); -+ ptrCertFindCertificateInStore = (PtrCertFindCertificateInStore)GetProcAddress(hLib, "CertFindCertificateInStore"); -+ ptrCertCloseStore = (PtrCertCloseStore)GetProcAddress(hLib, "CertCloseStore"); -+ if (!ptrCertOpenSystemStoreW || !ptrCertFindCertificateInStore || !ptrCertCloseStore) -+ qCWarning(lcSsl, "could not resolve symbols in crypt32 library"); // should never happen -+ } else { -+ qCWarning(lcSsl, "could not load crypt32 library"); // should never happen -+ } -+#elif defined(Q_OS_QNX) -+ s_loadRootCertsOnDemand = true; -+#elif defined(Q_OS_UNIX) && !defined(Q_OS_DARWIN) -+ // check whether we can enable on-demand root-cert loading (i.e. check whether the sym links are there) -+ QList dirs = unixRootCertDirectories(); -+ QStringList symLinkFilter; -+ symLinkFilter << QLatin1String("[0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f].[0-9]"); -+ for (int a = 0; a < dirs.count(); ++a) { -+ QDirIterator iterator(QLatin1String(dirs.at(a)), symLinkFilter, QDir::Files); -+ if (iterator.hasNext()) { -+ s_loadRootCertsOnDemand = true; -+ break; -+ } -+ } -+#endif -+#endif // QT_CONFIG(library) -+ // if on-demand loading was not enabled, load the certs now -+ if (!s_loadRootCertsOnDemand) -+ setDefaultCaCertificates(systemCaCertificates()); -+#ifdef Q_OS_WIN -+ //Enabled for fetching additional root certs from windows update on windows 6+ -+ //This flag is set false by setDefaultCaCertificates() indicating the app uses -+ //its own cert bundle rather than the system one. -+ //Same logic that disables the unix on demand cert loading. -+ //Unlike unix, we do preload the certificates from the cert store. -+ if ((QSysInfo::windowsVersion() & QSysInfo::WV_NT_based) >= QSysInfo::WV_6_0) -+ s_loadRootCertsOnDemand = true; -+#endif -+} -+ -+long QSslSocketPrivate::sslLibraryVersionNumber() -+{ -+ if (!supportsSsl()) -+ return 0; -+ -+ return q_OpenSSL_version_num(); -+} -+ -+QString QSslSocketPrivate::sslLibraryVersionString() -+{ -+ if (!supportsSsl()) -+ return QString(); -+ -+ const char *versionString = q_OpenSSL_version(OPENSSL_VERSION); -+ if (!versionString) -+ return QString(); -+ -+ return QString::fromLatin1(versionString); -+} -+ -+void QSslSocketBackendPrivate::continueHandshake() -+{ -+ Q_Q(QSslSocket); -+ // if we have a max read buffer size, reset the plain socket's to match -+ if (readBufferMaxSize) -+ plainSocket->setReadBufferSize(readBufferMaxSize); -+ -+ if (q_SSL_session_reused(ssl)) -+ configuration.peerSessionShared = true; -+ -+#ifdef QT_DECRYPT_SSL_TRAFFIC -+ if (q_SSL_get_session(ssl)) { -+ size_t master_key_len = q_SSL_SESSION_get_master_key(q_SSL_get_session(ssl), 0, 0); -+ size_t client_random_len = q_SSL_get_client_random(ssl, 0, 0); -+ QByteArray masterKey(int(master_key_len), 0); // Will not overflow -+ QByteArray clientRandom(int(client_random_len), 0); // Will not overflow -+ -+ q_SSL_SESSION_get_master_key(q_SSL_get_session(ssl), -+ reinterpret_cast(masterKey.data()), -+ masterKey.size()); -+ q_SSL_get_client_random(ssl, reinterpret_cast(clientRandom.data()), -+ clientRandom.size()); -+ -+ QByteArray debugLineClientRandom("CLIENT_RANDOM "); -+ debugLineClientRandom.append(clientRandom.toHex().toUpper()); -+ debugLineClientRandom.append(" "); -+ debugLineClientRandom.append(masterKey.toHex().toUpper()); -+ debugLineClientRandom.append("\n"); -+ -+ QString sslKeyFile = QDir::tempPath() + QLatin1String("/qt-ssl-keys"); -+ QFile file(sslKeyFile); -+ if (!file.open(QIODevice::Append)) -+ qCWarning(lcSsl) << "could not open file" << sslKeyFile << "for appending"; -+ if (!file.write(debugLineClientRandom)) -+ qCWarning(lcSsl) << "could not write to file" << sslKeyFile; -+ file.close(); -+ } else { -+ qCWarning(lcSsl, "could not decrypt SSL traffic"); -+ } -+#endif -+ -+ // Cache this SSL session inside the QSslContext -+ if (!(configuration.sslOptions & QSsl::SslOptionDisableSessionSharing)) { -+ if (!sslContextPointer->cacheSession(ssl)) { -+ sslContextPointer.clear(); // we could not cache the session -+ } else { -+ // Cache the session for permanent usage as well -+ if (!(configuration.sslOptions & QSsl::SslOptionDisableSessionPersistence)) { -+ if (!sslContextPointer->sessionASN1().isEmpty()) -+ configuration.sslSession = sslContextPointer->sessionASN1(); -+ configuration.sslSessionTicketLifeTimeHint = sslContextPointer->sessionTicketLifeTimeHint(); -+ } -+ } -+ } -+ -+#if !defined(OPENSSL_NO_NEXTPROTONEG) -+ -+ configuration.nextProtocolNegotiationStatus = sslContextPointer->npnContext().status; -+ if (sslContextPointer->npnContext().status == QSslConfiguration::NextProtocolNegotiationUnsupported) { -+ // we could not agree -> be conservative and use HTTP/1.1 -+ configuration.nextNegotiatedProtocol = QByteArrayLiteral("http/1.1"); -+ } else { -+ const unsigned char *proto = 0; -+ unsigned int proto_len = 0; -+ -+ q_SSL_get0_alpn_selected(ssl, &proto, &proto_len); -+ if (proto_len && mode == QSslSocket::SslClientMode) { -+ // Client does not have a callback that sets it ... -+ configuration.nextProtocolNegotiationStatus = QSslConfiguration::NextProtocolNegotiationNegotiated; -+ } -+ -+ if (!proto_len) { // Test if NPN was more lucky ... -+ q_SSL_get0_next_proto_negotiated(ssl, &proto, &proto_len); -+ } -+ -+ if (proto_len) -+ configuration.nextNegotiatedProtocol = QByteArray(reinterpret_cast(proto), proto_len); -+ else -+ configuration.nextNegotiatedProtocol.clear(); -+ } -+#endif // !defined(OPENSSL_NO_NEXTPROTONEG) -+ -+ if (mode == QSslSocket::SslClientMode) { -+ EVP_PKEY *key; -+ if (q_SSL_get_server_tmp_key(ssl, &key)) -+ configuration.ephemeralServerKey = QSslKey(key, QSsl::PublicKey); -+ } -+ -+ connectionEncrypted = true; -+ emit q->encrypted(); -+ if (autoStartHandshake && pendingClose) { -+ pendingClose = false; -+ q->disconnectFromHost(); -+ } -+} -+ -+QT_END_NAMESPACE -Index: qtbase-opensource-src-5.9.2/src/network/ssl/qsslsocket_openssl11_symbols_p.h -=================================================================== ---- /dev/null -+++ qtbase-opensource-src-5.9.2/src/network/ssl/qsslsocket_openssl11_symbols_p.h -@@ -0,0 +1,132 @@ -+/**************************************************************************** -+** -+** Copyright (C) 2017 The Qt Company Ltd. -+** Copyright (C) 2014 BlackBerry Limited. All rights reserved. -+** Copyright (C) 2016 Richard J. Moore -+** Contact: https://www.qt.io/licensing/ -+** -+** This file is part of the QtNetwork module of the Qt Toolkit. -+** -+** $QT_BEGIN_LICENSE:LGPL$ -+** Commercial License Usage -+** Licensees holding valid commercial Qt licenses may use this file in -+** accordance with the commercial license agreement provided with the -+** Software or, alternatively, in accordance with the terms contained in -+** a written agreement between you and The Qt Company. For licensing terms -+** and conditions see https://www.qt.io/terms-conditions. For further -+** information use the contact form at https://www.qt.io/contact-us. -+** -+** GNU Lesser General Public License Usage -+** Alternatively, this file may be used under the terms of the GNU Lesser -+** General Public License version 3 as published by the Free Software -+** Foundation and appearing in the file LICENSE.LGPL3 included in the -+** packaging of this file. Please review the following information to -+** ensure the GNU Lesser General Public License version 3 requirements -+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -+** -+** GNU General Public License Usage -+** Alternatively, this file may be used under the terms of the GNU -+** General Public License version 2.0 or (at your option) the GNU General -+** Public license version 3 or any later version approved by the KDE Free -+** Qt Foundation. The licenses are as published by the Free Software -+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -+** included in the packaging of this file. Please review the following -+** information to ensure the GNU General Public License requirements will -+** be met: https://www.gnu.org/licenses/gpl-2.0.html and -+** https://www.gnu.org/licenses/gpl-3.0.html. -+** -+** $QT_END_LICENSE$ -+** -+****************************************************************************/ -+ -+/**************************************************************************** -+** -+** In addition, as a special exception, the copyright holders listed above give -+** permission to link the code of its release of Qt with the OpenSSL project's -+** "OpenSSL" library (or modified versions of the "OpenSSL" library that use the -+** same license as the original version), and distribute the linked executables. -+** -+** You must comply with the GNU General Public License version 2 in all -+** respects for all of the code used other than the "OpenSSL" code. If you -+** modify this file, you may extend this exception to your version of the file, -+** but you are not obligated to do so. If you do not wish to do so, delete -+** this exception statement from your version of this file. -+** -+****************************************************************************/ -+ -+#ifndef QSSLSOCKET_OPENSSL11_SYMBOLS_P_H -+#define QSSLSOCKET_OPENSSL11_SYMBOLS_P_H -+ -+// -+// W A R N I N G -+// ------------- -+// -+// This file is not part of the Qt API. It exists purely as an -+// implementation detail. This header file may change from version to -+// version without notice, or even be removed. -+// -+// We mean it. -+// -+ -+// Note: this file does not have QT_BEGIN_NAMESPACE/QT_END_NAMESPACE, it's done -+// in qsslsocket_openssl_symbols_p.h. -+ -+#ifndef QSSLSOCKET_OPENSSL_SYMBOLS_P_H -+#error "You are not supposed to use this header file, include qsslsocket_openssl_symbols_p.h instead" -+#endif -+ -+const unsigned char * q_ASN1_STRING_get0_data(const ASN1_STRING *x); -+ -+Q_AUTOTEST_EXPORT BIO *q_BIO_new(const BIO_METHOD *a); -+Q_AUTOTEST_EXPORT const BIO_METHOD *q_BIO_s_mem(); -+ -+int q_DSA_bits(DSA *a); -+int q_EVP_CIPHER_CTX_reset(EVP_CIPHER_CTX *c); -+int q_EVP_PKEY_base_id(EVP_PKEY *a); -+int q_RSA_bits(RSA *a); -+int q_OPENSSL_sk_num(OPENSSL_STACK *a); -+void q_OPENSSL_sk_pop_free(OPENSSL_STACK *a, void (*b)(void *)); -+OPENSSL_STACK *q_OPENSSL_sk_new_null(); -+void q_OPENSSL_sk_push(OPENSSL_STACK *st, void *data); -+void q_OPENSSL_sk_free(OPENSSL_STACK *a); -+void * q_OPENSSL_sk_value(OPENSSL_STACK *a, int b); -+int q_SSL_session_reused(SSL *a); -+unsigned long q_SSL_CTX_set_options(SSL_CTX *ctx, unsigned long op); -+int q_OPENSSL_init_ssl(uint64_t opts, const OPENSSL_INIT_SETTINGS *settings); -+size_t q_SSL_get_client_random(SSL *a, unsigned char *out, size_t outlen); -+size_t q_SSL_SESSION_get_master_key(const SSL_SESSION *session, unsigned char *out, size_t outlen); -+int q_CRYPTO_get_ex_new_index(int class_index, long argl, void *argp, CRYPTO_EX_new *new_func, CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func); -+const SSL_METHOD *q_TLS_method(); -+const SSL_METHOD *q_TLS_client_method(); -+const SSL_METHOD *q_TLS_server_method(); -+ASN1_TIME *q_X509_getm_notBefore(X509 *a); -+ASN1_TIME *q_X509_getm_notAfter(X509 *a); -+ -+long q_X509_get_version(X509 *a); -+EVP_PKEY *q_X509_get_pubkey(X509 *a); -+void q_X509_STORE_set_verify_cb(X509_STORE *ctx, X509_STORE_CTX_verify_cb verify_cb); -+STACK_OF(X509) *q_X509_STORE_CTX_get0_chain(X509_STORE_CTX *ctx); -+void q_DH_get0_pqg(const DH *dh, const BIGNUM **p, const BIGNUM **q, const BIGNUM **g); -+int q_DH_bits(DH *dh); -+ -+# define q_SSL_load_error_strings() q_OPENSSL_init_ssl(OPENSSL_INIT_LOAD_SSL_STRINGS \ -+ | OPENSSL_INIT_LOAD_CRYPTO_STRINGS, NULL) -+ -+#define q_SKM_sk_num(type, st) ((int (*)(const STACK_OF(type) *))q_OPENSSL_sk_num)(st) -+#define q_SKM_sk_value(type, st,i) ((type * (*)(const STACK_OF(type) *, int))q_OPENSSL_sk_value)(st, i) -+ -+#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) -+#define q_OPENSSL_add_all_algorithms_noconf() q_OPENSSL_init_crypto(OPENSSL_INIT_ADD_ALL_CIPHERS \ -+ | OPENSSL_INIT_ADD_ALL_DIGESTS, NULL) -+ -+int q_OPENSSL_init_crypto(uint64_t opts, const OPENSSL_INIT_SETTINGS *settings); -+void q_CRYPTO_free(void *str, const char *file, int line); -+ -+long q_OpenSSL_version_num(); -+const char *q_OpenSSL_version(int type); -+ -+unsigned long q_SSL_SESSION_get_ticket_lifetime_hint(const SSL_SESSION *session); -+ -+#endif -Index: qtbase-opensource-src-5.9.2/src/network/ssl/qsslsocket_openssl_p.h -=================================================================== ---- qtbase-opensource-src-5.9.2.orig/src/network/ssl/qsslsocket_openssl_p.h -+++ qtbase-opensource-src-5.9.2/src/network/ssl/qsslsocket_openssl_p.h -@@ -1,6 +1,6 @@ - /**************************************************************************** - ** --** Copyright (C) 2016 The Qt Company Ltd. -+** Copyright (C) 2017 The Qt Company Ltd. - ** Contact: https://www.qt.io/licensing/ - ** - ** This file is part of the QtNetwork module of the Qt Toolkit. -@@ -98,8 +98,8 @@ - #include - #include - --#if OPENSSL_VERSION_NUMBER >= 0x10000000L --typedef _STACK STACK; -+#if QT_CONFIG(opensslv11) -+#include - #endif - - QT_BEGIN_NAMESPACE -@@ -151,7 +151,7 @@ public: - #endif - - Q_AUTOTEST_EXPORT static long setupOpenSslOptions(QSsl::SslProtocol protocol, QSsl::SslOptions sslOptions); -- static QSslCipher QSslCipher_from_SSL_CIPHER(SSL_CIPHER *cipher); -+ static QSslCipher QSslCipher_from_SSL_CIPHER(const SSL_CIPHER *cipher); - static QList STACKOFX509_to_QSslCertificates(STACK_OF(X509) *x509); - static QList verify(const QList &certificateChain, const QString &hostName); - static QString getErrorsFromOpenSsl(); -Index: qtbase-opensource-src-5.9.2/src/network/ssl/qsslsocket_openssl_symbols.cpp -=================================================================== ---- qtbase-opensource-src-5.9.2.orig/src/network/ssl/qsslsocket_openssl_symbols.cpp -+++ qtbase-opensource-src-5.9.2/src/network/ssl/qsslsocket_openssl_symbols.cpp -@@ -1,7 +1,8 @@ - /**************************************************************************** - ** --** Copyright (C) 2016 The Qt Company Ltd. -+** Copyright (C) 2017 The Qt Company Ltd. - ** Copyright (C) 2014 BlackBerry Limited. All rights reserved. -+** Copyright (C) 2016 Richard J. Moore - ** Contact: https://www.qt.io/licensing/ - ** - ** This file is part of the QtNetwork module of the Qt Toolkit. -@@ -136,49 +137,195 @@ void qsslSocketCannotResolveSymbolWarnin - - #endif // QT_LINKED_OPENSSL - -+#if QT_CONFIG(opensslv11) -+ -+// Below are the functions first introduced in version 1.1: -+ -+DEFINEFUNC(const unsigned char *, ASN1_STRING_get0_data, const ASN1_STRING *a, a, return 0, return) -+DEFINEFUNC2(int, OPENSSL_init_ssl, uint64_t opts, opts, const OPENSSL_INIT_SETTINGS *settings, settings, return 0, return) -+DEFINEFUNC2(int, OPENSSL_init_crypto, uint64_t opts, opts, const OPENSSL_INIT_SETTINGS *settings, settings, return 0, return) -+DEFINEFUNC(BIO *, BIO_new, const BIO_METHOD *a, a, return 0, return) -+DEFINEFUNC(const BIO_METHOD *, BIO_s_mem, void, DUMMYARG, return 0, return) -+DEFINEFUNC2(int, BN_is_word, BIGNUM *a, a, BN_ULONG w, w, return 0, return) -+DEFINEFUNC(int, EVP_CIPHER_CTX_reset, EVP_CIPHER_CTX *c, c, return 0, return) -+DEFINEFUNC(int, EVP_PKEY_base_id, EVP_PKEY *a, a, return NID_undef, return) -+DEFINEFUNC(int, RSA_bits, RSA *a, a, return 0, return) -+DEFINEFUNC(int, DSA_bits, DSA *a, a, return 0, return) -+DEFINEFUNC(int, OPENSSL_sk_num, OPENSSL_STACK *a, a, return -1, return) -+DEFINEFUNC2(void, OPENSSL_sk_pop_free, OPENSSL_STACK *a, a, void (*b)(void*), b, return, DUMMYARG) -+DEFINEFUNC(OPENSSL_STACK *, OPENSSL_sk_new_null, DUMMYARG, DUMMYARG, return 0, return) -+DEFINEFUNC2(void, OPENSSL_sk_push, OPENSSL_STACK *a, a, void *b, b, return, DUMMYARG) -+DEFINEFUNC(void, OPENSSL_sk_free, OPENSSL_STACK *a, a, return, DUMMYARG) -+DEFINEFUNC2(void *, OPENSSL_sk_value, OPENSSL_STACK *a, a, int b, b, return 0, return) -+DEFINEFUNC(int, SSL_session_reused, SSL *a, a, return 0, return) -+DEFINEFUNC2(unsigned long, SSL_CTX_set_options, SSL_CTX *ctx, ctx, unsigned long op, op, return 0, return) -+DEFINEFUNC3(size_t, SSL_get_client_random, SSL *a, a, unsigned char *out, out, size_t outlen, outlen, return 0, return) -+DEFINEFUNC3(size_t, SSL_SESSION_get_master_key, const SSL_SESSION *ses, ses, unsigned char *out, out, size_t outlen, outlen, return 0, return) -+DEFINEFUNC6(int, CRYPTO_get_ex_new_index, int class_index, class_index, long argl, argl, void *argp, argp, CRYPTO_EX_new *new_func, new_func, CRYPTO_EX_dup *dup_func, dup_func, CRYPTO_EX_free *free_func, free_func, return -1, return) -+ -+DEFINEFUNC(const SSL_METHOD *, TLS_method, DUMMYARG, DUMMYARG, return 0, return) -+DEFINEFUNC(const SSL_METHOD *, TLS_client_method, DUMMYARG, DUMMYARG, return 0, return) -+DEFINEFUNC(const SSL_METHOD *, TLS_server_method, DUMMYARG, DUMMYARG, return 0, return) -+DEFINEFUNC(ASN1_TIME *, X509_getm_notBefore, X509 *a, a, return 0, return) -+DEFINEFUNC(ASN1_TIME *, X509_getm_notAfter, X509 *a, a, return 0, return) -+DEFINEFUNC(long, X509_get_version, X509 *a, a, return -1, return) -+DEFINEFUNC(EVP_PKEY *, X509_get_pubkey, X509 *a, a, return 0, return) -+DEFINEFUNC2(void, X509_STORE_set_verify_cb, X509_STORE *a, a, X509_STORE_CTX_verify_cb verify_cb, verify_cb, return, DUMMYARG) -+DEFINEFUNC(STACK_OF(X509) *, X509_STORE_CTX_get0_chain, X509_STORE_CTX *a, a, return 0, return) -+DEFINEFUNC3(void, CRYPTO_free, void *str, str, const char *file, file, int line, line, return, DUMMYARG) -+DEFINEFUNC(long, OpenSSL_version_num, void, DUMMYARG, return 0, return) -+DEFINEFUNC(const char *, OpenSSL_version, int a, a, return 0, return) -+DEFINEFUNC(unsigned long, SSL_SESSION_get_ticket_lifetime_hint, const SSL_SESSION *session, session, return 0, return) -+DEFINEFUNC4(void, DH_get0_pqg, const DH *dh, dh, const BIGNUM **p, p, const BIGNUM **q, q, const BIGNUM **g, g, return, DUMMYARG) -+DEFINEFUNC(int, DH_bits, DH *dh, dh, return 0, return) -+ -+#else // QT_CONFIG(opensslv11) -+ -+// Functions below are either deprecated or removed in OpenSSL >= 1.1: -+ -+DEFINEFUNC(unsigned char *, ASN1_STRING_data, ASN1_STRING *a, a, return 0, return) -+ - #ifdef SSLEAY_MACROS - DEFINEFUNC3(void *, ASN1_dup, i2d_of_void *a, a, d2i_of_void *b, b, char *c, c, return 0, return) - #endif -+DEFINEFUNC2(BIO *, BIO_new_file, const char *filename, filename, const char *mode, mode, return 0, return) -+DEFINEFUNC(void, ERR_clear_error, DUMMYARG, DUMMYARG, return, DUMMYARG) -+DEFINEFUNC(BIO *, BIO_new, BIO_METHOD *a, a, return 0, return) -+DEFINEFUNC(BIO_METHOD *, BIO_s_mem, void, DUMMYARG, return 0, return) -+DEFINEFUNC(int, CRYPTO_num_locks, DUMMYARG, DUMMYARG, return 0, return) -+DEFINEFUNC(void, CRYPTO_set_locking_callback, void (*a)(int, int, const char *, int), a, return, DUMMYARG) -+DEFINEFUNC(void, CRYPTO_set_id_callback, unsigned long (*a)(), a, return, DUMMYARG) -+DEFINEFUNC(void, CRYPTO_free, void *a, a, return, DUMMYARG) -+DEFINEFUNC(unsigned long, ERR_peek_last_error, DUMMYARG, DUMMYARG, return 0, return) -+DEFINEFUNC(void, ERR_free_strings, void, DUMMYARG, return, DUMMYARG) -+DEFINEFUNC(void, EVP_CIPHER_CTX_cleanup, EVP_CIPHER_CTX *a, a, return, DUMMYARG) -+DEFINEFUNC(void, EVP_CIPHER_CTX_init, EVP_CIPHER_CTX *a, a, return, DUMMYARG) -+ -+#ifdef SSLEAY_MACROS -+DEFINEFUNC6(void *, PEM_ASN1_read_bio, d2i_of_void *a, a, const char *b, b, BIO *c, c, void **d, d, pem_password_cb *e, e, void *f, f, return 0, return) -+DEFINEFUNC6(void *, PEM_ASN1_write_bio, d2i_of_void *a, a, const char *b, b, BIO *c, c, void **d, d, pem_password_cb *e, e, void *f, f, return 0, return) -+#endif // SSLEAY_MACROS -+ -+DEFINEFUNC(int, sk_num, STACK *a, a, return -1, return) -+DEFINEFUNC2(void, sk_pop_free, STACK *a, a, void (*b)(void*), b, return, DUMMYARG) -+ -+#if OPENSSL_VERSION_NUMBER >= 0x10000000L -+DEFINEFUNC(_STACK *, sk_new_null, DUMMYARG, DUMMYARG, return 0, return) -+DEFINEFUNC2(void, sk_push, _STACK *a, a, void *b, b, return, DUMMYARG) -+DEFINEFUNC(void, sk_free, _STACK *a, a, return, DUMMYARG) -+DEFINEFUNC2(void *, sk_value, STACK *a, a, int b, b, return 0, return) -+#else -+DEFINEFUNC(STACK *, sk_new_null, DUMMYARG, DUMMYARG, return 0, return) -+DEFINEFUNC2(void, sk_push, STACK *a, a, char *b, b, return, DUMMYARG) -+DEFINEFUNC(void, sk_free, STACK *a, a, return, DUMMYARG) -+DEFINEFUNC2(char *, sk_value, STACK *a, a, int b, b, return 0, return) -+#endif // OPENSSL_VERSION_NUMBER >= 0x10000000L -+ -+DEFINEFUNC(int, SSL_library_init, void, DUMMYARG, return -1, return) -+DEFINEFUNC(void, SSL_load_error_strings, void, DUMMYARG, return, DUMMYARG) -+ -+#if OPENSSL_VERSION_NUMBER >= 0x10001000L -+DEFINEFUNC5(int, SSL_get_ex_new_index, long argl, argl, void *argp, argp, CRYPTO_EX_new *new_func, new_func, CRYPTO_EX_dup *dup_func, dup_func, CRYPTO_EX_free *free_func, free_func, return -1, return) -+#endif // OPENSSL_VERSION_NUMBER >= 0x10001000L -+ -+#if OPENSSL_VERSION_NUMBER >= 0x10000000L -+#ifndef OPENSSL_NO_SSL2 -+DEFINEFUNC(const SSL_METHOD *, SSLv2_client_method, DUMMYARG, DUMMYARG, return 0, return) -+#endif -+#ifndef OPENSSL_NO_SSL3_METHOD -+DEFINEFUNC(const SSL_METHOD *, SSLv3_client_method, DUMMYARG, DUMMYARG, return 0, return) -+#endif -+DEFINEFUNC(const SSL_METHOD *, SSLv23_client_method, DUMMYARG, DUMMYARG, return 0, return) -+DEFINEFUNC(const SSL_METHOD *, TLSv1_client_method, DUMMYARG, DUMMYARG, return 0, return) -+#if OPENSSL_VERSION_NUMBER >= 0x10001000L -+DEFINEFUNC(const SSL_METHOD *, TLSv1_1_client_method, DUMMYARG, DUMMYARG, return 0, return) -+DEFINEFUNC(const SSL_METHOD *, TLSv1_2_client_method, DUMMYARG, DUMMYARG, return 0, return) -+#endif -+#ifndef OPENSSL_NO_SSL2 -+DEFINEFUNC(const SSL_METHOD *, SSLv2_server_method, DUMMYARG, DUMMYARG, return 0, return) -+#endif -+#ifndef OPENSSL_NO_SSL3_METHOD -+DEFINEFUNC(const SSL_METHOD *, SSLv3_server_method, DUMMYARG, DUMMYARG, return 0, return) -+#endif -+DEFINEFUNC(const SSL_METHOD *, SSLv23_server_method, DUMMYARG, DUMMYARG, return 0, return) -+DEFINEFUNC(const SSL_METHOD *, TLSv1_server_method, DUMMYARG, DUMMYARG, return 0, return) -+#if OPENSSL_VERSION_NUMBER >= 0x10001000L -+DEFINEFUNC(const SSL_METHOD *, TLSv1_1_server_method, DUMMYARG, DUMMYARG, return 0, return) -+DEFINEFUNC(const SSL_METHOD *, TLSv1_2_server_method, DUMMYARG, DUMMYARG, return 0, return) -+#endif -+#else -+#ifndef OPENSSL_NO_SSL2 -+DEFINEFUNC(SSL_METHOD *, SSLv2_client_method, DUMMYARG, DUMMYARG, return 0, return) -+#endif -+#ifndef OPENSSL_NO_SSL3_METHOD -+DEFINEFUNC(SSL_METHOD *, SSLv3_client_method, DUMMYARG, DUMMYARG, return 0, return) -+#endif -+DEFINEFUNC(SSL_METHOD *, SSLv23_client_method, DUMMYARG, DUMMYARG, return 0, return) -+DEFINEFUNC(SSL_METHOD *, TLSv1_client_method, DUMMYARG, DUMMYARG, return 0, return) -+#ifndef OPENSSL_NO_SSL2 -+DEFINEFUNC(SSL_METHOD *, SSLv2_server_method, DUMMYARG, DUMMYARG, return 0, return) -+#endif -+#ifndef OPENSSL_NO_SSL3_METHOD -+DEFINEFUNC(SSL_METHOD *, SSLv3_server_method, DUMMYARG, DUMMYARG, return 0, return) -+#endif -+DEFINEFUNC(SSL_METHOD *, SSLv23_server_method, DUMMYARG, DUMMYARG, return 0, return) -+DEFINEFUNC(SSL_METHOD *, TLSv1_server_method, DUMMYARG, DUMMYARG, return 0, return) -+#endif -+ -+DEFINEFUNC(STACK_OF(X509) *, X509_STORE_CTX_get_chain, X509_STORE_CTX *a, a, return 0, return) -+ -+#ifdef SSLEAY_MACROS -+DEFINEFUNC2(int, i2d_DSAPrivateKey, const DSA *a, a, unsigned char **b, b, return -1, return) -+DEFINEFUNC2(int, i2d_RSAPrivateKey, const RSA *a, a, unsigned char **b, b, return -1, return) -+#ifndef OPENSSL_NO_EC -+DEFINEFUNC2(int, i2d_ECPrivateKey, const EC_KEY *a, a, unsigned char **b, b, return -1, return) -+#endif -+DEFINEFUNC3(RSA *, d2i_RSAPrivateKey, RSA **a, a, unsigned char **b, b, long c, c, return 0, return) -+DEFINEFUNC3(DSA *, d2i_DSAPrivateKey, DSA **a, a, unsigned char **b, b, long c, c, return 0, return) -+#ifndef OPENSSL_NO_EC -+DEFINEFUNC3(EC_KEY *, d2i_ECPrivateKey, EC_KEY **a, a, unsigned char **b, b, long c, c, return 0, return) -+#endif -+#endif -+DEFINEFUNC(char *, CONF_get1_default_config_file, DUMMYARG, DUMMYARG, return 0, return) -+DEFINEFUNC(void, OPENSSL_add_all_algorithms_noconf, void, DUMMYARG, return, DUMMYARG) -+DEFINEFUNC(void, OPENSSL_add_all_algorithms_conf, void, DUMMYARG, return, DUMMYARG) -+DEFINEFUNC(long, SSLeay, void, DUMMYARG, return 0, return) -+DEFINEFUNC(const char *, SSLeay_version, int a, a, return 0, return) -+ -+#endif // QT_CONFIG(opensslv11) -+ - DEFINEFUNC(long, ASN1_INTEGER_get, ASN1_INTEGER *a, a, return 0, return) --DEFINEFUNC(unsigned char *, ASN1_STRING_data, ASN1_STRING *a, a, return 0, return) - DEFINEFUNC(int, ASN1_STRING_length, ASN1_STRING *a, a, return 0, return) --DEFINEFUNC2(int, ASN1_STRING_to_UTF8, unsigned char **a, a, ASN1_STRING *b, b, return 0, return); -+DEFINEFUNC2(int, ASN1_STRING_to_UTF8, unsigned char **a, a, ASN1_STRING *b, b, return 0, return) - DEFINEFUNC4(long, BIO_ctrl, BIO *a, a, int b, b, long c, c, void *d, d, return -1, return) - DEFINEFUNC(int, BIO_free, BIO *a, a, return 0, return) --DEFINEFUNC(BIO *, BIO_new, BIO_METHOD *a, a, return 0, return) - DEFINEFUNC2(BIO *, BIO_new_mem_buf, void *a, a, int b, b, return 0, return) - DEFINEFUNC3(int, BIO_read, BIO *a, a, void *b, b, int c, c, return -1, return) --DEFINEFUNC(BIO_METHOD *, BIO_s_mem, void, DUMMYARG, return 0, return) -+ - DEFINEFUNC3(int, BIO_write, BIO *a, a, const void *b, b, int c, c, return -1, return) - DEFINEFUNC(int, BN_num_bits, const BIGNUM *a, a, return 0, return) --#if OPENSSL_VERSION_NUMBER >= 0x10100000L --DEFINEFUNC2(int, BN_is_word, BIGNUM *a, a, BN_ULONG w, w, return 0, return) --#endif - DEFINEFUNC2(BN_ULONG, BN_mod_word, const BIGNUM *a, a, BN_ULONG w, w, return static_cast(-1), return) - #ifndef OPENSSL_NO_EC - DEFINEFUNC(const EC_GROUP*, EC_KEY_get0_group, const EC_KEY* k, k, return 0, return) - DEFINEFUNC(int, EC_GROUP_get_degree, const EC_GROUP* g, g, return 0, return) - #endif --DEFINEFUNC(int, CRYPTO_num_locks, DUMMYARG, DUMMYARG, return 0, return) --DEFINEFUNC(void, CRYPTO_set_locking_callback, void (*a)(int, int, const char *, int), a, return, DUMMYARG) --DEFINEFUNC(void, CRYPTO_set_id_callback, unsigned long (*a)(), a, return, DUMMYARG) --DEFINEFUNC(void, CRYPTO_free, void *a, a, return, DUMMYARG) - DEFINEFUNC(DSA *, DSA_new, DUMMYARG, DUMMYARG, return 0, return) - DEFINEFUNC(void, DSA_free, DSA *a, a, return, DUMMYARG) - DEFINEFUNC3(X509 *, d2i_X509, X509 **a, a, const unsigned char **b, b, long c, c, return 0, return) - DEFINEFUNC2(char *, ERR_error_string, unsigned long a, a, char *b, b, return 0, return) - DEFINEFUNC(unsigned long, ERR_get_error, DUMMYARG, DUMMYARG, return 0, return) --DEFINEFUNC(void, ERR_free_strings, void, DUMMYARG, return, DUMMYARG) --DEFINEFUNC(void, EVP_CIPHER_CTX_cleanup, EVP_CIPHER_CTX *a, a, return, DUMMYARG) --DEFINEFUNC(void, EVP_CIPHER_CTX_init, EVP_CIPHER_CTX *a, a, return, DUMMYARG) --DEFINEFUNC4(int, EVP_CIPHER_CTX_ctrl, EVP_CIPHER_CTX *ctx, ctx, int type, type, int arg, arg, void *ptr, ptr, return 0, return); -+DEFINEFUNC(EVP_CIPHER_CTX *, EVP_CIPHER_CTX_new, void, DUMMYARG, return 0, return) -+DEFINEFUNC(void, EVP_CIPHER_CTX_free, EVP_CIPHER_CTX *a, a, return, DUMMYARG) -+DEFINEFUNC4(int, EVP_CIPHER_CTX_ctrl, EVP_CIPHER_CTX *ctx, ctx, int type, type, int arg, arg, void *ptr, ptr, return 0, return) - DEFINEFUNC2(int, EVP_CIPHER_CTX_set_key_length, EVP_CIPHER_CTX *ctx, ctx, int keylen, keylen, return 0, return) --DEFINEFUNC5(int, EVP_CipherInit, EVP_CIPHER_CTX *ctx, ctx, const EVP_CIPHER *type, type, 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); -+DEFINEFUNC5(int, EVP_CipherInit, EVP_CIPHER_CTX *ctx, ctx, const EVP_CIPHER *type, type, const unsigned char *key, key, const unsigned char *iv, iv, int enc, enc, return 0, return) -+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) - 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) - DEFINEFUNC(const EVP_CIPHER *, EVP_rc2_cbc, DUMMYARG, DUMMYARG, return 0, return) -+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) - DEFINEFUNC2(int, EVP_PKEY_set1_DSA, EVP_PKEY *a, a, DSA *b, b, return -1, return) -@@ -202,10 +349,8 @@ DEFINEFUNC3(int, i2t_ASN1_OBJECT, char * - DEFINEFUNC4(int, OBJ_obj2txt, char *a, a, int b, b, ASN1_OBJECT *c, c, int d, d, return -1, return) - - DEFINEFUNC(int, OBJ_obj2nid, const ASN1_OBJECT *a, a, return NID_undef, return) --#ifdef SSLEAY_MACROS --DEFINEFUNC6(void *, PEM_ASN1_read_bio, d2i_of_void *a, a, const char *b, b, BIO *c, c, void **d, d, pem_password_cb *e, e, void *f, f, return 0, return) --DEFINEFUNC6(void *, PEM_ASN1_write_bio, d2i_of_void *a, a, const char *b, b, BIO *c, c, void **d, d, pem_password_cb *e, e, void *f, f, return 0, return) --#else -+ -+#ifndef SSLEAY_MACROS - DEFINEFUNC4(EVP_PKEY *, PEM_read_bio_PrivateKey, BIO *a, a, EVP_PKEY **b, b, pem_password_cb *c, c, void *d, d, return 0, return) - DEFINEFUNC4(DSA *, PEM_read_bio_DSAPrivateKey, BIO *a, a, DSA **b, b, pem_password_cb *c, c, void *d, d, return 0, return) - DEFINEFUNC4(RSA *, PEM_read_bio_RSAPrivateKey, BIO *a, a, RSA **b, b, pem_password_cb *c, c, void *d, d, return 0, return) -@@ -218,7 +363,7 @@ DEFINEFUNC7(int, PEM_write_bio_RSAPrivat - #ifndef OPENSSL_NO_EC - DEFINEFUNC7(int, PEM_write_bio_ECPrivateKey, BIO *a, a, EC_KEY *b, b, const EVP_CIPHER *c, c, unsigned char *d, d, int e, e, pem_password_cb *f, f, void *g, g, return 0, return) - #endif --#endif -+#endif // !SSLEAY_MACROS - DEFINEFUNC4(EVP_PKEY *, PEM_read_bio_PUBKEY, BIO *a, a, EVP_PKEY **b, b, pem_password_cb *c, c, void *d, d, return 0, return) - DEFINEFUNC4(DSA *, PEM_read_bio_DSA_PUBKEY, BIO *a, a, DSA **b, b, pem_password_cb *c, c, void *d, d, return 0, return) - DEFINEFUNC4(RSA *, PEM_read_bio_RSA_PUBKEY, BIO *a, a, RSA **b, b, pem_password_cb *c, c, void *d, d, return 0, return) -@@ -234,23 +379,10 @@ DEFINEFUNC2(void, RAND_seed, const void - DEFINEFUNC(int, RAND_status, void, DUMMYARG, return -1, return) - DEFINEFUNC(RSA *, RSA_new, DUMMYARG, DUMMYARG, return 0, return) - DEFINEFUNC(void, RSA_free, RSA *a, a, return, DUMMYARG) --DEFINEFUNC(int, sk_num, STACK *a, a, return -1, return) --DEFINEFUNC2(void, sk_pop_free, STACK *a, a, void (*b)(void*), b, return, DUMMYARG) --#if OPENSSL_VERSION_NUMBER >= 0x10000000L --DEFINEFUNC(_STACK *, sk_new_null, DUMMYARG, DUMMYARG, return 0, return) --DEFINEFUNC2(void, sk_push, _STACK *a, a, void *b, b, return, DUMMYARG) --DEFINEFUNC(void, sk_free, _STACK *a, a, return, DUMMYARG) --DEFINEFUNC2(void *, sk_value, STACK *a, a, int b, b, return 0, return) --#else --DEFINEFUNC(STACK *, sk_new_null, DUMMYARG, DUMMYARG, return 0, return) --DEFINEFUNC2(void, sk_push, STACK *a, a, char *b, b, return, DUMMYARG) --DEFINEFUNC(void, sk_free, STACK *a, a, return, DUMMYARG) --DEFINEFUNC2(char *, sk_value, STACK *a, a, int b, b, return 0, return) --#endif - DEFINEFUNC(int, SSL_accept, SSL *a, a, return -1, return) - DEFINEFUNC(int, SSL_clear, SSL *a, a, return -1, return) --DEFINEFUNC3(char *, SSL_CIPHER_description, SSL_CIPHER *a, a, char *b, b, int c, c, return 0, return) --DEFINEFUNC2(int, SSL_CIPHER_get_bits, SSL_CIPHER *a, a, int *b, b, return 0, return) -+DEFINEFUNC3(char *, SSL_CIPHER_description, const SSL_CIPHER *a, a, char *b, b, int c, c, return 0, return) -+DEFINEFUNC2(int, SSL_CIPHER_get_bits, const SSL_CIPHER *a, a, int *b, b, return 0, return) - DEFINEFUNC(int, SSL_connect, SSL *a, a, return -1, return) - DEFINEFUNC(int, SSL_CTX_check_private_key, const SSL_CTX *a, a, return -1, return) - DEFINEFUNC4(long, SSL_CTX_ctrl, SSL_CTX *a, a, int b, b, long c, c, void *d, d, return -1, return) -@@ -287,8 +419,6 @@ DEFINEFUNC(long, SSL_get_verify_result, - #else - DEFINEFUNC(long, SSL_get_verify_result, SSL *a, a, return -1, return) - #endif --DEFINEFUNC(int, SSL_library_init, void, DUMMYARG, return -1, return) --DEFINEFUNC(void, SSL_load_error_strings, void, DUMMYARG, return, DUMMYARG) - DEFINEFUNC(SSL *, SSL_new, SSL_CTX *a, a, return 0, return) - DEFINEFUNC4(long, SSL_ctrl, SSL *a, a, int cmd, cmd, long larg, larg, void *parg, parg, return -1, return) - DEFINEFUNC3(int, SSL_read, SSL *a, a, void *b, b, int c, c, return -1, return) -@@ -301,7 +431,6 @@ DEFINEFUNC(void, SSL_SESSION_free, SSL_S - DEFINEFUNC(SSL_SESSION*, SSL_get1_session, SSL *ssl, ssl, return 0, return) - DEFINEFUNC(SSL_SESSION*, SSL_get_session, const SSL *ssl, ssl, return 0, return) - #if OPENSSL_VERSION_NUMBER >= 0x10001000L --DEFINEFUNC5(int, SSL_get_ex_new_index, long argl, argl, void *argp, argp, CRYPTO_EX_new *new_func, new_func, CRYPTO_EX_dup *dup_func, dup_func, CRYPTO_EX_free *free_func, free_func, return -1, return) - DEFINEFUNC3(int, SSL_set_ex_data, SSL *ssl, ssl, int idx, idx, void *arg, arg, return 0, return) - DEFINEFUNC2(void *, SSL_get_ex_data, const SSL *ssl, ssl, int idx, idx, return NULL, return) - #endif -@@ -310,51 +439,9 @@ DEFINEFUNC2(void, SSL_set_psk_client_cal - DEFINEFUNC2(void, SSL_set_psk_server_callback, SSL* ssl, ssl, q_psk_server_callback_t callback, callback, return, DUMMYARG) - DEFINEFUNC2(int, SSL_CTX_use_psk_identity_hint, SSL_CTX* ctx, ctx, const char *hint, hint, return 0, return) - #endif --#if OPENSSL_VERSION_NUMBER >= 0x10000000L --#ifndef OPENSSL_NO_SSL2 --DEFINEFUNC(const SSL_METHOD *, SSLv2_client_method, DUMMYARG, DUMMYARG, return 0, return) --#endif --#ifndef OPENSSL_NO_SSL3_METHOD --DEFINEFUNC(const SSL_METHOD *, SSLv3_client_method, DUMMYARG, DUMMYARG, return 0, return) --#endif --DEFINEFUNC(const SSL_METHOD *, SSLv23_client_method, DUMMYARG, DUMMYARG, return 0, return) --DEFINEFUNC(const SSL_METHOD *, TLSv1_client_method, DUMMYARG, DUMMYARG, return 0, return) --#if OPENSSL_VERSION_NUMBER >= 0x10001000L --DEFINEFUNC(const SSL_METHOD *, TLSv1_1_client_method, DUMMYARG, DUMMYARG, return 0, return) --DEFINEFUNC(const SSL_METHOD *, TLSv1_2_client_method, DUMMYARG, DUMMYARG, return 0, return) --#endif --#ifndef OPENSSL_NO_SSL2 --DEFINEFUNC(const SSL_METHOD *, SSLv2_server_method, DUMMYARG, DUMMYARG, return 0, return) --#endif --#ifndef OPENSSL_NO_SSL3_METHOD --DEFINEFUNC(const SSL_METHOD *, SSLv3_server_method, DUMMYARG, DUMMYARG, return 0, return) --#endif --DEFINEFUNC(const SSL_METHOD *, SSLv23_server_method, DUMMYARG, DUMMYARG, return 0, return) --DEFINEFUNC(const SSL_METHOD *, TLSv1_server_method, DUMMYARG, DUMMYARG, return 0, return) --#if OPENSSL_VERSION_NUMBER >= 0x10001000L --DEFINEFUNC(const SSL_METHOD *, TLSv1_1_server_method, DUMMYARG, DUMMYARG, return 0, return) --DEFINEFUNC(const SSL_METHOD *, TLSv1_2_server_method, DUMMYARG, DUMMYARG, return 0, return) --#endif --#else --#ifndef OPENSSL_NO_SSL2 --DEFINEFUNC(SSL_METHOD *, SSLv2_client_method, DUMMYARG, DUMMYARG, return 0, return) --#endif --#ifndef OPENSSL_NO_SSL3_METHOD --DEFINEFUNC(SSL_METHOD *, SSLv3_client_method, DUMMYARG, DUMMYARG, return 0, return) --#endif --DEFINEFUNC(SSL_METHOD *, SSLv23_client_method, DUMMYARG, DUMMYARG, return 0, return) --DEFINEFUNC(SSL_METHOD *, TLSv1_client_method, DUMMYARG, DUMMYARG, return 0, return) --#ifndef OPENSSL_NO_SSL2 --DEFINEFUNC(SSL_METHOD *, SSLv2_server_method, DUMMYARG, DUMMYARG, return 0, return) --#endif --#ifndef OPENSSL_NO_SSL3_METHOD --DEFINEFUNC(SSL_METHOD *, SSLv3_server_method, DUMMYARG, DUMMYARG, return 0, return) --#endif --DEFINEFUNC(SSL_METHOD *, SSLv23_server_method, DUMMYARG, DUMMYARG, return 0, return) --DEFINEFUNC(SSL_METHOD *, TLSv1_server_method, DUMMYARG, DUMMYARG, return 0, return) --#endif - DEFINEFUNC3(int, SSL_write, SSL *a, a, const void *b, b, int c, c, return -1, return) - DEFINEFUNC2(int, X509_cmp, X509 *a, a, X509 *b, b, return -1, return) -+DEFINEFUNC4(int, X509_digest, const X509 *x509, x509, const EVP_MD *type, type, unsigned char *md, md, unsigned int *len, len, return -1, return) - #ifndef SSLEAY_MACROS - DEFINEFUNC(X509 *, X509_dup, X509 *a, a, return 0, return) - #endif -@@ -378,6 +465,7 @@ DEFINEFUNC2(int, ASN1_STRING_print, BIO - DEFINEFUNC2(int, X509_check_issued, X509 *a, a, X509 *b, b, return -1, return) - DEFINEFUNC(X509_NAME *, X509_get_issuer_name, X509 *a, a, return 0, return) - DEFINEFUNC(X509_NAME *, X509_get_subject_name, X509 *a, a, return 0, return) -+DEFINEFUNC(ASN1_INTEGER *, X509_get_serialNumber, X509 *a, a, return 0, return) - DEFINEFUNC(int, X509_verify_cert, X509_STORE_CTX *a, a, return -1, return) - DEFINEFUNC(int, X509_NAME_entry_count, X509_NAME *a, a, return 0, return) - DEFINEFUNC2(X509_NAME_ENTRY *, X509_NAME_get_entry, X509_NAME *a, a, int b, b, return 0, return) -@@ -393,7 +481,6 @@ DEFINEFUNC2(int, X509_STORE_CTX_set_purp - DEFINEFUNC(int, X509_STORE_CTX_get_error, X509_STORE_CTX *a, a, return -1, return) - DEFINEFUNC(int, X509_STORE_CTX_get_error_depth, X509_STORE_CTX *a, a, return -1, return) - DEFINEFUNC(X509 *, X509_STORE_CTX_get_current_cert, X509_STORE_CTX *a, a, return 0, return) --DEFINEFUNC(STACK_OF(X509) *, X509_STORE_CTX_get_chain, X509_STORE_CTX *a, a, return 0, return) - DEFINEFUNC(X509_STORE_CTX *, X509_STORE_CTX_new, DUMMYARG, DUMMYARG, return 0, return) - #ifdef SSLEAY_MACROS - DEFINEFUNC2(int, i2d_DSAPrivateKey, const DSA *a, a, unsigned char **b, b, return -1, return) -@@ -407,11 +494,7 @@ DEFINEFUNC3(DSA *, d2i_DSAPrivateKey, DS - DEFINEFUNC3(EC_KEY *, d2i_ECPrivateKey, EC_KEY **a, a, unsigned char **b, b, long c, c, return 0, return) - #endif - #endif --DEFINEFUNC(void, OPENSSL_add_all_algorithms_noconf, void, DUMMYARG, return, DUMMYARG) --DEFINEFUNC(void, OPENSSL_add_all_algorithms_conf, void, DUMMYARG, return, DUMMYARG) - DEFINEFUNC3(int, SSL_CTX_load_verify_locations, SSL_CTX *ctx, ctx, const char *CAfile, CAfile, const char *CApath, CApath, return 0, return) --DEFINEFUNC(long, SSLeay, void, DUMMYARG, return 0, return) --DEFINEFUNC(const char *, SSLeay_version, int a, a, return 0, return) - DEFINEFUNC2(int, i2d_SSL_SESSION, SSL_SESSION *in, in, unsigned char **pp, pp, return 0, return) - DEFINEFUNC3(SSL_SESSION *, d2i_SSL_SESSION, SSL_SESSION **a, a, const unsigned char **pp, pp, long length, length, return 0, return) - #if OPENSSL_VERSION_NUMBER >= 0x1000100fL && !defined(OPENSSL_NO_NEXTPROTONEG) -@@ -694,8 +777,8 @@ static QPair loadO - #ifndef Q_OS_DARWIN - // second attempt: find the development files libssl.so and libcrypto.so - // -- // disabled on OS X/iOS: -- // OS X's /usr/lib/libssl.dylib, /usr/lib/libcrypto.dylib will be picked up in the third -+ // disabled on macOS/iOS: -+ // macOS's /usr/lib/libssl.dylib, /usr/lib/libcrypto.dylib will be picked up in the third - // attempt, _after_ /Contents/Frameworks has been searched. - // iOS does not ship a system libssl.dylib, libcrypto.dylib in the first place. - libssl->setFileNameAndVersion(QLatin1String("ssl"), -1); -@@ -754,8 +837,12 @@ bool q_resolveOpenSslSymbols() - static bool symbolsResolved = false; - static bool triedToResolveSymbols = false; - #ifndef QT_NO_THREAD -+#if QT_CONFIG(opensslv11) -+ QMutexLocker locker(QMutexPool::globalInstanceGet((void *)&q_OPENSSL_init_ssl)); -+#else - QMutexLocker locker(QMutexPool::globalInstanceGet((void *)&q_SSL_library_init)); - #endif -+#endif - if (symbolsResolved) - return true; - if (triedToResolveSymbols) -@@ -771,11 +858,145 @@ bool q_resolveOpenSslSymbols() - // failed to load them - return false; - -+#if QT_CONFIG(opensslv11) -+ -+ RESOLVEFUNC(OPENSSL_init_ssl) -+ RESOLVEFUNC(OPENSSL_init_crypto) -+ RESOLVEFUNC(ASN1_STRING_get0_data) -+ RESOLVEFUNC(EVP_CIPHER_CTX_reset) -+ RESOLVEFUNC(EVP_PKEY_base_id) -+ RESOLVEFUNC(RSA_bits) -+ RESOLVEFUNC(OPENSSL_sk_new_null) -+ RESOLVEFUNC(OPENSSL_sk_push) -+ RESOLVEFUNC(OPENSSL_sk_free) -+ RESOLVEFUNC(OPENSSL_sk_num) -+ RESOLVEFUNC(OPENSSL_sk_pop_free) -+ RESOLVEFUNC(OPENSSL_sk_value) -+ RESOLVEFUNC(DH_get0_pqg) -+ RESOLVEFUNC(SSL_CTX_set_options) -+ RESOLVEFUNC(SSL_get_client_random) -+ RESOLVEFUNC(SSL_SESSION_get_master_key) -+ RESOLVEFUNC(SSL_session_reused) -+ RESOLVEFUNC(SSL_get_session) -+ RESOLVEFUNC(CRYPTO_get_ex_new_index) -+ RESOLVEFUNC(TLS_method) -+ RESOLVEFUNC(TLS_client_method) -+ RESOLVEFUNC(TLS_server_method) -+ RESOLVEFUNC(X509_STORE_CTX_get0_chain) -+ RESOLVEFUNC(X509_getm_notBefore) -+ RESOLVEFUNC(X509_getm_notAfter) -+ RESOLVEFUNC(X509_get_version) -+ RESOLVEFUNC(X509_get_pubkey) -+ RESOLVEFUNC(X509_STORE_set_verify_cb) -+ RESOLVEFUNC(CRYPTO_free) -+ RESOLVEFUNC(OpenSSL_version_num) -+ RESOLVEFUNC(OpenSSL_version) -+ if (!_q_OpenSSL_version) { -+ // Apparently, we were built with OpenSSL 1.1 enabled but are now using -+ // a wrong library. -+ delete libs.first; -+ delete libs.second; -+ qCWarning(lcSsl, "Incompatible version of OpenSSL"); -+ return false; -+ } -+ -+ RESOLVEFUNC(SSL_SESSION_get_ticket_lifetime_hint) -+ RESOLVEFUNC(DH_bits) -+ RESOLVEFUNC(DSA_bits) -+ -+#else // !opensslv11 -+ -+ RESOLVEFUNC(ASN1_STRING_data) -+ - #ifdef SSLEAY_MACROS - RESOLVEFUNC(ASN1_dup) -+#endif // SSLEAY_MACROS -+ RESOLVEFUNC(BIO_new_file) -+ RESOLVEFUNC(ERR_clear_error) -+ RESOLVEFUNC(CRYPTO_free) -+ RESOLVEFUNC(CRYPTO_num_locks) -+ RESOLVEFUNC(CRYPTO_set_id_callback) -+ RESOLVEFUNC(CRYPTO_set_locking_callback) -+ RESOLVEFUNC(ERR_peek_last_error) -+ RESOLVEFUNC(ERR_free_strings) -+ RESOLVEFUNC(EVP_CIPHER_CTX_cleanup) -+ RESOLVEFUNC(EVP_CIPHER_CTX_init) -+ -+#ifdef SSLEAY_MACROS // ### verify -+ RESOLVEFUNC(PEM_ASN1_read_bio) -+#endif // SSLEAY_MACROS -+ -+ RESOLVEFUNC(sk_new_null) -+ RESOLVEFUNC(sk_push) -+ RESOLVEFUNC(sk_free) -+ RESOLVEFUNC(sk_num) -+ RESOLVEFUNC(sk_pop_free) -+ RESOLVEFUNC(sk_value) -+ RESOLVEFUNC(SSL_library_init) -+ RESOLVEFUNC(SSL_load_error_strings) -+#if OPENSSL_VERSION_NUMBER >= 0x10001000L -+ RESOLVEFUNC(SSL_get_ex_new_index) -+#endif -+#ifndef OPENSSL_NO_SSL2 -+ RESOLVEFUNC(SSLv2_client_method) -+#endif -+#ifndef OPENSSL_NO_SSL3_METHOD -+ RESOLVEFUNC(SSLv3_client_method) -+#endif -+ RESOLVEFUNC(SSLv23_client_method) -+ RESOLVEFUNC(TLSv1_client_method) -+#if OPENSSL_VERSION_NUMBER >= 0x10001000L -+ RESOLVEFUNC(TLSv1_1_client_method) -+ RESOLVEFUNC(TLSv1_2_client_method) - #endif -+#ifndef OPENSSL_NO_SSL2 -+ RESOLVEFUNC(SSLv2_server_method) -+#endif -+#ifndef OPENSSL_NO_SSL3_METHOD -+ RESOLVEFUNC(SSLv3_server_method) -+#endif -+ RESOLVEFUNC(SSLv23_server_method) -+ RESOLVEFUNC(TLSv1_server_method) -+#if OPENSSL_VERSION_NUMBER >= 0x10001000L -+ RESOLVEFUNC(TLSv1_1_server_method) -+ RESOLVEFUNC(TLSv1_2_server_method) -+#endif -+ RESOLVEFUNC(X509_STORE_CTX_get_chain) -+#ifdef SSLEAY_MACROS -+ RESOLVEFUNC(i2d_DSAPrivateKey) -+ RESOLVEFUNC(i2d_RSAPrivateKey) -+ RESOLVEFUNC(d2i_DSAPrivateKey) -+ RESOLVEFUNC(d2i_RSAPrivateKey) -+#endif -+ RESOLVEFUNC(CONF_get1_default_config_file) -+ RESOLVEFUNC(OPENSSL_add_all_algorithms_noconf) -+ RESOLVEFUNC(OPENSSL_add_all_algorithms_conf) -+ RESOLVEFUNC(SSLeay) -+ -+ if (!_q_SSLeay || q_SSLeay() >= 0x10100000L) { -+ // OpenSSL 1.1 has deprecated and removed SSLeay. We consider a failure to -+ // resolve this symbol as a failure to resolve symbols. -+ // The right operand of '||' above is ... a bit of paranoia. -+ delete libs.first; -+ delete libs.second; -+ qCWarning(lcSsl, "Incompatible version of OpenSSL"); -+ return false; -+ } -+ -+ -+ RESOLVEFUNC(SSLeay_version) -+ -+#ifndef OPENSSL_NO_EC -+#if OPENSSL_VERSION_NUMBER >= 0x10002000L -+ if (q_SSLeay() >= 0x10002000L) -+ RESOLVEFUNC(EC_curve_nist2nid) -+#endif // OPENSSL_VERSION_NUMBER >= 0x10002000L -+#endif // OPENSSL_NO_EC -+ -+ -+#endif // !opensslv11 -+ - RESOLVEFUNC(ASN1_INTEGER_get) -- RESOLVEFUNC(ASN1_STRING_data) - RESOLVEFUNC(ASN1_STRING_length) - RESOLVEFUNC(ASN1_STRING_to_UTF8) - RESOLVEFUNC(BIO_ctrl) -@@ -794,25 +1015,22 @@ bool q_resolveOpenSslSymbols() - RESOLVEFUNC(BN_is_word) - #endif - RESOLVEFUNC(BN_mod_word) -- RESOLVEFUNC(CRYPTO_free) -- RESOLVEFUNC(CRYPTO_num_locks) -- RESOLVEFUNC(CRYPTO_set_id_callback) -- RESOLVEFUNC(CRYPTO_set_locking_callback) - RESOLVEFUNC(DSA_new) - RESOLVEFUNC(DSA_free) - RESOLVEFUNC(ERR_error_string) - RESOLVEFUNC(ERR_get_error) -- RESOLVEFUNC(ERR_free_strings) -- RESOLVEFUNC(EVP_CIPHER_CTX_cleanup) -- RESOLVEFUNC(EVP_CIPHER_CTX_init) -+ RESOLVEFUNC(EVP_CIPHER_CTX_new) -+ RESOLVEFUNC(EVP_CIPHER_CTX_free) - RESOLVEFUNC(EVP_CIPHER_CTX_ctrl) - RESOLVEFUNC(EVP_CIPHER_CTX_set_key_length) - RESOLVEFUNC(EVP_CipherInit) -+ RESOLVEFUNC(EVP_CipherInit_ex) - RESOLVEFUNC(EVP_CipherUpdate) - RESOLVEFUNC(EVP_CipherFinal) - RESOLVEFUNC(EVP_des_cbc) - RESOLVEFUNC(EVP_des_ede3_cbc) - RESOLVEFUNC(EVP_rc2_cbc) -+ RESOLVEFUNC(EVP_sha1) - RESOLVEFUNC(EVP_PKEY_assign) - RESOLVEFUNC(EVP_PKEY_set1_RSA) - RESOLVEFUNC(EVP_PKEY_set1_DSA) -@@ -834,9 +1052,8 @@ bool q_resolveOpenSslSymbols() - RESOLVEFUNC(i2t_ASN1_OBJECT) - RESOLVEFUNC(OBJ_obj2txt) - RESOLVEFUNC(OBJ_obj2nid) --#ifdef SSLEAY_MACROS // ### verify -- RESOLVEFUNC(PEM_ASN1_read_bio) --#else -+ -+#ifndef SSLEAY_MACROS - RESOLVEFUNC(PEM_read_bio_PrivateKey) - RESOLVEFUNC(PEM_read_bio_DSAPrivateKey) - RESOLVEFUNC(PEM_read_bio_RSAPrivateKey) -@@ -849,7 +1066,8 @@ bool q_resolveOpenSslSymbols() - #ifndef OPENSSL_NO_EC - RESOLVEFUNC(PEM_write_bio_ECPrivateKey) - #endif --#endif -+#endif // !SSLEAY_MACROS -+ - RESOLVEFUNC(PEM_read_bio_PUBKEY) - RESOLVEFUNC(PEM_read_bio_DSA_PUBKEY) - RESOLVEFUNC(PEM_read_bio_RSA_PUBKEY) -@@ -865,12 +1083,6 @@ bool q_resolveOpenSslSymbols() - RESOLVEFUNC(RAND_status) - RESOLVEFUNC(RSA_new) - RESOLVEFUNC(RSA_free) -- RESOLVEFUNC(sk_new_null) -- RESOLVEFUNC(sk_push) -- RESOLVEFUNC(sk_free) -- RESOLVEFUNC(sk_num) -- RESOLVEFUNC(sk_pop_free) -- RESOLVEFUNC(sk_value) - RESOLVEFUNC(SSL_CIPHER_description) - RESOLVEFUNC(SSL_CIPHER_get_bits) - RESOLVEFUNC(SSL_CTX_check_private_key) -@@ -898,8 +1110,6 @@ bool q_resolveOpenSslSymbols() - RESOLVEFUNC(SSL_get_peer_cert_chain) - RESOLVEFUNC(SSL_get_peer_certificate) - RESOLVEFUNC(SSL_get_verify_result) -- RESOLVEFUNC(SSL_library_init) -- RESOLVEFUNC(SSL_load_error_strings) - RESOLVEFUNC(SSL_new) - RESOLVEFUNC(SSL_ctrl) - RESOLVEFUNC(SSL_read) -@@ -912,7 +1122,6 @@ bool q_resolveOpenSslSymbols() - RESOLVEFUNC(SSL_get1_session) - RESOLVEFUNC(SSL_get_session) - #if OPENSSL_VERSION_NUMBER >= 0x10001000L -- RESOLVEFUNC(SSL_get_ex_new_index) - RESOLVEFUNC(SSL_set_ex_data) - RESOLVEFUNC(SSL_get_ex_data) - #endif -@@ -922,30 +1131,6 @@ bool q_resolveOpenSslSymbols() - RESOLVEFUNC(SSL_CTX_use_psk_identity_hint) - #endif - RESOLVEFUNC(SSL_write) --#ifndef OPENSSL_NO_SSL2 -- RESOLVEFUNC(SSLv2_client_method) --#endif --#ifndef OPENSSL_NO_SSL3_METHOD -- RESOLVEFUNC(SSLv3_client_method) --#endif -- RESOLVEFUNC(SSLv23_client_method) -- RESOLVEFUNC(TLSv1_client_method) --#if OPENSSL_VERSION_NUMBER >= 0x10001000L -- RESOLVEFUNC(TLSv1_1_client_method) -- RESOLVEFUNC(TLSv1_2_client_method) --#endif --#ifndef OPENSSL_NO_SSL2 -- RESOLVEFUNC(SSLv2_server_method) --#endif --#ifndef OPENSSL_NO_SSL3_METHOD -- RESOLVEFUNC(SSLv3_server_method) --#endif -- RESOLVEFUNC(SSLv23_server_method) -- RESOLVEFUNC(TLSv1_server_method) --#if OPENSSL_VERSION_NUMBER >= 0x10001000L -- RESOLVEFUNC(TLSv1_1_server_method) -- RESOLVEFUNC(TLSv1_2_server_method) --#endif - RESOLVEFUNC(X509_NAME_entry_count) - RESOLVEFUNC(X509_NAME_get_entry) - RESOLVEFUNC(X509_NAME_ENTRY_get_data) -@@ -961,12 +1146,12 @@ bool q_resolveOpenSslSymbols() - RESOLVEFUNC(X509_STORE_CTX_get_error) - RESOLVEFUNC(X509_STORE_CTX_get_error_depth) - RESOLVEFUNC(X509_STORE_CTX_get_current_cert) -- RESOLVEFUNC(X509_STORE_CTX_get_chain) - RESOLVEFUNC(X509_cmp) - #ifndef SSLEAY_MACROS - RESOLVEFUNC(X509_dup) - #endif - RESOLVEFUNC(X509_print) -+ RESOLVEFUNC(X509_digest) - RESOLVEFUNC(X509_EXTENSION_get_object) - RESOLVEFUNC(X509_free) - RESOLVEFUNC(X509_get_ext) -@@ -982,6 +1167,7 @@ bool q_resolveOpenSslSymbols() - RESOLVEFUNC(X509_check_issued) - RESOLVEFUNC(X509_get_issuer_name) - RESOLVEFUNC(X509_get_subject_name) -+ RESOLVEFUNC(X509_get_serialNumber) - RESOLVEFUNC(X509_verify_cert) - RESOLVEFUNC(d2i_X509) - RESOLVEFUNC(i2d_X509) -@@ -991,11 +1177,7 @@ bool q_resolveOpenSslSymbols() - RESOLVEFUNC(d2i_DSAPrivateKey) - RESOLVEFUNC(d2i_RSAPrivateKey) - #endif -- RESOLVEFUNC(OPENSSL_add_all_algorithms_noconf) -- RESOLVEFUNC(OPENSSL_add_all_algorithms_conf) - RESOLVEFUNC(SSL_CTX_load_verify_locations) -- RESOLVEFUNC(SSLeay) -- RESOLVEFUNC(SSLeay_version) - RESOLVEFUNC(i2d_SSL_SESSION) - RESOLVEFUNC(d2i_SSL_SESSION) - #if OPENSSL_VERSION_NUMBER >= 0x1000100fL && !defined(OPENSSL_NO_NEXTPROTONEG) -@@ -1019,27 +1201,14 @@ bool q_resolveOpenSslSymbols() - RESOLVEFUNC(EC_KEY_new_by_curve_name) - RESOLVEFUNC(EC_KEY_free) - RESOLVEFUNC(EC_get_builtin_curves) --#if OPENSSL_VERSION_NUMBER >= 0x10002000L -- if (q_SSLeay() >= 0x10002000L) -- RESOLVEFUNC(EC_curve_nist2nid) --#endif // OPENSSL_VERSION_NUMBER >= 0x10002000L - #endif // OPENSSL_NO_EC - RESOLVEFUNC(PKCS12_parse) - RESOLVEFUNC(d2i_PKCS12_bio) - RESOLVEFUNC(PKCS12_free) - -+ symbolsResolved = true; - delete libs.first; - delete libs.second; -- if (!_q_SSLeay || q_SSLeay() >= 0x10100000L) { -- // OpenSSL 1.1 deprecated and removed SSLeay. We consider a failure to -- // resolve this symbol as a failure to resolve symbols. -- // The right operand of '||' above ... a bit of paranoia. -- qCWarning(lcSsl, "Incompatible version of OpenSSL"); -- return false; -- } -- -- symbolsResolved = true; -- - return true; - } - #endif // QT_CONFIG(library) -Index: qtbase-opensource-src-5.9.2/src/network/ssl/qsslsocket_openssl_symbols_p.h -=================================================================== ---- qtbase-opensource-src-5.9.2.orig/src/network/ssl/qsslsocket_openssl_symbols_p.h -+++ qtbase-opensource-src-5.9.2/src/network/ssl/qsslsocket_openssl_symbols_p.h -@@ -1,6 +1,6 @@ - /**************************************************************************** - ** --** Copyright (C) 2016 The Qt Company Ltd. -+** Copyright (C) 2017 The Qt Company Ltd. - ** Copyright (C) 2014 BlackBerry Limited. All rights reserved. - ** Contact: https://www.qt.io/licensing/ - ** -@@ -56,6 +56,7 @@ - #ifndef QSSLSOCKET_OPENSSL_SYMBOLS_P_H - #define QSSLSOCKET_OPENSSL_SYMBOLS_P_H - -+ - // - // W A R N I N G - // ------------- -@@ -215,17 +216,20 @@ QT_BEGIN_NAMESPACE - - #endif // !defined QT_LINKED_OPENSSL - -+#if QT_CONFIG(opensslv11) -+#include "qsslsocket_openssl11_symbols_p.h" -+#else -+#include "qsslsocket_opensslpre11_symbols_p.h" -+#endif // QT_CONFIG -+ - bool q_resolveOpenSslSymbols(); - long q_ASN1_INTEGER_get(ASN1_INTEGER *a); --unsigned char * q_ASN1_STRING_data(ASN1_STRING *a); - int q_ASN1_STRING_length(ASN1_STRING *a); - int q_ASN1_STRING_to_UTF8(unsigned char **a, ASN1_STRING *b); - long q_BIO_ctrl(BIO *a, int b, long c, void *d); - Q_AUTOTEST_EXPORT int q_BIO_free(BIO *a); --Q_AUTOTEST_EXPORT BIO *q_BIO_new(BIO_METHOD *a); - BIO *q_BIO_new_mem_buf(void *a, int b); - int q_BIO_read(BIO *a, void *b, int c); --Q_AUTOTEST_EXPORT BIO_METHOD *q_BIO_s_mem(); - Q_AUTOTEST_EXPORT int q_BIO_write(BIO *a, const void *b, int c); - int q_BN_num_bits(const BIGNUM *a); - #if OPENSSL_VERSION_NUMBER >= 0x10100000L -@@ -247,26 +251,23 @@ BN_ULONG q_BN_mod_word(const BIGNUM *a, - const EC_GROUP* q_EC_KEY_get0_group(const EC_KEY* k); - int q_EC_GROUP_get_degree(const EC_GROUP* g); - #endif --int q_CRYPTO_num_locks(); --void q_CRYPTO_set_locking_callback(void (*a)(int, int, const char *, int)); --void q_CRYPTO_set_id_callback(unsigned long (*a)()); --void q_CRYPTO_free(void *a); - DSA *q_DSA_new(); - void q_DSA_free(DSA *a); - X509 *q_d2i_X509(X509 **a, const unsigned char **b, long c); - char *q_ERR_error_string(unsigned long a, char *b); - unsigned long q_ERR_get_error(); --void q_ERR_free_strings(); --void q_EVP_CIPHER_CTX_cleanup(EVP_CIPHER_CTX *a); --void q_EVP_CIPHER_CTX_init(EVP_CIPHER_CTX *a); -+EVP_CIPHER_CTX *q_EVP_CIPHER_CTX_new(); -+void q_EVP_CIPHER_CTX_free(EVP_CIPHER_CTX *a); - int q_EVP_CIPHER_CTX_ctrl(EVP_CIPHER_CTX *ctx, int type, int arg, void *ptr); - int q_EVP_CIPHER_CTX_set_key_length(EVP_CIPHER_CTX *x, int keylen); - int q_EVP_CipherInit(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *type, const unsigned char *key, const unsigned char *iv, int enc); -+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); - const EVP_CIPHER *q_EVP_des_cbc(); - const EVP_CIPHER *q_EVP_des_ede3_cbc(); - const EVP_CIPHER *q_EVP_rc2_cbc(); -+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); - int q_EVP_PKEY_set1_DSA(EVP_PKEY *a, DSA *b); -@@ -310,7 +311,7 @@ int q_PEM_write_bio_RSAPrivateKey(BIO *a - int q_PEM_write_bio_ECPrivateKey(BIO *a, EC_KEY *b, const EVP_CIPHER *c, unsigned char *d, - int e, pem_password_cb *f, void *g); - #endif --#endif -+#endif // SSLEAY_MACROS - Q_AUTOTEST_EXPORT EVP_PKEY *q_PEM_read_bio_PUBKEY(BIO *a, EVP_PKEY **b, pem_password_cb *c, void *d); - DSA *q_PEM_read_bio_DSA_PUBKEY(BIO *a, DSA **b, pem_password_cb *c, void *d); - RSA *q_PEM_read_bio_RSA_PUBKEY(BIO *a, RSA **b, pem_password_cb *c, void *d); -@@ -326,23 +327,10 @@ void q_RAND_seed(const void *a, int b); - int q_RAND_status(); - RSA *q_RSA_new(); - void q_RSA_free(RSA *a); --int q_sk_num(STACK *a); --void q_sk_pop_free(STACK *a, void (*b)(void *)); --#if OPENSSL_VERSION_NUMBER >= 0x10000000L --_STACK *q_sk_new_null(); --void q_sk_push(_STACK *st, void *data); --void q_sk_free(_STACK *a); --void * q_sk_value(STACK *a, int b); --#else --STACK *q_sk_new_null(); --void q_sk_push(STACK *st, char *data); --void q_sk_free(STACK *a); --char * q_sk_value(STACK *a, int b); --#endif - int q_SSL_accept(SSL *a); - int q_SSL_clear(SSL *a); --char *q_SSL_CIPHER_description(SSL_CIPHER *a, char *b, int c); --int q_SSL_CIPHER_get_bits(SSL_CIPHER *a, int *b); -+char *q_SSL_CIPHER_description(const SSL_CIPHER *a, char *b, int c); -+int q_SSL_CIPHER_get_bits(const SSL_CIPHER *a, int *b); - int q_SSL_connect(SSL *a); - int q_SSL_CTX_check_private_key(const SSL_CTX *a); - long q_SSL_CTX_ctrl(SSL_CTX *a, int b, long c, void *d); -@@ -374,8 +362,6 @@ int q_SSL_get_error(SSL *a, int b); - STACK_OF(X509) *q_SSL_get_peer_cert_chain(SSL *a); - X509 *q_SSL_get_peer_certificate(SSL *a); - long q_SSL_get_verify_result(const SSL *a); --int q_SSL_library_init(); --void q_SSL_load_error_strings(); - SSL *q_SSL_new(SSL_CTX *a); - long q_SSL_ctrl(SSL *ssl,int cmd, long larg, void *parg); - int q_SSL_read(SSL *a, void *b, int c); -@@ -388,7 +374,6 @@ void q_SSL_SESSION_free(SSL_SESSION *ses - SSL_SESSION *q_SSL_get1_session(SSL *ssl); - SSL_SESSION *q_SSL_get_session(const SSL *ssl); - #if OPENSSL_VERSION_NUMBER >= 0x10001000L --int q_SSL_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func, CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func); - int q_SSL_set_ex_data(SSL *ssl, int idx, void *arg); - void *q_SSL_get_ex_data(const SSL *ssl, int idx); - #endif -@@ -399,49 +384,6 @@ typedef unsigned int (*q_psk_server_call - void q_SSL_set_psk_server_callback(SSL *ssl, q_psk_server_callback_t callback); - int q_SSL_CTX_use_psk_identity_hint(SSL_CTX *ctx, const char *hint); - #endif // OPENSSL_VERSION_NUMBER >= 0x10001000L && !defined(OPENSSL_NO_PSK) --#if OPENSSL_VERSION_NUMBER >= 0x10000000L --#ifndef OPENSSL_NO_SSL2 --const SSL_METHOD *q_SSLv2_client_method(); --#endif --#ifndef OPENSSL_NO_SSL3_METHOD --const SSL_METHOD *q_SSLv3_client_method(); --#endif --const SSL_METHOD *q_SSLv23_client_method(); --const SSL_METHOD *q_TLSv1_client_method(); --const SSL_METHOD *q_TLSv1_1_client_method(); --const SSL_METHOD *q_TLSv1_2_client_method(); --#ifndef OPENSSL_NO_SSL2 --const SSL_METHOD *q_SSLv2_server_method(); --#endif --#ifndef OPENSSL_NO_SSL3_METHOD --const SSL_METHOD *q_SSLv3_server_method(); --#endif --const SSL_METHOD *q_SSLv23_server_method(); --const SSL_METHOD *q_TLSv1_server_method(); --const SSL_METHOD *q_TLSv1_1_server_method(); --const SSL_METHOD *q_TLSv1_2_server_method(); --#else --#ifndef OPENSSL_NO_SSL2 --SSL_METHOD *q_SSLv2_client_method(); --#endif --#ifndef OPENSSL_NO_SSL3_METHOD --SSL_METHOD *q_SSLv3_client_method(); --#endif --SSL_METHOD *q_SSLv23_client_method(); --SSL_METHOD *q_TLSv1_client_method(); --SSL_METHOD *q_TLSv1_1_client_method(); --SSL_METHOD *q_TLSv1_2_client_method(); --#ifndef OPENSSL_NO_SSL2 --SSL_METHOD *q_SSLv2_server_method(); --#endif --#ifndef OPENSSL_NO_SSL3_METHOD --SSL_METHOD *q_SSLv3_server_method(); --#endif --SSL_METHOD *q_SSLv23_server_method(); --SSL_METHOD *q_TLSv1_server_method(); --SSL_METHOD *q_TLSv1_1_server_method(); --SSL_METHOD *q_TLSv1_2_server_method(); --#endif - int q_SSL_write(SSL *a, const void *b, int c); - int q_X509_cmp(X509 *a, X509 *b); - #ifdef SSLEAY_MACROS -@@ -452,6 +394,7 @@ void *q_ASN1_dup(i2d_of_void *i2d, d2i_o - X509 *q_X509_dup(X509 *a); - #endif - void q_X509_print(BIO *a, X509*b); -+int q_X509_digest(const X509 *x509, const EVP_MD *type, unsigned char *md, unsigned int *len); - ASN1_OBJECT *q_X509_EXTENSION_get_object(X509_EXTENSION *a); - void q_X509_free(X509 *a); - X509_EXTENSION *q_X509_get_ext(X509 *a, int b); -@@ -471,6 +414,7 @@ int q_ASN1_STRING_print(BIO *a, ASN1_STR - int q_X509_check_issued(X509 *a, X509 *b); - X509_NAME *q_X509_get_issuer_name(X509 *a); - X509_NAME *q_X509_get_subject_name(X509 *a); -+ASN1_INTEGER *q_X509_get_serialNumber(X509 *a); - int q_X509_verify_cert(X509_STORE_CTX *ctx); - int q_X509_NAME_entry_count(X509_NAME *a); - X509_NAME_ENTRY *q_X509_NAME_get_entry(X509_NAME *a,int b); -@@ -488,7 +432,6 @@ int q_X509_STORE_CTX_set_purpose(X509_ST - int q_X509_STORE_CTX_get_error(X509_STORE_CTX *ctx); - int q_X509_STORE_CTX_get_error_depth(X509_STORE_CTX *ctx); - X509 *q_X509_STORE_CTX_get_current_cert(X509_STORE_CTX *ctx); --STACK_OF(X509) *q_X509_STORE_CTX_get_chain(X509_STORE_CTX *ctx); - - // Diffie-Hellman support - DH *q_DH_new(); -@@ -522,34 +465,9 @@ int q_PKCS12_parse(PKCS12 *p12, const ch - PKCS12 *q_d2i_PKCS12_bio(BIO *bio, PKCS12 **pkcs12); - void q_PKCS12_free(PKCS12 *pkcs12); - -- - #define q_BIO_get_mem_data(b, pp) (int)q_BIO_ctrl(b,BIO_CTRL_INFO,0,(char *)pp) - #define q_BIO_pending(b) (int)q_BIO_ctrl(b,BIO_CTRL_PENDING,0,NULL) --#ifdef SSLEAY_MACROS --int q_i2d_DSAPrivateKey(const DSA *a, unsigned char **pp); --int q_i2d_RSAPrivateKey(const RSA *a, unsigned char **pp); --RSA *q_d2i_RSAPrivateKey(RSA **a, unsigned char **pp, long length); --DSA *q_d2i_DSAPrivateKey(DSA **a, unsigned char **pp, long length); --#define q_PEM_read_bio_RSAPrivateKey(bp, x, cb, u) \ -- (RSA *)q_PEM_ASN1_read_bio( \ -- (void *(*)(void**, const unsigned char**, long int))q_d2i_RSAPrivateKey, PEM_STRING_RSA, bp, (void **)x, cb, u) --#define q_PEM_read_bio_DSAPrivateKey(bp, x, cb, u) \ -- (DSA *)q_PEM_ASN1_read_bio( \ -- (void *(*)(void**, const unsigned char**, long int))q_d2i_DSAPrivateKey, PEM_STRING_DSA, bp, (void **)x, cb, u) --#define q_PEM_write_bio_RSAPrivateKey(bp,x,enc,kstr,klen,cb,u) \ -- PEM_ASN1_write_bio((int (*)(void*, unsigned char**))q_i2d_RSAPrivateKey,PEM_STRING_RSA,\ -- bp,(char *)x,enc,kstr,klen,cb,u) --#define q_PEM_write_bio_DSAPrivateKey(bp,x,enc,kstr,klen,cb,u) \ -- PEM_ASN1_write_bio((int (*)(void*, unsigned char**))q_i2d_DSAPrivateKey,PEM_STRING_DSA,\ -- bp,(char *)x,enc,kstr,klen,cb,u) --#define q_PEM_read_bio_DHparams(bp, dh, cb, u) \ -- (DH *)q_PEM_ASN1_read_bio( \ -- (void *(*)(void**, const unsigned char**, long int))q_d2i_DHparams, PEM_STRING_DHPARAMS, bp, (void **)x, cb, u) --#endif --#define q_SSL_CTX_set_options(ctx,op) q_SSL_CTX_ctrl((ctx),SSL_CTRL_OPTIONS,(op),NULL) - #define q_SSL_CTX_set_mode(ctx,op) q_SSL_CTX_ctrl((ctx),SSL_CTRL_MODE,(op),NULL) --#define q_SKM_sk_num(type, st) ((int (*)(const STACK_OF(type) *))q_sk_num)(st) --#define q_SKM_sk_value(type, st,i) ((type * (*)(const STACK_OF(type) *, int))q_sk_value)(st, i) - #define q_sk_GENERAL_NAME_num(st) q_SKM_sk_num(GENERAL_NAME, (st)) - #define q_sk_GENERAL_NAME_value(st, i) q_SKM_sk_value(GENERAL_NAME, (st), (i)) - #define q_sk_X509_num(st) q_SKM_sk_num(X509, (st)) -@@ -558,18 +476,12 @@ DSA *q_d2i_DSAPrivateKey(DSA **a, unsign - #define q_sk_SSL_CIPHER_value(st, i) q_SKM_sk_value(SSL_CIPHER, (st), (i)) - #define q_SSL_CTX_add_extra_chain_cert(ctx,x509) \ - q_SSL_CTX_ctrl(ctx,SSL_CTRL_EXTRA_CHAIN_CERT,0,(char *)x509) --#define q_X509_get_notAfter(x) X509_get_notAfter(x) --#define q_X509_get_notBefore(x) X509_get_notBefore(x) - #define q_EVP_PKEY_assign_RSA(pkey,rsa) q_EVP_PKEY_assign((pkey),EVP_PKEY_RSA,\ - (char *)(rsa)) - #define q_EVP_PKEY_assign_DSA(pkey,dsa) q_EVP_PKEY_assign((pkey),EVP_PKEY_DSA,\ - (char *)(dsa)) - #define q_OpenSSL_add_all_algorithms() q_OPENSSL_add_all_algorithms_conf() --void q_OPENSSL_add_all_algorithms_noconf(); --void q_OPENSSL_add_all_algorithms_conf(); - int q_SSL_CTX_load_verify_locations(SSL_CTX *ctx, const char *CAfile, const char *CApath); --long q_SSLeay(); --const char *q_SSLeay_version(int type); - int q_i2d_SSL_SESSION(SSL_SESSION *in, unsigned char **pp); - SSL_SESSION *q_d2i_SSL_SESSION(SSL_SESSION **a, const unsigned char **pp, long length); - -Index: qtbase-opensource-src-5.9.2/src/network/ssl/qsslsocket_opensslpre11.cpp -=================================================================== ---- /dev/null -+++ qtbase-opensource-src-5.9.2/src/network/ssl/qsslsocket_opensslpre11.cpp -@@ -0,0 +1,424 @@ -+/**************************************************************************** -+** -+** Copyright (C) 2017 The Qt Company Ltd. -+** Copyright (C) 2014 Governikus GmbH & Co. KG -+** Contact: https://www.qt.io/licensing/ -+** -+** This file is part of the QtNetwork module of the Qt Toolkit. -+** -+** $QT_BEGIN_LICENSE:LGPL$ -+** Commercial License Usage -+** Licensees holding valid commercial Qt licenses may use this file in -+** accordance with the commercial license agreement provided with the -+** Software or, alternatively, in accordance with the terms contained in -+** a written agreement between you and The Qt Company. For licensing terms -+** and conditions see https://www.qt.io/terms-conditions. For further -+** information use the contact form at https://www.qt.io/contact-us. -+** -+** GNU Lesser General Public License Usage -+** Alternatively, this file may be used under the terms of the GNU Lesser -+** General Public License version 3 as published by the Free Software -+** Foundation and appearing in the file LICENSE.LGPL3 included in the -+** packaging of this file. Please review the following information to -+** ensure the GNU Lesser General Public License version 3 requirements -+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -+** -+** GNU General Public License Usage -+** Alternatively, this file may be used under the terms of the GNU -+** General Public License version 2.0 or (at your option) the GNU General -+** Public license version 3 or any later version approved by the KDE Free -+** Qt Foundation. The licenses are as published by the Free Software -+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -+** included in the packaging of this file. Please review the following -+** information to ensure the GNU General Public License requirements will -+** be met: https://www.gnu.org/licenses/gpl-2.0.html and -+** https://www.gnu.org/licenses/gpl-3.0.html. -+** -+** $QT_END_LICENSE$ -+** -+****************************************************************************/ -+ -+/**************************************************************************** -+** -+** In addition, as a special exception, the copyright holders listed above give -+** permission to link the code of its release of Qt with the OpenSSL project's -+** "OpenSSL" library (or modified versions of the "OpenSSL" library that use the -+** same license as the original version), and distribute the linked executables. -+** -+** You must comply with the GNU General Public License version 2 in all -+** respects for all of the code used other than the "OpenSSL" code. If you -+** modify this file, you may extend this exception to your version of the file, -+** but you are not obligated to do so. If you do not wish to do so, delete -+** this exception statement from your version of this file. -+** -+****************************************************************************/ -+ -+//#define QT_DECRYPT_SSL_TRAFFIC -+ -+#include "qssl_p.h" -+#include "qsslsocket_openssl_p.h" -+#include "qsslsocket_openssl_symbols_p.h" -+#include "qsslsocket.h" -+#include "qsslkey.h" -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+QT_BEGIN_NAMESPACE -+ -+/* \internal -+ -+ From OpenSSL's thread(3) manual page: -+ -+ OpenSSL can safely be used in multi-threaded applications provided that at -+ least two callback functions are set. -+ -+ locking_function(int mode, int n, const char *file, int line) is needed to -+ perform locking on shared data structures. (Note that OpenSSL uses a -+ number of global data structures that will be implicitly shared -+ whenever multiple threads use OpenSSL.) Multi-threaded -+ applications will crash at random if it is not set. ... -+ ... -+ id_function(void) is a function that returns a thread ID. It is not -+ needed on Windows nor on platforms where getpid() returns a different -+ ID for each thread (most notably Linux) -+*/ -+ -+class QOpenSslLocks -+{ -+public: -+ QOpenSslLocks() -+ : initLocker(QMutex::Recursive), -+ locksLocker(QMutex::Recursive) -+ { -+ QMutexLocker locker(&locksLocker); -+ int numLocks = q_CRYPTO_num_locks(); -+ locks = new QMutex *[numLocks]; -+ memset(locks, 0, numLocks * sizeof(QMutex *)); -+ } -+ ~QOpenSslLocks() -+ { -+ QMutexLocker locker(&locksLocker); -+ for (int i = 0; i < q_CRYPTO_num_locks(); ++i) -+ delete locks[i]; -+ delete [] locks; -+ -+ QSslSocketPrivate::deinitialize(); -+ } -+ QMutex *lock(int num) -+ { -+ QMutexLocker locker(&locksLocker); -+ QMutex *tmp = locks[num]; -+ if (!tmp) -+ tmp = locks[num] = new QMutex(QMutex::Recursive); -+ return tmp; -+ } -+ -+ QMutex *globalLock() -+ { -+ return &locksLocker; -+ } -+ -+ QMutex *initLock() -+ { -+ return &initLocker; -+ } -+ -+private: -+ QMutex initLocker; -+ QMutex locksLocker; -+ QMutex **locks; -+}; -+ -+Q_GLOBAL_STATIC(QOpenSslLocks, openssl_locks) -+ -+extern "C" { -+static void locking_function(int mode, int lockNumber, const char *, int) -+{ -+ QMutex *mutex = openssl_locks()->lock(lockNumber); -+ -+ // Lock or unlock it -+ if (mode & CRYPTO_LOCK) -+ mutex->lock(); -+ else -+ mutex->unlock(); -+} -+static unsigned long id_function() -+{ -+ return (quintptr)QThread::currentThreadId(); -+} -+ -+} // extern "C" -+ -+static void q_OpenSSL_add_all_algorithms_safe() -+{ -+#ifdef Q_OS_WIN -+ // Prior to version 1.0.1m an attempt to call OpenSSL_add_all_algorithms on -+ // Windows could result in 'exit' call from OPENSSL_config (QTBUG-43843). -+ // We can predict this and avoid OPENSSL_add_all_algorithms call. -+ // From OpenSSL docs: -+ // "An application does not need to add algorithms to use them explicitly, -+ // for example by EVP_sha1(). It just needs to add them if it (or any of -+ // the functions it calls) needs to lookup algorithms. -+ // The cipher and digest lookup functions are used in many parts of the -+ // library. If the table is not initialized several functions will -+ // misbehave and complain they cannot find algorithms. This includes the -+ // PEM, PKCS#12, SSL and S/MIME libraries. This is a common query in -+ // the OpenSSL mailing lists." -+ // -+ // Anyway, as a result, we chose not to call this function if it would exit. -+ -+ if (q_SSLeay() < 0x100010DFL) -+ { -+ // Now, before we try to call it, check if an attempt to open config file -+ // will result in exit: -+ if (char *confFileName = q_CONF_get1_default_config_file()) { -+ BIO *confFile = q_BIO_new_file(confFileName, "r"); -+ const auto lastError = q_ERR_peek_last_error(); -+ q_CRYPTO_free(confFileName); -+ if (confFile) { -+ q_BIO_free(confFile); -+ } else { -+ q_ERR_clear_error(); -+ if (ERR_GET_REASON(lastError) == ERR_R_SYS_LIB) { -+ qCWarning(lcSsl, "failed to open openssl.conf file"); -+ return; -+ } -+ } -+ } -+ } -+#endif // Q_OS_WIN -+ -+ q_OpenSSL_add_all_algorithms(); -+} -+ -+ -+/*! -+ \internal -+*/ -+void QSslSocketPrivate::deinitialize() -+{ -+ q_CRYPTO_set_id_callback(0); -+ q_CRYPTO_set_locking_callback(0); -+ q_ERR_free_strings(); -+} -+ -+ -+bool QSslSocketPrivate::ensureLibraryLoaded() -+{ -+ if (!q_resolveOpenSslSymbols()) -+ return false; -+ -+ // Check if the library itself needs to be initialized. -+ QMutexLocker locker(openssl_locks()->initLock()); -+ -+ if (!s_libraryLoaded) { -+ s_libraryLoaded = true; -+ -+ // Initialize OpenSSL. -+ q_CRYPTO_set_id_callback(id_function); -+ q_CRYPTO_set_locking_callback(locking_function); -+ if (q_SSL_library_init() != 1) -+ return false; -+ q_SSL_load_error_strings(); -+ q_OpenSSL_add_all_algorithms_safe(); -+ -+#if OPENSSL_VERSION_NUMBER >= 0x10001000L -+ if (q_SSLeay() >= 0x10001000L) -+ QSslSocketBackendPrivate::s_indexForSSLExtraData = q_SSL_get_ex_new_index(0L, NULL, NULL, NULL, NULL); -+#endif -+ -+ // Initialize OpenSSL's random seed. -+ if (!q_RAND_status()) { -+ qWarning("Random number generator not seeded, disabling SSL support"); -+ return false; -+ } -+ } -+ return true; -+} -+ -+void QSslSocketPrivate::ensureCiphersAndCertsLoaded() -+{ -+ QMutexLocker locker(openssl_locks()->initLock()); -+ if (s_loadedCiphersAndCerts) -+ return; -+ s_loadedCiphersAndCerts = true; -+ -+ resetDefaultCiphers(); -+ resetDefaultEllipticCurves(); -+ -+#if QT_CONFIG(library) -+ //load symbols needed to receive certificates from system store -+#if defined(Q_OS_WIN) -+ HINSTANCE hLib = LoadLibraryW(L"Crypt32"); -+ if (hLib) { -+ ptrCertOpenSystemStoreW = (PtrCertOpenSystemStoreW)GetProcAddress(hLib, "CertOpenSystemStoreW"); -+ ptrCertFindCertificateInStore = (PtrCertFindCertificateInStore)GetProcAddress(hLib, "CertFindCertificateInStore"); -+ ptrCertCloseStore = (PtrCertCloseStore)GetProcAddress(hLib, "CertCloseStore"); -+ if (!ptrCertOpenSystemStoreW || !ptrCertFindCertificateInStore || !ptrCertCloseStore) -+ qCWarning(lcSsl, "could not resolve symbols in crypt32 library"); // should never happen -+ } else { -+ qCWarning(lcSsl, "could not load crypt32 library"); // should never happen -+ } -+#elif defined(Q_OS_QNX) -+ s_loadRootCertsOnDemand = true; -+#elif defined(Q_OS_UNIX) && !defined(Q_OS_MACOS) -+ // check whether we can enable on-demand root-cert loading (i.e. check whether the sym links are there) -+ QList dirs = unixRootCertDirectories(); -+ QStringList symLinkFilter; -+ symLinkFilter << QLatin1String("[0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f].[0-9]"); -+ for (int a = 0; a < dirs.count(); ++a) { -+ QDirIterator iterator(QLatin1String(dirs.at(a)), symLinkFilter, QDir::Files); -+ if (iterator.hasNext()) { -+ s_loadRootCertsOnDemand = true; -+ break; -+ } -+ } -+#endif -+#endif // QT_CONFIG(library) -+ // if on-demand loading was not enabled, load the certs now -+ if (!s_loadRootCertsOnDemand) -+ setDefaultCaCertificates(systemCaCertificates()); -+#ifdef Q_OS_WIN -+ //Enabled for fetching additional root certs from windows update on windows 6+ -+ //This flag is set false by setDefaultCaCertificates() indicating the app uses -+ //its own cert bundle rather than the system one. -+ //Same logic that disables the unix on demand cert loading. -+ //Unlike unix, we do preload the certificates from the cert store. -+ if ((QSysInfo::windowsVersion() & QSysInfo::WV_NT_based) >= QSysInfo::WV_6_0) -+ s_loadRootCertsOnDemand = true; -+#endif -+} -+ -+long QSslSocketPrivate::sslLibraryVersionNumber() -+{ -+ if (!supportsSsl()) -+ return 0; -+ -+ return q_SSLeay(); -+} -+ -+QString QSslSocketPrivate::sslLibraryVersionString() -+{ -+ if (!supportsSsl()) -+ return QString(); -+ -+ const char *versionString = q_SSLeay_version(SSLEAY_VERSION); -+ if (!versionString) -+ return QString(); -+ -+ return QString::fromLatin1(versionString); -+} -+ -+void QSslSocketBackendPrivate::continueHandshake() -+{ -+ Q_Q(QSslSocket); -+ // if we have a max read buffer size, reset the plain socket's to match -+ if (readBufferMaxSize) -+ plainSocket->setReadBufferSize(readBufferMaxSize); -+ -+ if (q_SSL_ctrl((ssl), SSL_CTRL_GET_SESSION_REUSED, 0, NULL)) -+ configuration.peerSessionShared = true; -+ -+#ifdef QT_DECRYPT_SSL_TRAFFIC -+ if (ssl->session && ssl->s3) { -+ const char *mk = reinterpret_cast(ssl->session->master_key); -+ QByteArray masterKey(mk, ssl->session->master_key_length); -+ const char *random = reinterpret_cast(ssl->s3->client_random); -+ QByteArray clientRandom(random, SSL3_RANDOM_SIZE); -+ -+ // different format, needed for e.g. older Wireshark versions: -+// const char *sid = reinterpret_cast(ssl->session->session_id); -+// QByteArray sessionID(sid, ssl->session->session_id_length); -+// QByteArray debugLineRSA("RSA Session-ID:"); -+// debugLineRSA.append(sessionID.toHex().toUpper()); -+// debugLineRSA.append(" Master-Key:"); -+// debugLineRSA.append(masterKey.toHex().toUpper()); -+// debugLineRSA.append("\n"); -+ -+ QByteArray debugLineClientRandom("CLIENT_RANDOM "); -+ debugLineClientRandom.append(clientRandom.toHex().toUpper()); -+ debugLineClientRandom.append(" "); -+ debugLineClientRandom.append(masterKey.toHex().toUpper()); -+ debugLineClientRandom.append("\n"); -+ -+ QString sslKeyFile = QDir::tempPath() + QLatin1String("/qt-ssl-keys"); -+ QFile file(sslKeyFile); -+ if (!file.open(QIODevice::Append)) -+ qCWarning(lcSsl) << "could not open file" << sslKeyFile << "for appending"; -+ if (!file.write(debugLineClientRandom)) -+ qCWarning(lcSsl) << "could not write to file" << sslKeyFile; -+ file.close(); -+ } else { -+ qCWarning(lcSsl, "could not decrypt SSL traffic"); -+ } -+#endif -+ -+ // Cache this SSL session inside the QSslContext -+ if (!(configuration.sslOptions & QSsl::SslOptionDisableSessionSharing)) { -+ if (!sslContextPointer->cacheSession(ssl)) { -+ sslContextPointer.clear(); // we could not cache the session -+ } else { -+ // Cache the session for permanent usage as well -+ if (!(configuration.sslOptions & QSsl::SslOptionDisableSessionPersistence)) { -+ if (!sslContextPointer->sessionASN1().isEmpty()) -+ configuration.sslSession = sslContextPointer->sessionASN1(); -+ configuration.sslSessionTicketLifeTimeHint = sslContextPointer->sessionTicketLifeTimeHint(); -+ } -+ } -+ } -+ -+#if OPENSSL_VERSION_NUMBER >= 0x1000100fL && !defined(OPENSSL_NO_NEXTPROTONEG) -+ -+ configuration.nextProtocolNegotiationStatus = sslContextPointer->npnContext().status; -+ if (sslContextPointer->npnContext().status == QSslConfiguration::NextProtocolNegotiationUnsupported) { -+ // we could not agree -> be conservative and use HTTP/1.1 -+ configuration.nextNegotiatedProtocol = QByteArrayLiteral("http/1.1"); -+ } else { -+ const unsigned char *proto = 0; -+ unsigned int proto_len = 0; -+#if OPENSSL_VERSION_NUMBER >= 0x10002000L -+ if (q_SSLeay() >= 0x10002000L) { -+ q_SSL_get0_alpn_selected(ssl, &proto, &proto_len); -+ if (proto_len && mode == QSslSocket::SslClientMode) { -+ // Client does not have a callback that sets it ... -+ configuration.nextProtocolNegotiationStatus = QSslConfiguration::NextProtocolNegotiationNegotiated; -+ } -+ } -+ -+ if (!proto_len) { // Test if NPN was more lucky ... -+#else -+ { -+#endif -+ q_SSL_get0_next_proto_negotiated(ssl, &proto, &proto_len); -+ } -+ -+ if (proto_len) -+ configuration.nextNegotiatedProtocol = QByteArray(reinterpret_cast(proto), proto_len); -+ else -+ configuration.nextNegotiatedProtocol.clear(); -+ } -+#endif // OPENSSL_VERSION_NUMBER >= 0x1000100fL ... -+ -+#if OPENSSL_VERSION_NUMBER >= 0x10002000L -+ if (q_SSLeay() >= 0x10002000L && mode == QSslSocket::SslClientMode) { -+ EVP_PKEY *key; -+ if (q_SSL_get_server_tmp_key(ssl, &key)) -+ configuration.ephemeralServerKey = QSslKey(key, QSsl::PublicKey); -+ } -+#endif // OPENSSL_VERSION_NUMBER >= 0x10002000L ... -+ -+ connectionEncrypted = true; -+ emit q->encrypted(); -+ if (autoStartHandshake && pendingClose) { -+ pendingClose = false; -+ q->disconnectFromHost(); -+ } -+} -+ -+QT_END_NAMESPACE -Index: qtbase-opensource-src-5.9.2/src/network/ssl/qsslsocket_opensslpre11_symbols_p.h -=================================================================== ---- /dev/null -+++ qtbase-opensource-src-5.9.2/src/network/ssl/qsslsocket_opensslpre11_symbols_p.h -@@ -0,0 +1,230 @@ -+/**************************************************************************** -+** -+** Copyright (C) 2017 The Qt Company Ltd. -+** Copyright (C) 2014 BlackBerry Limited. All rights reserved. -+** Contact: https://www.qt.io/licensing/ -+** -+** This file is part of the QtNetwork module of the Qt Toolkit. -+** -+** $QT_BEGIN_LICENSE:LGPL$ -+** Commercial License Usage -+** Licensees holding valid commercial Qt licenses may use this file in -+** accordance with the commercial license agreement provided with the -+** Software or, alternatively, in accordance with the terms contained in -+** a written agreement between you and The Qt Company. For licensing terms -+** and conditions see https://www.qt.io/terms-conditions. For further -+** information use the contact form at https://www.qt.io/contact-us. -+** -+** GNU Lesser General Public License Usage -+** Alternatively, this file may be used under the terms of the GNU Lesser -+** General Public License version 3 as published by the Free Software -+** Foundation and appearing in the file LICENSE.LGPL3 included in the -+** packaging of this file. Please review the following information to -+** ensure the GNU Lesser General Public License version 3 requirements -+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -+** -+** GNU General Public License Usage -+** Alternatively, this file may be used under the terms of the GNU -+** General Public License version 2.0 or (at your option) the GNU General -+** Public license version 3 or any later version approved by the KDE Free -+** Qt Foundation. The licenses are as published by the Free Software -+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -+** included in the packaging of this file. Please review the following -+** information to ensure the GNU General Public License requirements will -+** be met: https://www.gnu.org/licenses/gpl-2.0.html and -+** https://www.gnu.org/licenses/gpl-3.0.html. -+** -+** $QT_END_LICENSE$ -+** -+****************************************************************************/ -+ -+/**************************************************************************** -+** -+** In addition, as a special exception, the copyright holders listed above give -+** permission to link the code of its release of Qt with the OpenSSL project's -+** "OpenSSL" library (or modified versions of the "OpenSSL" library that use the -+** same license as the original version), and distribute the linked executables. -+** -+** You must comply with the GNU General Public License version 2 in all -+** respects for all of the code used other than the "OpenSSL" code. If you -+** modify this file, you may extend this exception to your version of the file, -+** but you are not obligated to do so. If you do not wish to do so, delete -+** this exception statement from your version of this file. -+** -+****************************************************************************/ -+ -+ -+#ifndef QSSLSOCKET_OPENSSLPRE11_SYMBOLS_P_H -+#define QSSLSOCKET_OPENSSLPRE11_SYMBOLS_P_H -+ -+// -+// W A R N I N G -+// ------------- -+// -+// This file is not part of the Qt API. It exists purely as an -+// implementation detail. This header file may change from version to -+// version without notice, or even be removed. -+// -+// We mean it. -+// -+ -+// Note: this file does not have QT_BEGIN_NAMESPACE/QT_END_NAMESPACE, it's done -+// in qsslsocket_openssl_symbols_p.h. -+ -+#ifndef QSSLSOCKET_OPENSSL_SYMBOLS_P_H -+#error "You are not supposed to use this header file, include qsslsocket_openssl_symbols_p.h instead" -+#endif -+ -+unsigned char * q_ASN1_STRING_data(ASN1_STRING *a); -+BIO *q_BIO_new_file(const char *filename, const char *mode); -+void q_ERR_clear_error(); -+Q_AUTOTEST_EXPORT BIO *q_BIO_new(BIO_METHOD *a); -+Q_AUTOTEST_EXPORT BIO_METHOD *q_BIO_s_mem(); -+int q_CRYPTO_num_locks(); -+void q_CRYPTO_set_locking_callback(void (*a)(int, int, const char *, int)); -+void q_CRYPTO_set_id_callback(unsigned long (*a)()); -+void q_CRYPTO_free(void *a); -+unsigned long q_ERR_peek_last_error(); -+void q_ERR_free_strings(); -+void q_EVP_CIPHER_CTX_cleanup(EVP_CIPHER_CTX *a); -+void q_EVP_CIPHER_CTX_init(EVP_CIPHER_CTX *a); -+ -+#if OPENSSL_VERSION_NUMBER >= 0x10000000L -+typedef _STACK STACK; -+#endif -+ -+// The typedef we use to make our pre 1.1 code look more like 1.1 (less ifdefs). -+typedef STACK OPENSSL_STACK; -+ -+// We resolve q_sk_ functions, but use q_OPENSSL_sk_ macros in code to reduce -+// the amount of #ifdefs. -+int q_sk_num(STACK *a); -+#define q_OPENSSL_sk_num(a) q_sk_num(a) -+void q_sk_pop_free(STACK *a, void (*b)(void *)); -+#define q_OPENSSL_sk_pop_free(a, b) q_sk_pop_free(a, b) -+STACK *q_sk_new_null(); -+#define q_OPENSSL_sk_new_null() q_sk_new_null() -+ -+void q_sk_free(STACK *a); -+ -+// Just a name alias (not a function call expression) since in code we take an -+// address of this: -+#define q_OPENSSL_sk_free q_sk_free -+ -+#if OPENSSL_VERSION_NUMBER >= 0x10000000L -+void *q_sk_value(STACK *a, int b); -+void q_sk_push(STACK *st, void *data); -+#else -+char *q_sk_value(STACK *a, int b); -+void q_sk_push(STACK *st, char *data); -+#endif // OPENSSL_VERSION_NUMBER >= 0x10000000L -+ -+#define q_OPENSSL_sk_value(a, b) q_sk_value(a, b) -+#define q_OPENSSL_sk_push(st, data) q_sk_push(st, data) -+ -+#if OPENSSL_VERSION_NUMBER >= 0x10000000L -+SSL_CTX *q_SSL_CTX_new(const SSL_METHOD *a); -+#else -+SSL_CTX *q_SSL_CTX_new(SSL_METHOD *a); -+#endif -+ -+int q_SSL_library_init(); -+void q_SSL_load_error_strings(); -+ -+#if OPENSSL_VERSION_NUMBER >= 0x10001000L -+int q_SSL_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func, CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func); -+#endif -+ -+#if OPENSSL_VERSION_NUMBER >= 0x10000000L -+#ifndef OPENSSL_NO_SSL2 -+const SSL_METHOD *q_SSLv2_client_method(); -+#endif -+#ifndef OPENSSL_NO_SSL3_METHOD -+const SSL_METHOD *q_SSLv3_client_method(); -+#endif -+const SSL_METHOD *q_SSLv23_client_method(); -+const SSL_METHOD *q_TLSv1_client_method(); -+const SSL_METHOD *q_TLSv1_1_client_method(); -+const SSL_METHOD *q_TLSv1_2_client_method(); -+#ifndef OPENSSL_NO_SSL2 -+const SSL_METHOD *q_SSLv2_server_method(); -+#endif -+#ifndef OPENSSL_NO_SSL3_METHOD -+const SSL_METHOD *q_SSLv3_server_method(); -+#endif -+const SSL_METHOD *q_SSLv23_server_method(); -+const SSL_METHOD *q_TLSv1_server_method(); -+const SSL_METHOD *q_TLSv1_1_server_method(); -+const SSL_METHOD *q_TLSv1_2_server_method(); -+#else -+#ifndef OPENSSL_NO_SSL2 -+SSL_METHOD *q_SSLv2_client_method(); -+#endif -+#ifndef OPENSSL_NO_SSL3_METHOD -+SSL_METHOD *q_SSLv3_client_method(); -+#endif -+SSL_METHOD *q_SSLv23_client_method(); -+SSL_METHOD *q_TLSv1_client_method(); -+SSL_METHOD *q_TLSv1_1_client_method(); -+SSL_METHOD *q_TLSv1_2_client_method(); -+#ifndef OPENSSL_NO_SSL2 -+SSL_METHOD *q_SSLv2_server_method(); -+#endif -+#ifndef OPENSSL_NO_SSL3_METHOD -+SSL_METHOD *q_SSLv3_server_method(); -+#endif -+SSL_METHOD *q_SSLv23_server_method(); -+SSL_METHOD *q_TLSv1_server_method(); -+SSL_METHOD *q_TLSv1_1_server_method(); -+SSL_METHOD *q_TLSv1_2_server_method(); -+#endif -+ -+STACK_OF(X509) *q_X509_STORE_CTX_get_chain(X509_STORE_CTX *ctx); -+ -+#ifdef SSLEAY_MACROS -+int q_i2d_DSAPrivateKey(const DSA *a, unsigned char **pp); -+int q_i2d_RSAPrivateKey(const RSA *a, unsigned char **pp); -+RSA *q_d2i_RSAPrivateKey(RSA **a, unsigned char **pp, long length); -+DSA *q_d2i_DSAPrivateKey(DSA **a, unsigned char **pp, long length); -+#define q_PEM_read_bio_RSAPrivateKey(bp, x, cb, u) \ -+ (RSA *)q_PEM_ASN1_read_bio( \ -+ (void *(*)(void**, const unsigned char**, long int))q_d2i_RSAPrivateKey, PEM_STRING_RSA, bp, (void **)x, cb, u) -+#define q_PEM_read_bio_DSAPrivateKey(bp, x, cb, u) \ -+ (DSA *)q_PEM_ASN1_read_bio( \ -+ (void *(*)(void**, const unsigned char**, long int))q_d2i_DSAPrivateKey, PEM_STRING_DSA, bp, (void **)x, cb, u) -+#define q_PEM_write_bio_RSAPrivateKey(bp,x,enc,kstr,klen,cb,u) \ -+ PEM_ASN1_write_bio((int (*)(void*, unsigned char**))q_i2d_RSAPrivateKey,PEM_STRING_RSA,\ -+ bp,(char *)x,enc,kstr,klen,cb,u) -+#define q_PEM_write_bio_DSAPrivateKey(bp,x,enc,kstr,klen,cb,u) \ -+ PEM_ASN1_write_bio((int (*)(void*, unsigned char**))q_i2d_DSAPrivateKey,PEM_STRING_DSA,\ -+ bp,(char *)x,enc,kstr,klen,cb,u) -+#define q_PEM_read_bio_DHparams(bp, dh, cb, u) \ -+ (DH *)q_PEM_ASN1_read_bio( \ -+ (void *(*)(void**, const unsigned char**, long int))q_d2i_DHparams, PEM_STRING_DHPARAMS, bp, (void **)x, cb, u) -+#endif // SSLEAY_MACROS -+ -+#define q_SSL_CTX_set_options(ctx,op) q_SSL_CTX_ctrl((ctx),SSL_CTRL_OPTIONS,(op),NULL) -+#define q_SKM_sk_num(type, st) ((int (*)(const STACK_OF(type) *))q_sk_num)(st) -+#define q_SKM_sk_value(type, st,i) ((type * (*)(const STACK_OF(type) *, int))q_sk_value)(st, i) -+#define q_X509_getm_notAfter(x) X509_get_notAfter(x) -+#define q_X509_getm_notBefore(x) X509_get_notBefore(x) -+ -+// "Forward compatibility" with OpenSSL 1.1 (to save on #if-ery elsewhere): -+#define q_X509_get_version(x509) q_ASN1_INTEGER_get((x509)->cert_info->version) -+#define q_ASN1_STRING_get0_data(x) q_ASN1_STRING_data(x) -+#define q_EVP_PKEY_base_id(pkey) ((pkey)->type) -+#define q_X509_get_pubkey(x509) q_X509_PUBKEY_get((x509)->cert_info->key) -+#define q_SSL_SESSION_get_ticket_lifetime_hint(s) ((s)->tlsext_tick_lifetime_hint) -+#define q_RSA_bits(rsa) q_BN_num_bits((rsa)->n) -+#define q_DSA_bits(dsa) q_BN_num_bits((dsa)->p) -+#define q_X509_STORE_set_verify_cb(s,c) X509_STORE_set_verify_cb_func((s),(c)) -+ -+char *q_CONF_get1_default_config_file(); -+void q_OPENSSL_add_all_algorithms_noconf(); -+void q_OPENSSL_add_all_algorithms_conf(); -+ -+long q_SSLeay(); -+const char *q_SSLeay_version(int type); -+ -+ -+#endif // QSSLSOCKET_OPENSSL_PRE11_SYMBOLS_P_H -Index: qtbase-opensource-src-5.9.2/src/network/ssl/ssl.pri -=================================================================== ---- qtbase-opensource-src-5.9.2.orig/src/network/ssl/ssl.pri -+++ qtbase-opensource-src-5.9.2/src/network/ssl/ssl.pri -@@ -60,13 +60,25 @@ qtConfig(ssl) { - HEADERS += ssl/qsslcontext_openssl_p.h \ - ssl/qsslsocket_openssl_p.h \ - ssl/qsslsocket_openssl_symbols_p.h -- SOURCES += ssl/qsslcertificate_openssl.cpp \ -- ssl/qsslcontext_openssl.cpp \ -+ SOURCES += ssl/qsslsocket_openssl_symbols.cpp \ - ssl/qssldiffiehellmanparameters_openssl.cpp \ -+ ssl/qsslcertificate_openssl.cpp \ - ssl/qsslellipticcurve_openssl.cpp \ - ssl/qsslkey_openssl.cpp \ - ssl/qsslsocket_openssl.cpp \ -- ssl/qsslsocket_openssl_symbols.cpp -+ ssl/qsslcontext_openssl.cpp -+ -+ qtConfig(opensslv11) { -+ HEADERS += ssl/qsslsocket_openssl11_symbols_p.h -+ SOURCES += ssl/qsslsocket_openssl11.cpp \ -+ ssl/qsslcontext_openssl11.cpp -+ -+ QMAKE_CXXFLAGS += -DOPENSSL_API_COMPAT=0x10100000L -+ } else { -+ HEADERS += ssl/qsslsocket_opensslpre11_symbols_p.h -+ SOURCES += ssl/qsslsocket_opensslpre11.cpp \ -+ ssl/qsslcontext_opensslpre11.cpp -+ } - - darwin:SOURCES += ssl/qsslsocket_mac_shared.cpp - diff --git a/0001-Remove-QPrintDialogPrivate-applyPrinterProperties-no.patch b/0001-Remove-QPrintDialogPrivate-applyPrinterProperties-no.patch new file mode 100644 index 0000000..7e9f6ab --- /dev/null +++ b/0001-Remove-QPrintDialogPrivate-applyPrinterProperties-no.patch @@ -0,0 +1,41 @@ +From 2ecfdf87b8362309f555e441f16e6c5b56f17e63 Mon Sep 17 00:00:00 2001 +From: Albert Astals Cid +Date: Mon, 4 Dec 2017 12:42:54 +0100 +Subject: [PATCH 02/54] Remove QPrintDialogPrivate::applyPrinterProperties, no + one calls it + +Change-Id: Ic140f62e5cb63c6a4b7f4fa10ca243d8bb055c4e +Reviewed-by: Andy Shaw +--- + src/printsupport/dialogs/qprintdialog_unix.cpp | 8 -------- + 1 file changed, 8 deletions(-) + +diff --git a/src/printsupport/dialogs/qprintdialog_unix.cpp b/src/printsupport/dialogs/qprintdialog_unix.cpp +index 183af7daa3..37a562125e 100644 +--- a/src/printsupport/dialogs/qprintdialog_unix.cpp ++++ b/src/printsupport/dialogs/qprintdialog_unix.cpp +@@ -203,8 +203,6 @@ public: + ~QPrintDialogPrivate(); + + void init(); +- /// copy printer properties to the widget +- void applyPrinterProperties(); + + void selectPrinter(const QPrinter::OutputFormat outputFormat); + +@@ -390,12 +388,6 @@ void QPrintDialogPrivate::selectPrinter(const QPrinter::OutputFormat outputForma + options.pageSetCombo->setEnabled(true); + } + +-void QPrintDialogPrivate::applyPrinterProperties() +-{ +- // apply printer options to property dialog +- top->d->applyPrinterProperties(); +-} +- + void QPrintDialogPrivate::setupPrinter() + { + // First setup the requested OutputFormat, Printer and Page Size first +-- +2.15.1 + diff --git a/0002-Remove-QUnixPrintWidgetPrivate-applyPrinterPropertie.patch b/0002-Remove-QUnixPrintWidgetPrivate-applyPrinterPropertie.patch new file mode 100644 index 0000000..6d9198b --- /dev/null +++ b/0002-Remove-QUnixPrintWidgetPrivate-applyPrinterPropertie.patch @@ -0,0 +1,123 @@ +From fb1836898f5f8f88accea92a5ad7adb625694700 Mon Sep 17 00:00:00 2001 +From: Albert Astals Cid +Date: Mon, 4 Dec 2017 12:49:12 +0100 +Subject: [PATCH 03/54] Remove QUnixPrintWidgetPrivate::applyPrinterProperties + +And move it's code to the only place it is called, the QUnixPrintWidget constructor, +that means we can remove the if that checks if propertiesDialog is not null since +at that stage we know it is null + +Change-Id: I81cdaa0505fa6fe64a45c7d1f5c3e277400cbbf7 +Reviewed-by: Andy Shaw +--- + src/printsupport/dialogs/qprintdialog_unix.cpp | 80 +++++++++++--------------- + 1 file changed, 35 insertions(+), 45 deletions(-) + +diff --git a/src/printsupport/dialogs/qprintdialog_unix.cpp b/src/printsupport/dialogs/qprintdialog_unix.cpp +index 37a562125e..66d37dbec3 100644 +--- a/src/printsupport/dialogs/qprintdialog_unix.cpp ++++ b/src/printsupport/dialogs/qprintdialog_unix.cpp +@@ -168,8 +168,6 @@ public: + QUnixPrintWidgetPrivate(QUnixPrintWidget *q, QPrinter *prn); + ~QUnixPrintWidgetPrivate(); + +- /// copy printer properties to the widget +- void applyPrinterProperties(); + bool checkFields(); + void setupPrinter(); + void setOptionsPane(QPrintDialogPrivate *pane); +@@ -790,48 +788,6 @@ void QUnixPrintWidgetPrivate::_q_btnBrowseClicked() + } + } + +-void QUnixPrintWidgetPrivate::applyPrinterProperties() +-{ +- if (printer == nullptr) +- return; +- if (printer->outputFileName().isEmpty()) { +- QString home = QDir::homePath(); +- QString cur = QDir::currentPath(); +- if (home.at(home.length()-1) != QLatin1Char('/')) +- home += QLatin1Char('/'); +- if (!cur.isEmpty() && cur.at(cur.length()-1) != QLatin1Char('/')) +- cur += QLatin1Char('/'); +- if (!cur.startsWith(home)) +- cur = home; +- if (QGuiApplication::platformName() == QLatin1String("xcb")) { +- if (printer->docName().isEmpty()) { +- cur += QLatin1String("print.pdf"); +- } else { +- QRegExp re(QString::fromLatin1("(.*)\\.\\S+")); +- if (re.exactMatch(printer->docName())) +- cur += re.cap(1); +- else +- cur += printer->docName(); +- cur += QLatin1String(".pdf"); +- } +- } // xcb +- +- widget.filename->setText(cur); +- } +- else +- widget.filename->setText( printer->outputFileName() ); +- QString printerName = printer->printerName(); +- if (!printerName.isEmpty()) { +- const int i = widget.printers->findText(printerName); +- if (i >= 0) +- widget.printers->setCurrentIndex(i); +- } +- // PDF printer not added to the dialog yet, we'll handle those cases in QUnixPrintWidgetPrivate::updateWidget +- +- if (propertiesDialog) +- propertiesDialog->applyPrinterProperties(printer); +-} +- + #if QT_CONFIG(messagebox) + bool QUnixPrintWidgetPrivate::checkFields() + { +@@ -951,7 +907,41 @@ void QUnixPrintWidgetPrivate::setupPrinter() + QUnixPrintWidget::QUnixPrintWidget(QPrinter *printer, QWidget *parent) + : QWidget(parent), d(new QUnixPrintWidgetPrivate(this, printer)) + { +- d->applyPrinterProperties(); ++ if (printer == nullptr) ++ return; ++ if (printer->outputFileName().isEmpty()) { ++ QString home = QDir::homePath(); ++ QString cur = QDir::currentPath(); ++ if (!home.endsWith(QLatin1Char('/'))) ++ home += QLatin1Char('/'); ++ if (!cur.startsWith(home)) ++ cur = home; ++ else if (!cur.endsWith(QLatin1Char('/'))) ++ cur += QLatin1Char('/'); ++ if (QGuiApplication::platformName() == QStringLiteral("xcb")) { ++ if (printer->docName().isEmpty()) { ++ cur += QStringLiteral("print.pdf"); ++ } else { ++ const QRegExp re(QStringLiteral("(.*)\\.\\S+")); ++ if (re.exactMatch(printer->docName())) ++ cur += re.cap(1); ++ else ++ cur += printer->docName(); ++ cur += QStringLiteral(".pdf"); ++ } ++ } // xcb ++ ++ d->widget.filename->setText(cur); ++ } ++ else ++ d->widget.filename->setText(printer->outputFileName()); ++ const QString printerName = printer->printerName(); ++ if (!printerName.isEmpty()) { ++ const int i = d->widget.printers->findText(printerName); ++ if (i >= 0) ++ d->widget.printers->setCurrentIndex(i); ++ } ++ // PDF printer not added to the dialog yet, we'll handle those cases in QUnixPrintWidgetPrivate::updateWidget + } + + /*! \internal +-- +2.15.1 + diff --git a/0003-Remove-QPrintPropertiesDialog-applyPrinterProperties.patch b/0003-Remove-QPrintPropertiesDialog-applyPrinterProperties.patch new file mode 100644 index 0000000..81d575a --- /dev/null +++ b/0003-Remove-QPrintPropertiesDialog-applyPrinterProperties.patch @@ -0,0 +1,85 @@ +From f135d515e8d6aaf1c136aef68e08b4f759075310 Mon Sep 17 00:00:00 2001 +From: Albert Astals Cid +Date: Mon, 4 Dec 2017 12:53:04 +0100 +Subject: [PATCH 04/54] Remove QPrintPropertiesDialog::applyPrinterProperties + +It's only ever called after the constructor so merge its code to the constructor + +Change-Id: Icca88764f725b9aeaa08ee7387da8885be247fba +Reviewed-by: Andy Shaw +--- + src/printsupport/dialogs/qprintdialog_unix.cpp | 21 ++++++--------------- + 1 file changed, 6 insertions(+), 15 deletions(-) + +diff --git a/src/printsupport/dialogs/qprintdialog_unix.cpp b/src/printsupport/dialogs/qprintdialog_unix.cpp +index 66d37dbec3..6cccdd03cd 100644 +--- a/src/printsupport/dialogs/qprintdialog_unix.cpp ++++ b/src/printsupport/dialogs/qprintdialog_unix.cpp +@@ -124,13 +124,11 @@ class QPrintPropertiesDialog : public QDialog + { + Q_OBJECT + public: +- QPrintPropertiesDialog(QAbstractPrintDialog *parent = nullptr); ++ QPrintPropertiesDialog(QPrinter *printer, QAbstractPrintDialog *parent = nullptr); + ~QPrintPropertiesDialog(); + + void selectPrinter(QPrinter::OutputFormat outputFormat, const QString &printerName); + +- /// copy printer properties to the widget +- void applyPrinterProperties(QPrinter *p); + void setupPrinter() const; + + private: +@@ -236,7 +234,7 @@ public: + + */ + +-QPrintPropertiesDialog::QPrintPropertiesDialog(QAbstractPrintDialog *parent) ++QPrintPropertiesDialog::QPrintPropertiesDialog(QPrinter *printer, QAbstractPrintDialog *parent) + : QDialog(parent) + { + setWindowTitle(tr("Printer Properties")); +@@ -250,8 +248,11 @@ QPrintPropertiesDialog::QPrintPropertiesDialog(QAbstractPrintDialog *parent) + connect(m_buttons->button(QDialogButtonBox::Ok), SIGNAL(clicked()), this, SLOT(accept())); + connect(m_buttons->button(QDialogButtonBox::Cancel), SIGNAL(clicked()), this, SLOT(reject())); + ++ widget.pageSetup->setPrinter(printer); ++ + #if QT_CONFIG(cupsjobwidget) + m_jobOptions = new QCupsJobWidget(); ++ m_jobOptions->setPrinter(printer); + widget.tabs->addTab(m_jobOptions, tr("Job Options")); + #endif + } +@@ -260,14 +261,6 @@ QPrintPropertiesDialog::~QPrintPropertiesDialog() + { + } + +-void QPrintPropertiesDialog::applyPrinterProperties(QPrinter *p) +-{ +- widget.pageSetup->setPrinter(p); +-#if QT_CONFIG(cupsjobwidget) +- m_jobOptions->setPrinter(p); +-#endif +-} +- + void QPrintPropertiesDialog::setupPrinter() const + { + widget.pageSetup->setupPrinter(); +@@ -846,12 +839,10 @@ void QUnixPrintWidgetPrivate::setupPrinterProperties() + if (propertiesDialog) + delete propertiesDialog; + +- propertiesDialog = new QPrintPropertiesDialog(q); ++ propertiesDialog = new QPrintPropertiesDialog(q->printer(), q); + propertiesDialog->setResult(QDialog::Rejected); + propertiesDialogShown = false; + +- propertiesDialog->applyPrinterProperties(q->printer()); +- + if (q->isOptionEnabled(QPrintDialog::PrintToFile) + && (widget.printers->currentIndex() == widget.printers->count() - 1)) {// PDF + propertiesDialog->selectPrinter(QPrinter::PdfFormat, QString()); +-- +2.15.1 + diff --git a/0004-Remove-QCupsJobWidget-setPrinter.patch b/0004-Remove-QCupsJobWidget-setPrinter.patch new file mode 100644 index 0000000..a99c16a --- /dev/null +++ b/0004-Remove-QCupsJobWidget-setPrinter.patch @@ -0,0 +1,75 @@ +From 881690969cc5a6a78df41e2d80ea1fa7bf07cb27 Mon Sep 17 00:00:00 2001 +From: Albert Astals Cid +Date: Mon, 4 Dec 2017 12:57:40 +0100 +Subject: [PATCH 05/54] Remove QCupsJobWidget::setPrinter + +It is only ever called after the constructor so merge the code + +Change-Id: I381165ad90c85342e5db3c16327d729388b71fb2 +Reviewed-by: Andy Shaw +--- + src/printsupport/dialogs/qprintdialog_unix.cpp | 3 +-- + src/printsupport/widgets/qcupsjobwidget.cpp | 10 +++------- + src/printsupport/widgets/qcupsjobwidget_p.h | 3 +-- + 3 files changed, 5 insertions(+), 11 deletions(-) + +diff --git a/src/printsupport/dialogs/qprintdialog_unix.cpp b/src/printsupport/dialogs/qprintdialog_unix.cpp +index 6cccdd03cd..8c9997d572 100644 +--- a/src/printsupport/dialogs/qprintdialog_unix.cpp ++++ b/src/printsupport/dialogs/qprintdialog_unix.cpp +@@ -251,8 +251,7 @@ QPrintPropertiesDialog::QPrintPropertiesDialog(QPrinter *printer, QAbstractPrint + widget.pageSetup->setPrinter(printer); + + #if QT_CONFIG(cupsjobwidget) +- m_jobOptions = new QCupsJobWidget(); +- m_jobOptions->setPrinter(printer); ++ m_jobOptions = new QCupsJobWidget(printer); + widget.tabs->addTab(m_jobOptions, tr("Job Options")); + #endif + } +diff --git a/src/printsupport/widgets/qcupsjobwidget.cpp b/src/printsupport/widgets/qcupsjobwidget.cpp +index 00f2d64df2..8fb07c86b0 100644 +--- a/src/printsupport/widgets/qcupsjobwidget.cpp ++++ b/src/printsupport/widgets/qcupsjobwidget.cpp +@@ -64,8 +64,9 @@ QT_BEGIN_NAMESPACE + \inmodule QtPrintSupport + */ + +-QCupsJobWidget::QCupsJobWidget(QWidget *parent) +- : QWidget(parent) ++QCupsJobWidget::QCupsJobWidget(QPrinter *printer, QWidget *parent) ++ : QWidget(parent), ++ m_printer(printer) + { + m_ui.setupUi(this); + //set all the default values +@@ -80,11 +81,6 @@ QCupsJobWidget::~QCupsJobWidget() + { + } + +-void QCupsJobWidget::setPrinter(QPrinter *printer) +-{ +- m_printer = printer; +-} +- + void QCupsJobWidget::setupPrinter() + { + QCUPSSupport::setJobHold(m_printer, jobHold(), jobHoldTime()); +diff --git a/src/printsupport/widgets/qcupsjobwidget_p.h b/src/printsupport/widgets/qcupsjobwidget_p.h +index 7d3c15938f..2aca6bc928 100644 +--- a/src/printsupport/widgets/qcupsjobwidget_p.h ++++ b/src/printsupport/widgets/qcupsjobwidget_p.h +@@ -71,9 +71,8 @@ class QCupsJobWidget : public QWidget + Q_OBJECT + + public: +- explicit QCupsJobWidget(QWidget *parent = 0); ++ explicit QCupsJobWidget(QPrinter *printer, QWidget *parent = nullptr); + ~QCupsJobWidget(); +- void setPrinter(QPrinter *printer); + void setupPrinter(); + + private Q_SLOTS: +-- +2.15.1 + diff --git a/0005-Remove-QPrintPropertiesDialog-selectPrinter.patch b/0005-Remove-QPrintPropertiesDialog-selectPrinter.patch new file mode 100644 index 0000000..380a915 --- /dev/null +++ b/0005-Remove-QPrintPropertiesDialog-selectPrinter.patch @@ -0,0 +1,91 @@ +From 072dd59de771d0c942afd68260251be71bd59542 Mon Sep 17 00:00:00 2001 +From: Albert Astals Cid +Date: Mon, 4 Dec 2017 13:05:02 +0100 +Subject: [PATCH 06/54] Remove QPrintPropertiesDialog::selectPrinter + +It is only ever called after the constructor, so merge the code + +Change-Id: I5c75a2cd367af401b41920f51754a64dc6c6eb40 +Reviewed-by: Andy Shaw +--- + src/printsupport/dialogs/qprintdialog_unix.cpp | 30 +++++++++++++------------- + 1 file changed, 15 insertions(+), 15 deletions(-) + +diff --git a/src/printsupport/dialogs/qprintdialog_unix.cpp b/src/printsupport/dialogs/qprintdialog_unix.cpp +index 8c9997d572..c7f7488917 100644 +--- a/src/printsupport/dialogs/qprintdialog_unix.cpp ++++ b/src/printsupport/dialogs/qprintdialog_unix.cpp +@@ -124,11 +124,10 @@ class QPrintPropertiesDialog : public QDialog + { + Q_OBJECT + public: +- QPrintPropertiesDialog(QPrinter *printer, QAbstractPrintDialog *parent = nullptr); ++ QPrintPropertiesDialog(QPrinter *printer, QPrinter::OutputFormat outputFormat, ++ const QString &printerName, QAbstractPrintDialog *parent = nullptr); + ~QPrintPropertiesDialog(); + +- void selectPrinter(QPrinter::OutputFormat outputFormat, const QString &printerName); +- + void setupPrinter() const; + + private: +@@ -234,7 +233,8 @@ public: + + */ + +-QPrintPropertiesDialog::QPrintPropertiesDialog(QPrinter *printer, QAbstractPrintDialog *parent) ++QPrintPropertiesDialog::QPrintPropertiesDialog(QPrinter *printer, QPrinter::OutputFormat outputFormat, ++ const QString &printerName, QAbstractPrintDialog *parent) + : QDialog(parent) + { + setWindowTitle(tr("Printer Properties")); +@@ -249,6 +249,7 @@ QPrintPropertiesDialog::QPrintPropertiesDialog(QPrinter *printer, QAbstractPrint + connect(m_buttons->button(QDialogButtonBox::Cancel), SIGNAL(clicked()), this, SLOT(reject())); + + widget.pageSetup->setPrinter(printer); ++ widget.pageSetup->selectPrinter(outputFormat, printerName); + + #if QT_CONFIG(cupsjobwidget) + m_jobOptions = new QCupsJobWidget(printer); +@@ -268,11 +269,6 @@ void QPrintPropertiesDialog::setupPrinter() const + #endif + } + +-void QPrintPropertiesDialog::selectPrinter(QPrinter::OutputFormat outputFormat, const QString &printerName) +-{ +- widget.pageSetup->selectPrinter(outputFormat, printerName); +-} +- + //////////////////////////////////////////////////////////////////////////////// + //////////////////////////////////////////////////////////////////////////////// + +@@ -838,16 +834,20 @@ void QUnixPrintWidgetPrivate::setupPrinterProperties() + if (propertiesDialog) + delete propertiesDialog; + +- propertiesDialog = new QPrintPropertiesDialog(q->printer(), q); +- propertiesDialog->setResult(QDialog::Rejected); +- propertiesDialogShown = false; ++ QPrinter::OutputFormat outputFormat; ++ QString printerName; + + if (q->isOptionEnabled(QPrintDialog::PrintToFile) + && (widget.printers->currentIndex() == widget.printers->count() - 1)) {// PDF +- propertiesDialog->selectPrinter(QPrinter::PdfFormat, QString()); ++ outputFormat = QPrinter::PdfFormat; ++ } else { ++ outputFormat = QPrinter::NativeFormat; ++ printerName = widget.printers->currentText(); + } +- else +- propertiesDialog->selectPrinter(QPrinter::NativeFormat, widget.printers->currentText()); ++ ++ propertiesDialog = new QPrintPropertiesDialog(q->printer(), outputFormat, printerName, q); ++ propertiesDialog->setResult(QDialog::Rejected); ++ propertiesDialogShown = false; + } + + void QUnixPrintWidgetPrivate::_q_btnPropertiesClicked() +-- +2.15.1 + diff --git a/0006-Remove-QPageSetupWidget-selectPrinter.patch b/0006-Remove-QPageSetupWidget-selectPrinter.patch new file mode 100644 index 0000000..fa66de7 --- /dev/null +++ b/0006-Remove-QPageSetupWidget-selectPrinter.patch @@ -0,0 +1,83 @@ +From ceccdff4e9fc93819d819b8ed15d95822f980505 Mon Sep 17 00:00:00 2001 +From: Albert Astals Cid +Date: Mon, 4 Dec 2017 13:10:17 +0100 +Subject: [PATCH 07/54] Remove QPageSetupWidget::selectPrinter + +t's only ever called after setPrinter so merge the code + +Change-Id: I4b5d593edbe62b64354e81c19112fa87b0555fdc +Reviewed-by: Andy Shaw +--- + src/printsupport/dialogs/qpagesetupdialog_unix.cpp | 12 ++---------- + src/printsupport/dialogs/qpagesetupdialog_unix_p.h | 3 +-- + src/printsupport/dialogs/qprintdialog_unix.cpp | 3 +-- + 3 files changed, 4 insertions(+), 14 deletions(-) + +diff --git a/src/printsupport/dialogs/qpagesetupdialog_unix.cpp b/src/printsupport/dialogs/qpagesetupdialog_unix.cpp +index c321552a19..49c0184289 100644 +--- a/src/printsupport/dialogs/qpagesetupdialog_unix.cpp ++++ b/src/printsupport/dialogs/qpagesetupdialog_unix.cpp +@@ -210,7 +210,7 @@ void QUnixPageSetupDialogPrivate::init() + Q_Q(QPageSetupDialog); + + widget = new QPageSetupWidget(q); +- widget->setPrinter(printer); ++ widget->setPrinter(printer, printer->outputFormat(), printer->printerName()); + + QDialogButtonBox *buttons = new QDialogButtonBox(QDialogButtonBox::Ok + | QDialogButtonBox::Cancel, +@@ -371,7 +371,7 @@ void QPageSetupWidget::initPageSizes() + + // Set the dialog to use the given QPrinter + // Usually only called on first creation +-void QPageSetupWidget::setPrinter(QPrinter *printer) ++void QPageSetupWidget::setPrinter(QPrinter *printer, QPrinter::OutputFormat outputFormat, const QString &printerName) + { + m_printer = printer; + +@@ -387,14 +387,6 @@ void QPageSetupWidget::setPrinter(QPrinter *printer) + m_units = m_pageLayout.units(); + m_pagePreview->setPageLayout(m_pageLayout); + +- // Then update the widget with the current printer details +- selectPrinter(m_printer->outputFormat(), m_printer->printerName()); +-} +- +-// The printer selected in the QPrintDialog has been changed, update the widget to reflect this +-// Note the QPrinter is not updated at this time in case the user presses the Cancel button in QPrintDialog +-void QPageSetupWidget::selectPrinter(QPrinter::OutputFormat outputFormat, const QString &printerName) +-{ + m_outputFormat = outputFormat; + m_printerName = printerName; + initPageSizes(); +diff --git a/src/printsupport/dialogs/qpagesetupdialog_unix_p.h b/src/printsupport/dialogs/qpagesetupdialog_unix_p.h +index 658f103bea..c57b01c2d6 100644 +--- a/src/printsupport/dialogs/qpagesetupdialog_unix_p.h ++++ b/src/printsupport/dialogs/qpagesetupdialog_unix_p.h +@@ -72,8 +72,7 @@ public: + explicit QPageSetupWidget(QWidget *parent = 0); + explicit QPageSetupWidget(QPrinter *printer, QWidget *parent = 0); + +- void setPrinter(QPrinter *printer); +- void selectPrinter(QPrinter::OutputFormat outputFormat, const QString &printerName); ++ void setPrinter(QPrinter *printer, QPrinter::OutputFormat outputFormat, const QString &printerName); + void setupPrinter() const; + + private slots: +diff --git a/src/printsupport/dialogs/qprintdialog_unix.cpp b/src/printsupport/dialogs/qprintdialog_unix.cpp +index c7f7488917..f87630f1a0 100644 +--- a/src/printsupport/dialogs/qprintdialog_unix.cpp ++++ b/src/printsupport/dialogs/qprintdialog_unix.cpp +@@ -248,8 +248,7 @@ QPrintPropertiesDialog::QPrintPropertiesDialog(QPrinter *printer, QPrinter::Outp + connect(m_buttons->button(QDialogButtonBox::Ok), SIGNAL(clicked()), this, SLOT(accept())); + connect(m_buttons->button(QDialogButtonBox::Cancel), SIGNAL(clicked()), this, SLOT(reject())); + +- widget.pageSetup->setPrinter(printer); +- widget.pageSetup->selectPrinter(outputFormat, printerName); ++ widget.pageSetup->setPrinter(printer, outputFormat, printerName); + + #if QT_CONFIG(cupsjobwidget) + m_jobOptions = new QCupsJobWidget(printer); +-- +2.15.1 + diff --git a/0007-Introduce-QPrintDevice-property-setProperty.patch b/0007-Introduce-QPrintDevice-property-setProperty.patch new file mode 100644 index 0000000..57b10bf --- /dev/null +++ b/0007-Introduce-QPrintDevice-property-setProperty.patch @@ -0,0 +1,113 @@ +From 70f6a35c8f0b6a73f4d568532e1365cd3e8ff8dd Mon Sep 17 00:00:00 2001 +From: Albert Astals Cid +Date: Mon, 4 Dec 2017 13:23:49 +0100 +Subject: [PATCH 37/54] Introduce QPrintDevice::property/setProperty + +So we can access QPlatformPrintDevice internals if needed + +Change-Id: Ib37c5717713f37262ef12d7b61793d80f05baf4a +Reviewed-by: Liang Qi +--- + src/printsupport/kernel/qplatformprintdevice.cpp | 15 +++++++++++++++ + src/printsupport/kernel/qplatformprintdevice.h | 6 ++++++ + src/printsupport/kernel/qprintdevice.cpp | 10 ++++++++++ + src/printsupport/kernel/qprintdevice_p.h | 7 +++++++ + 4 files changed, 38 insertions(+) + +diff --git a/src/printsupport/kernel/qplatformprintdevice.cpp b/src/printsupport/kernel/qplatformprintdevice.cpp +index e2d4a08de3..ad3f923bec 100644 +--- a/src/printsupport/kernel/qplatformprintdevice.cpp ++++ b/src/printsupport/kernel/qplatformprintdevice.cpp +@@ -381,6 +381,21 @@ void QPlatformPrintDevice::loadMimeTypes() const + { + } + ++QVariant QPlatformPrintDevice::property(QPrintDevice::PrintDevicePropertyKey key) const ++{ ++ Q_UNUSED(key) ++ ++ return QVariant(); ++} ++ ++bool QPlatformPrintDevice::setProperty(QPrintDevice::PrintDevicePropertyKey key, const QVariant &value) ++{ ++ Q_UNUSED(key) ++ Q_UNUSED(value) ++ ++ return false; ++} ++ + QList QPlatformPrintDevice::supportedMimeTypes() const + { + if (!m_haveMimeTypes) +diff --git a/src/printsupport/kernel/qplatformprintdevice.h b/src/printsupport/kernel/qplatformprintdevice.h +index 44a3a966f4..654bb123fb 100644 +--- a/src/printsupport/kernel/qplatformprintdevice.h ++++ b/src/printsupport/kernel/qplatformprintdevice.h +@@ -53,11 +53,14 @@ + + #include + #include ++#include + ++#include + #include + #include + #include + ++ + QT_BEGIN_NAMESPACE + + #ifndef QT_NO_PRINTER +@@ -118,6 +121,9 @@ public: + virtual QPrint::ColorMode defaultColorMode() const; + virtual QList supportedColorModes() const; + ++ virtual QVariant property(QPrintDevice::PrintDevicePropertyKey key) const; ++ virtual bool setProperty(QPrintDevice::PrintDevicePropertyKey key, const QVariant &value); ++ + #ifndef QT_NO_MIMETYPE + virtual QList supportedMimeTypes() const; + #endif +diff --git a/src/printsupport/kernel/qprintdevice.cpp b/src/printsupport/kernel/qprintdevice.cpp +index 26799a6f13..7096f5a2f6 100644 +--- a/src/printsupport/kernel/qprintdevice.cpp ++++ b/src/printsupport/kernel/qprintdevice.cpp +@@ -245,6 +245,16 @@ QList QPrintDevice::supportedColorModes() const + return isValid() ? d->supportedColorModes() : QList(); + } + ++QVariant QPrintDevice::property(PrintDevicePropertyKey key) const ++{ ++ return isValid() ? d->property(key) : QVariant(); ++} ++ ++bool QPrintDevice::setProperty(PrintDevicePropertyKey key, const QVariant &value) ++{ ++ return isValid() ? d->setProperty(key, value) : false; ++} ++ + #ifndef QT_NO_MIMETYPE + QList QPrintDevice::supportedMimeTypes() const + { +diff --git a/src/printsupport/kernel/qprintdevice_p.h b/src/printsupport/kernel/qprintdevice_p.h +index 1e0d3983e9..1a26d3afcf 100644 +--- a/src/printsupport/kernel/qprintdevice_p.h ++++ b/src/printsupport/kernel/qprintdevice_p.h +@@ -131,6 +131,13 @@ public: + QPrint::ColorMode defaultColorMode() const; + QList supportedColorModes() const; + ++ enum PrintDevicePropertyKey { ++ PDPK_CustomBase = 0xff00 ++ }; ++ ++ QVariant property(PrintDevicePropertyKey key) const; ++ bool setProperty(PrintDevicePropertyKey key, const QVariant &value); ++ + #ifndef QT_NO_MIMETYPE + QList supportedMimeTypes() const; + #endif +-- +2.15.1 + diff --git a/0008-Allow-access-to-ppd-file-and-ppdMarkOption-via-QPpdP.patch b/0008-Allow-access-to-ppd-file-and-ppdMarkOption-via-QPpdP.patch new file mode 100644 index 0000000..052eff3 --- /dev/null +++ b/0008-Allow-access-to-ppd-file-and-ppdMarkOption-via-QPpdP.patch @@ -0,0 +1,97 @@ +From e79efe94e3e77ee035ff7d046158a577759f8c7c Mon Sep 17 00:00:00 2001 +From: Albert Astals Cid +Date: Mon, 4 Dec 2017 14:05:55 +0100 +Subject: [PATCH 38/54] Allow access to ppd file and ppdMarkOption via + QPpdPrintDevice::property/setProperty + +Change-Id: I47b49b52121950fa8e3ea7a056974d9f3033490f +Reviewed-by: Liang Qi +--- + src/plugins/printsupport/cups/qppdprintdevice.cpp | 21 +++++++++++++++++++++ + src/plugins/printsupport/cups/qppdprintdevice.h | 3 +++ + src/printsupport/kernel/qcups_p.h | 3 +++ + src/printsupport/kernel/qprint_p.h | 1 + + 4 files changed, 28 insertions(+) + +diff --git a/src/plugins/printsupport/cups/qppdprintdevice.cpp b/src/plugins/printsupport/cups/qppdprintdevice.cpp +index 9efa83d409..ad829df23d 100644 +--- a/src/plugins/printsupport/cups/qppdprintdevice.cpp ++++ b/src/plugins/printsupport/cups/qppdprintdevice.cpp +@@ -42,6 +42,8 @@ + #include + #include + ++#include "private/qcups_p.h" // Only needed for PDPK_* ++ + #ifndef QT_LINUXBASE // LSB merges everything into cups.h + #include + #endif +@@ -421,6 +423,25 @@ QPrint::ColorMode QPpdPrintDevice::defaultColorMode() const + return QPrint::GrayScale; + } + ++QVariant QPpdPrintDevice::property(QPrintDevice::PrintDevicePropertyKey key) const ++{ ++ if (key == PDPK_PpdFile) ++ return QVariant::fromValue(m_ppd); ++ ++ return QVariant(); ++} ++ ++bool QPpdPrintDevice::setProperty(QPrintDevice::PrintDevicePropertyKey key, const QVariant &value) ++{ ++ if (key == PDPK_PpdOption) { ++ const QStringList values = value.toStringList(); ++ if (values.count() == 2) ++ return ppdMarkOption(m_ppd, values[0].toLatin1(), values[1].toLatin1()) == 0; ++ } ++ ++ return false; ++} ++ + #ifndef QT_NO_MIMETYPE + void QPpdPrintDevice::loadMimeTypes() const + { +diff --git a/src/plugins/printsupport/cups/qppdprintdevice.h b/src/plugins/printsupport/cups/qppdprintdevice.h +index 3cd7518b14..2e4dd3ab3b 100644 +--- a/src/plugins/printsupport/cups/qppdprintdevice.h ++++ b/src/plugins/printsupport/cups/qppdprintdevice.h +@@ -89,6 +89,9 @@ public: + + QPrint::ColorMode defaultColorMode() const Q_DECL_OVERRIDE; + ++ QVariant property(QPrintDevice::PrintDevicePropertyKey key) const Q_DECL_OVERRIDE; ++ bool setProperty(QPrintDevice::PrintDevicePropertyKey key, const QVariant &value) Q_DECL_OVERRIDE; ++ + protected: + void loadPageSizes() const Q_DECL_OVERRIDE; + void loadResolutions() const Q_DECL_OVERRIDE; +diff --git a/src/printsupport/kernel/qcups_p.h b/src/printsupport/kernel/qcups_p.h +index 780115e350..b67390c4ed 100644 +--- a/src/printsupport/kernel/qcups_p.h ++++ b/src/printsupport/kernel/qcups_p.h +@@ -67,6 +67,9 @@ QT_BEGIN_NAMESPACE + // removed from the dialogs. + #define PPK_CupsOptions QPrintEngine::PrintEnginePropertyKey(0xfe00) + ++#define PDPK_PpdFile QPrintDevice::PrintDevicePropertyKey(QPrintDevice::PDPK_CustomBase) ++#define PDPK_PpdOption QPrintDevice::PrintDevicePropertyKey(QPrintDevice::PDPK_CustomBase + 1) ++ + class Q_PRINTSUPPORT_EXPORT QCUPSSupport + { + public: +diff --git a/src/printsupport/kernel/qprint_p.h b/src/printsupport/kernel/qprint_p.h +index 280c2d7608..4956775461 100644 +--- a/src/printsupport/kernel/qprint_p.h ++++ b/src/printsupport/kernel/qprint_p.h +@@ -59,6 +59,7 @@ + + #if (defined Q_OS_MACOS) || (defined Q_OS_UNIX && QT_CONFIG(cups)) + #include // Use for type defs only, don't want to actually link in main module ++Q_DECLARE_METATYPE(ppd_file_t *) + #endif + + QT_BEGIN_NAMESPACE +-- +2.15.1 + diff --git a/0009-QPlatformPrintDevice-use-QVector-not-QList-in-the-AP.patch b/0009-QPlatformPrintDevice-use-QVector-not-QList-in-the-AP.patch new file mode 100644 index 0000000..db21877 --- /dev/null +++ b/0009-QPlatformPrintDevice-use-QVector-not-QList-in-the-AP.patch @@ -0,0 +1,240 @@ +From 5cb54cb5ebae99fab121061e25e26eec3056203a Mon Sep 17 00:00:00 2001 +From: Marc Mutz +Date: Tue, 12 Dec 2017 12:44:02 +0100 +Subject: [PATCH 44/54] QPlatformPrintDevice: use QVector, not QList in the API + +QPlaformPrintDevice uses QVector to store, but QList in the getters to +retrieve these data. Port API from QList to QVector to avoid +conversion between the two containers on every access. + +Saves almost 4KiB in text size (another 0.9% of QtPrintSupport). + +Change-Id: If33df141b87753803c45d9f4dae501a68abe49af +Reviewed-by: Lars Knoll +--- + src/printsupport/kernel/qplatformprintdevice.cpp | 16 ++++++++-------- + src/printsupport/kernel/qplatformprintdevice.h | 8 ++++---- + src/printsupport/kernel/qprintdevice.cpp | 16 ++++++++-------- + src/printsupport/kernel/qprintdevice_p.h | 8 ++++---- + src/printsupport/kernel/qprintengine_win.cpp | 8 ++++---- + src/printsupport/kernel/qprinterinfo.cpp | 2 +- + 6 files changed, 29 insertions(+), 29 deletions(-) + +diff --git a/src/printsupport/kernel/qplatformprintdevice.cpp b/src/printsupport/kernel/qplatformprintdevice.cpp +index 82bddedb1b..2f76156a91 100644 +--- a/src/printsupport/kernel/qplatformprintdevice.cpp ++++ b/src/printsupport/kernel/qplatformprintdevice.cpp +@@ -313,11 +313,11 @@ QPrint::InputSlot QPlatformPrintDevice::defaultInputSlot() const + return input; + } + +-QList QPlatformPrintDevice::supportedInputSlots() const ++QVector QPlatformPrintDevice::supportedInputSlots() const + { + if (!m_haveInputSlots) + loadInputSlots(); +- return m_inputSlots.toList(); ++ return m_inputSlots; + } + + void QPlatformPrintDevice::loadOutputBins() const +@@ -337,11 +337,11 @@ QPrint::OutputBin QPlatformPrintDevice::defaultOutputBin() const + return output; + } + +-QList QPlatformPrintDevice::supportedOutputBins() const ++QVector QPlatformPrintDevice::supportedOutputBins() const + { + if (!m_haveOutputBins) + loadOutputBins(); +- return m_outputBins.toList(); ++ return m_outputBins; + } + + void QPlatformPrintDevice::loadDuplexModes() const +@@ -353,11 +353,11 @@ QPrint::DuplexMode QPlatformPrintDevice::defaultDuplexMode() const + return QPrint::DuplexNone; + } + +-QList QPlatformPrintDevice::supportedDuplexModes() const ++QVector QPlatformPrintDevice::supportedDuplexModes() const + { + if (!m_haveDuplexModes) + loadDuplexModes(); +- return m_duplexModes.toList(); ++ return m_duplexModes; + } + + void QPlatformPrintDevice::loadColorModes() const +@@ -369,11 +369,11 @@ QPrint::ColorMode QPlatformPrintDevice::defaultColorMode() const + return QPrint::GrayScale; + } + +-QList QPlatformPrintDevice::supportedColorModes() const ++QVector QPlatformPrintDevice::supportedColorModes() const + { + if (!m_haveColorModes) + loadColorModes(); +- return m_colorModes.toList(); ++ return m_colorModes; + } + + #ifndef QT_NO_MIMETYPE +diff --git a/src/printsupport/kernel/qplatformprintdevice.h b/src/printsupport/kernel/qplatformprintdevice.h +index 1cac009660..8af76464b5 100644 +--- a/src/printsupport/kernel/qplatformprintdevice.h ++++ b/src/printsupport/kernel/qplatformprintdevice.h +@@ -110,16 +110,16 @@ public: + virtual QList supportedResolutions() const; + + virtual QPrint::InputSlot defaultInputSlot() const; +- virtual QList supportedInputSlots() const; ++ virtual QVector supportedInputSlots() const; + + virtual QPrint::OutputBin defaultOutputBin() const; +- virtual QList supportedOutputBins() const; ++ virtual QVector supportedOutputBins() const; + + virtual QPrint::DuplexMode defaultDuplexMode() const; +- virtual QList supportedDuplexModes() const; ++ virtual QVector supportedDuplexModes() const; + + virtual QPrint::ColorMode defaultColorMode() const; +- virtual QList supportedColorModes() const; ++ virtual QVector supportedColorModes() const; + + virtual QVariant property(QPrintDevice::PrintDevicePropertyKey key) const; + virtual bool setProperty(QPrintDevice::PrintDevicePropertyKey key, const QVariant &value); +diff --git a/src/printsupport/kernel/qprintdevice.cpp b/src/printsupport/kernel/qprintdevice.cpp +index 7096f5a2f6..2bc6906364 100644 +--- a/src/printsupport/kernel/qprintdevice.cpp ++++ b/src/printsupport/kernel/qprintdevice.cpp +@@ -210,9 +210,9 @@ QPrint::InputSlot QPrintDevice::defaultInputSlot() const + return isValid() ? d->defaultInputSlot() : QPrint::InputSlot(); + } + +-QList QPrintDevice::supportedInputSlots() const ++QVector QPrintDevice::supportedInputSlots() const + { +- return isValid() ? d->supportedInputSlots() : QList(); ++ return isValid() ? d->supportedInputSlots() : QVector{}; + } + + QPrint::OutputBin QPrintDevice::defaultOutputBin() const +@@ -220,9 +220,9 @@ QPrint::OutputBin QPrintDevice::defaultOutputBin() const + return isValid() ? d->defaultOutputBin() : QPrint::OutputBin(); + } + +-QList QPrintDevice::supportedOutputBins() const ++QVector QPrintDevice::supportedOutputBins() const + { +- return isValid() ? d->supportedOutputBins() : QList(); ++ return isValid() ? d->supportedOutputBins() : QVector{}; + } + + QPrint::DuplexMode QPrintDevice::defaultDuplexMode() const +@@ -230,9 +230,9 @@ QPrint::DuplexMode QPrintDevice::defaultDuplexMode() const + return isValid() ? d->defaultDuplexMode() : QPrint::DuplexNone; + } + +-QList QPrintDevice::supportedDuplexModes() const ++QVector QPrintDevice::supportedDuplexModes() const + { +- return isValid() ? d->supportedDuplexModes() : QList(); ++ return isValid() ? d->supportedDuplexModes() : QVector{}; + } + + QPrint::ColorMode QPrintDevice::defaultColorMode() const +@@ -240,9 +240,9 @@ QPrint::ColorMode QPrintDevice::defaultColorMode() const + return isValid() ? d->defaultColorMode() : QPrint::GrayScale; + } + +-QList QPrintDevice::supportedColorModes() const ++QVector QPrintDevice::supportedColorModes() const + { +- return isValid() ? d->supportedColorModes() : QList(); ++ return isValid() ? d->supportedColorModes() : QVector{}; + } + + QVariant QPrintDevice::property(PrintDevicePropertyKey key) const +diff --git a/src/printsupport/kernel/qprintdevice_p.h b/src/printsupport/kernel/qprintdevice_p.h +index 1a26d3afcf..3dff2e54fe 100644 +--- a/src/printsupport/kernel/qprintdevice_p.h ++++ b/src/printsupport/kernel/qprintdevice_p.h +@@ -120,16 +120,16 @@ public: + QList supportedResolutions() const; + + QPrint::InputSlot defaultInputSlot() const; +- QList supportedInputSlots() const; ++ QVector supportedInputSlots() const; + + QPrint::OutputBin defaultOutputBin() const; +- QList supportedOutputBins() const; ++ QVector supportedOutputBins() const; + + QPrint::DuplexMode defaultDuplexMode() const; +- QList supportedDuplexModes() const; ++ QVector supportedDuplexModes() const; + + QPrint::ColorMode defaultColorMode() const; +- QList supportedColorModes() const; ++ QVector supportedColorModes() const; + + enum PrintDevicePropertyKey { + PDPK_CustomBase = 0xff00 +diff --git a/src/printsupport/kernel/qprintengine_win.cpp b/src/printsupport/kernel/qprintengine_win.cpp +index e399118cc9..ba234b3aae 100644 +--- a/src/printsupport/kernel/qprintengine_win.cpp ++++ b/src/printsupport/kernel/qprintengine_win.cpp +@@ -1024,7 +1024,7 @@ bool QWin32PrintEnginePrivate::resetDC() + return hdc != 0; + } + +-static int indexOfId(const QList &inputSlots, QPrint::InputSlotId id) ++static int indexOfId(const QVector &inputSlots, QPrint::InputSlotId id) + { + for (int i = 0; i < inputSlots.size(); ++i) { + if (inputSlots.at(i).id == id) +@@ -1033,7 +1033,7 @@ static int indexOfId(const QList &inputSlots, QPrint::InputSl + return -1; + } + +-static int indexOfWindowsId(const QList &inputSlots, int windowsId) ++static int indexOfWindowsId(const QVector &inputSlots, int windowsId) + { + for (int i = 0; i < inputSlots.size(); ++i) { + if (inputSlots.at(i).windowsId == windowsId) +@@ -1210,7 +1210,7 @@ void QWin32PrintEngine::setProperty(PrintEnginePropertyKey key, const QVariant & + case PPK_PaperSource: { + if (!d->devMode) + break; +- const QList inputSlots = d->m_printDevice.supportedInputSlots(); ++ const auto inputSlots = d->m_printDevice.supportedInputSlots(); + const int paperSource = value.toInt(); + const int index = paperSource >= DMBIN_USER ? + indexOfWindowsId(inputSlots, paperSource) : indexOfId(inputSlots, QPrint::InputSlotId(paperSource)); +@@ -1465,7 +1465,7 @@ QVariant QWin32PrintEngine::property(PrintEnginePropertyKey key) const + if (d->devMode->dmDefaultSource >= DMBIN_USER) { + value = int(d->devMode->dmDefaultSource); + } else { +- const QList inputSlots = d->m_printDevice.supportedInputSlots(); ++ const auto inputSlots = d->m_printDevice.supportedInputSlots(); + const int index = indexOfWindowsId(inputSlots, d->devMode->dmDefaultSource); + value = index >= 0 ? inputSlots.at(index).id : QPrint::Auto; + } +diff --git a/src/printsupport/kernel/qprinterinfo.cpp b/src/printsupport/kernel/qprinterinfo.cpp +index d271e069ad..49a0c9ece4 100644 +--- a/src/printsupport/kernel/qprinterinfo.cpp ++++ b/src/printsupport/kernel/qprinterinfo.cpp +@@ -380,7 +380,7 @@ QList QPrinterInfo::supportedDuplexModes() const + { + Q_D(const QPrinterInfo); + QList list; +- const QList supportedDuplexModes = d->m_printDevice.supportedDuplexModes(); ++ const auto supportedDuplexModes = d->m_printDevice.supportedDuplexModes(); + list.reserve(supportedDuplexModes.size()); + for (QPrint::DuplexMode mode : supportedDuplexModes) + list << QPrinter::DuplexMode(mode); +-- +2.15.1 + diff --git a/0010-Reintroduce-the-Advanced-tab-in-the-QPrintProperties.patch b/0010-Reintroduce-the-Advanced-tab-in-the-QPrintProperties.patch new file mode 100644 index 0000000..5d56055 --- /dev/null +++ b/0010-Reintroduce-the-Advanced-tab-in-the-QPrintProperties.patch @@ -0,0 +1,527 @@ +From b4330bc391bbb08898f192ea3469b73aed09134c Mon Sep 17 00:00:00 2001 +From: Albert Astals Cid +Date: Tue, 5 Dec 2017 09:40:59 +0100 +Subject: [PATCH 50/54] Reintroduce the Advanced tab in the + QPrintPropertiesDialog + +This is mostly a revert of 69de6177615de3c4c31dea529172389e92f490b0 adapted to the new code. + +The commit that removed this code said: + a) there's duplicate settings in the advanced tabs and in the rest of the ui: this easily + solved with a blacklist + b) you can set these options in the system settings: probably true, but it is very cumbersome + to go to the printer settings every time i print to select from which tray the + paper should be used + +Task Number: QTBUG-54464 + +Change-Id: I7b1cacf51006dadb10aa6e00fe6dd2ff748fe576 +Reviewed-by: Frederik Gladhorn +--- + src/printsupport/dialogs/qprintdialog_unix.cpp | 401 ++++++++++++++++++++- + src/printsupport/dialogs/qprintpropertieswidget.ui | 14 + + 2 files changed, 409 insertions(+), 6 deletions(-) + +diff --git a/src/printsupport/dialogs/qprintdialog_unix.cpp b/src/printsupport/dialogs/qprintdialog_unix.cpp +index f87630f1a0..d5ad90e85e 100644 +--- a/src/printsupport/dialogs/qprintdialog_unix.cpp ++++ b/src/printsupport/dialogs/qprintdialog_unix.cpp +@@ -108,6 +108,11 @@ Print dialog class declarations + allow editing of Page and Advanced tabs. + + Layout in qprintpropertieswidget.ui ++ ++ QPPDOptionsModel: Holds the PPD Options for the printer. ++ ++ QPPDOptionsEditor: Edits the PPD Options for the printer. ++ + */ + + static void initResources() +@@ -124,19 +129,29 @@ class QPrintPropertiesDialog : public QDialog + { + Q_OBJECT + public: +- QPrintPropertiesDialog(QPrinter *printer, QPrinter::OutputFormat outputFormat, +- const QString &printerName, QAbstractPrintDialog *parent = nullptr); ++ QPrintPropertiesDialog(QPrinter *printer, QPrintDevice *currentPrintDevice, ++ QPrinter::OutputFormat outputFormat, const QString &printerName, ++ QAbstractPrintDialog *parent); + ~QPrintPropertiesDialog(); + + void setupPrinter() const; + ++ void showEvent(QShowEvent *event) override; ++ + private: + friend class QUnixPrintWidgetPrivate; ++ QPrinter *m_printer; + Ui::QPrintPropertiesWidget widget; + QDialogButtonBox *m_buttons; + #if QT_CONFIG(cupsjobwidget) + QCupsJobWidget *m_jobOptions; + #endif ++ ++#if QT_CONFIG(cups) ++ void setCupsOptionsFromItems(QOptionTreeItem *parent) const; ++ ++ QPPDOptionsModel *m_cupsOptionsModel; ++#endif + }; + + class QUnixPrintWidgetPrivate; +@@ -220,6 +235,70 @@ public: + QPrinter::OutputFormat printerOutputFormat; + }; + ++#if QT_CONFIG(cups) ++class QOptionTreeItem ++{ ++public: ++ enum ItemType { Root, Group, Option, Choice }; ++ ++ QOptionTreeItem(ItemType t, int i, const void *p, const char *desc, QOptionTreeItem *pi) ++ : type(t), ++ index(i), ++ ptr(p), ++ description(desc), ++ selected(-1), ++ selDescription(nullptr), ++ parentItem(pi) {} ++ ++ ~QOptionTreeItem() { ++ qDeleteAll(childItems); ++ } ++ ++ ItemType type; ++ int index; ++ const void *ptr; ++ const char *description; ++ int selected; ++ const char *selDescription; ++ QOptionTreeItem *parentItem; ++ QList childItems; ++}; ++ ++class QPPDOptionsModel : public QAbstractItemModel ++{ ++ Q_OBJECT ++ ++public: ++ explicit QPPDOptionsModel(QPrintDevice *currentPrintDevice, QObject *parent); ++ ++ int columnCount(const QModelIndex &parent = QModelIndex()) const override; ++ int rowCount(const QModelIndex &parent = QModelIndex()) const override; ++ QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override; ++ QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const override; ++ QModelIndex parent(const QModelIndex &index) const override; ++ Qt::ItemFlags flags(const QModelIndex &index) const override; ++ QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole ) const override; ++ ++ QPrintDevice *m_currentPrintDevice; ++ QTextCodec *cupsCodec; ++ QOptionTreeItem *rootItem; ++ void parseGroups(QOptionTreeItem *parent); ++ void parseOptions(QOptionTreeItem *parent); ++ void parseChoices(QOptionTreeItem *parent); ++}; ++ ++class QPPDOptionsEditor : public QStyledItemDelegate ++{ ++ Q_OBJECT ++public: ++ explicit QPPDOptionsEditor(QObject *parent) : QStyledItemDelegate(parent) {} ++ ++ QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const override; ++ void setEditorData(QWidget *editor, const QModelIndex &index) const override; ++ void setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const override; ++}; ++ ++#endif + + //////////////////////////////////////////////////////////////////////////////// + //////////////////////////////////////////////////////////////////////////////// +@@ -233,9 +312,11 @@ public: + + */ + +-QPrintPropertiesDialog::QPrintPropertiesDialog(QPrinter *printer, QPrinter::OutputFormat outputFormat, +- const QString &printerName, QAbstractPrintDialog *parent) ++QPrintPropertiesDialog::QPrintPropertiesDialog(QPrinter *printer, QPrintDevice *currentPrintDevice, ++ QPrinter::OutputFormat outputFormat, const QString &printerName, ++ QAbstractPrintDialog *parent) + : QDialog(parent) ++ , m_printer(printer) + { + setWindowTitle(tr("Printer Properties")); + QVBoxLayout *lay = new QVBoxLayout(this); +@@ -252,7 +333,29 @@ QPrintPropertiesDialog::QPrintPropertiesDialog(QPrinter *printer, QPrinter::Outp + + #if QT_CONFIG(cupsjobwidget) + m_jobOptions = new QCupsJobWidget(printer); +- widget.tabs->addTab(m_jobOptions, tr("Job Options")); ++ widget.tabs->insertTab(1, m_jobOptions, tr("Job Options")); ++#endif ++ ++ const int advancedTabIndex = widget.tabs->indexOf(widget.cupsPropertiesPage); ++#if QT_CONFIG(cups) ++ m_cupsOptionsModel = new QPPDOptionsModel(currentPrintDevice, this); ++ ++ widget.treeView->setItemDelegate(new QPPDOptionsEditor(this)); ++ ++ if (m_cupsOptionsModel->rowCount() > 0) { ++ widget.treeView->setModel(m_cupsOptionsModel); ++ ++ for (int i = 0; i < m_cupsOptionsModel->rowCount(); ++i) ++ widget.treeView->expand(m_cupsOptionsModel->index(i, 0)); ++ ++ widget.tabs->setTabEnabled(advancedTabIndex, true); ++ } else { ++ widget.treeView->setModel(nullptr); ++ widget.tabs->setTabEnabled(advancedTabIndex, false); ++ } ++#else ++ Q_UNUSED(currentPrintDevice) ++ widget.tabs->setTabEnabled(advancedTabIndex, false); + #endif + } + +@@ -266,8 +369,36 @@ void QPrintPropertiesDialog::setupPrinter() const + #if QT_CONFIG(cupsjobwidget) + m_jobOptions->setupPrinter(); + #endif ++ ++#if QT_CONFIG(cups) ++ setCupsOptionsFromItems(m_cupsOptionsModel->rootItem); ++#endif + } + ++void QPrintPropertiesDialog::showEvent(QShowEvent *event) ++{ ++ widget.treeView->resizeColumnToContents(0); ++ QDialog::showEvent(event); ++} ++ ++#if QT_CONFIG(cups) ++void QPrintPropertiesDialog::setCupsOptionsFromItems(QOptionTreeItem *parent) const ++{ ++ for (QOptionTreeItem *itm : qAsConst(parent->childItems)) { ++ if (itm->type == QOptionTreeItem::Option) { ++ const ppd_option_t *opt = static_cast(itm->ptr); ++ if (qstrcmp(opt->defchoice, opt->choices[itm->selected].choice) != 0) { ++ QStringList cupsOptions = QCUPSSupport::cupsOptionsList(m_printer); ++ QCUPSSupport::setCupsOption(cupsOptions, QString::fromLatin1(opt->keyword), QString::fromLatin1(opt->choices[itm->selected].choice)); ++ QCUPSSupport::setCupsOptions(m_printer, cupsOptions); ++ } ++ } else { ++ setCupsOptionsFromItems(itm); ++ } ++ } ++} ++#endif ++ + //////////////////////////////////////////////////////////////////////////////// + //////////////////////////////////////////////////////////////////////////////// + +@@ -844,7 +975,7 @@ void QUnixPrintWidgetPrivate::setupPrinterProperties() + printerName = widget.printers->currentText(); + } + +- propertiesDialog = new QPrintPropertiesDialog(q->printer(), outputFormat, printerName, q); ++ propertiesDialog = new QPrintPropertiesDialog(q->printer(), &m_currentPrintDevice, outputFormat, printerName, q); + propertiesDialog->setResult(QDialog::Rejected); + propertiesDialogShown = false; + } +@@ -952,6 +1083,264 @@ void QUnixPrintWidget::updatePrinter() + //////////////////////////////////////////////////////////////////////////////// + //////////////////////////////////////////////////////////////////////////////// + ++/* ++ ++ QPPDOptionsModel ++ ++ Holds the PPD Options for the printer. ++ ++*/ ++ ++#if QT_CONFIG(cups) ++ ++QPPDOptionsModel::QPPDOptionsModel(QPrintDevice *currentPrintDevice, QObject *parent) ++ : QAbstractItemModel(parent) ++ , m_currentPrintDevice(currentPrintDevice) ++{ ++ ppd_file_t *ppd = m_currentPrintDevice->property(PDPK_PpdFile).value(); ++ rootItem = new QOptionTreeItem(QOptionTreeItem::Root, 0, ppd, "Root Item", 0); ++ ++ if (ppd) { ++ cupsCodec = QTextCodec::codecForName(ppd->lang_encoding); ++ for (int i = 0; i < ppd->num_groups; ++i) { ++ QOptionTreeItem *group = new QOptionTreeItem(QOptionTreeItem::Group, i, &ppd->groups[i], ppd->groups[i].text, rootItem); ++ rootItem->childItems.append(group); ++ parseGroups(group); // parse possible subgroups ++ parseOptions(group); // parse options ++ } ++ } ++ ++ if (!cupsCodec) ++ cupsCodec = QTextCodec::codecForLocale(); ++} ++ ++int QPPDOptionsModel::columnCount(const QModelIndex &) const ++{ ++ return 2; ++} ++ ++int QPPDOptionsModel::rowCount(const QModelIndex &parent) const ++{ ++ QOptionTreeItem *itm; ++ if (!parent.isValid()) ++ itm = rootItem; ++ else ++ itm = static_cast(parent.internalPointer()); ++ ++ if (itm->type == QOptionTreeItem::Option) ++ return 0; ++ ++ return itm->childItems.count(); ++} ++ ++QVariant QPPDOptionsModel::data(const QModelIndex &index, int role) const ++{ ++ if (!index.isValid()) ++ return QVariant(); ++ ++ QOptionTreeItem *itm = static_cast(index.internalPointer()); ++ ++ switch (role) { ++ case Qt::FontRole: { ++ if (itm->type == QOptionTreeItem::Group){ ++ QFont font; ++ font.setBold(true); ++ return QVariant(font); ++ } ++ return QVariant(); ++ } ++ break; ++ ++ case Qt::DisplayRole: { ++ if (index.column() == 0) ++ return cupsCodec->toUnicode(itm->description); ++ else if (itm->type == QOptionTreeItem::Option && itm->selected > -1) ++ return cupsCodec->toUnicode(itm->selDescription); ++ else ++ return QVariant(); ++ } ++ break; ++ ++ } ++ ++ return QVariant(); ++} ++ ++QModelIndex QPPDOptionsModel::index(int row, int column, const QModelIndex &parent) const ++{ ++ QOptionTreeItem *itm; ++ if (!parent.isValid()) ++ itm = rootItem; ++ else ++ itm = static_cast(parent.internalPointer()); ++ ++ return createIndex(row, column, itm->childItems.at(row)); ++} ++ ++ ++QModelIndex QPPDOptionsModel::parent(const QModelIndex &index) const ++{ ++ if (!index.isValid()) ++ return QModelIndex(); ++ ++ QOptionTreeItem *itm = static_cast(index.internalPointer()); ++ ++ if (itm->parentItem && itm->parentItem != rootItem) ++ return createIndex(itm->parentItem->index, 0, itm->parentItem); ++ ++ return QModelIndex(); ++} ++ ++Qt::ItemFlags QPPDOptionsModel::flags(const QModelIndex &index) const ++{ ++ if (!index.isValid() || static_cast(index.internalPointer())->type == QOptionTreeItem::Group) ++ return Qt::ItemIsEnabled; ++ ++ if (index.column() == 1) ++ return Qt::ItemIsEnabled | Qt::ItemIsSelectable | Qt::ItemIsEditable; ++ ++ return Qt::ItemIsEnabled | Qt::ItemIsSelectable; ++} ++ ++void QPPDOptionsModel::parseGroups(QOptionTreeItem *parent) ++{ ++ const ppd_group_t *group = static_cast(parent->ptr); ++ ++ if (group) { ++ for (int i = 0; i < group->num_subgroups; ++i) { ++ QOptionTreeItem *subgroup = new QOptionTreeItem(QOptionTreeItem::Group, i, &group->subgroups[i], group->subgroups[i].text, parent); ++ parent->childItems.append(subgroup); ++ parseGroups(subgroup); // parse possible subgroups ++ parseOptions(subgroup); // parse options ++ } ++ } ++} ++ ++static bool isBlacklistedOption(const char *keyword) Q_DECL_NOTHROW ++{ ++ // We already let the user set these options elsewhere ++ const char *cupsOptionBlacklist[] = { ++ "Collate", ++ "Copies", ++ "OutputOrder", ++ "PageRegion", ++ "PageSize" ++ }; ++ auto equals = [](const char *keyword) { ++ return [keyword](const char *candidate) { ++ return qstrcmp(keyword, candidate) == 0; ++ }; ++ }; ++ return std::any_of(std::begin(cupsOptionBlacklist), std::end(cupsOptionBlacklist), equals(keyword)); ++}; ++ ++void QPPDOptionsModel::parseOptions(QOptionTreeItem *parent) ++{ ++ const ppd_group_t *group = static_cast(parent->ptr); ++ for (int i = 0; i < group->num_options; ++i) { ++ if (!isBlacklistedOption(group->options[i].keyword)) { ++ QOptionTreeItem *opt = new QOptionTreeItem(QOptionTreeItem::Option, i, &group->options[i], group->options[i].text, parent); ++ parent->childItems.append(opt); ++ parseChoices(opt); ++ } ++ } ++} ++ ++void QPPDOptionsModel::parseChoices(QOptionTreeItem *parent) ++{ ++ const ppd_option_t *option = static_cast(parent->ptr); ++ bool marked = false; ++ for (int i = 0; i < option->num_choices; ++i) { ++ QOptionTreeItem *choice = new QOptionTreeItem(QOptionTreeItem::Choice, i, &option->choices[i], option->choices[i].text, parent); ++ if (static_cast(option->choices[i].marked) == 1) { ++ parent->selected = i; ++ parent->selDescription = option->choices[i].text; ++ marked = true; ++ } else if (!marked && qstrcmp(option->choices[i].choice, option->defchoice) == 0) { ++ parent->selected = i; ++ parent->selDescription = option->choices[i].text; ++ } ++ parent->childItems.append(choice); ++ } ++} ++ ++QVariant QPPDOptionsModel::headerData(int section, Qt::Orientation, int role) const ++{ ++ if (role != Qt::DisplayRole) ++ return QVariant(); ++ ++ switch (section) { ++ case 0: ++ return QVariant(tr("Name")); ++ case 1: ++ return QVariant(tr("Value")); ++ } ++ ++ return QVariant(); ++} ++ ++//////////////////////////////////////////////////////////////////////////////// ++//////////////////////////////////////////////////////////////////////////////// ++ ++/* ++ ++ QPPDOptionsEditor ++ ++ Edits the PPD Options for the printer. ++ ++*/ ++ ++QWidget *QPPDOptionsEditor::createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const ++{ ++ Q_UNUSED(option) ++ ++ if (index.column() == 1 && static_cast(index.internalPointer())->type == QOptionTreeItem::Option) ++ return new QComboBox(parent); ++ ++ return nullptr; ++} ++ ++void QPPDOptionsEditor::setEditorData(QWidget *editor, const QModelIndex &index) const ++{ ++ if (index.column() != 1) ++ return; ++ ++ QComboBox *cb = static_cast(editor); ++ QOptionTreeItem *itm = static_cast(index.internalPointer()); ++ ++ if (itm->selected == -1) ++ cb->addItem(QString()); ++ ++ const QPPDOptionsModel *m = static_cast(index.model()); ++ for (auto *childItem : qAsConst(itm->childItems)) ++ cb->addItem(m->cupsCodec->toUnicode(childItem->description)); ++ ++ if (itm->selected > -1) ++ cb->setCurrentIndex(itm->selected); ++} ++ ++void QPPDOptionsEditor::setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const ++{ ++ QComboBox *cb = static_cast(editor); ++ QOptionTreeItem *itm = static_cast(index.internalPointer()); ++ ++ if (itm->selected == cb->currentIndex()) ++ return; ++ ++ const ppd_option_t *opt = static_cast(itm->ptr); ++ QPPDOptionsModel *m = static_cast(model); ++ ++ const auto values = QStringList{} << QString::fromLatin1(opt->keyword) << QString::fromLatin1(opt->choices[cb->currentIndex()].choice); ++ if (m->m_currentPrintDevice->setProperty(PDPK_PpdOption, values)) { ++ itm->selected = cb->currentIndex(); ++ itm->selDescription = static_cast(itm->ptr)->choices[itm->selected].text; ++ } ++} ++ ++//////////////////////////////////////////////////////////////////////////////// ++//////////////////////////////////////////////////////////////////////////////// ++ ++#endif // QT_CONFIG(cups) + #endif // defined (Q_OS_UNIX) + + QT_END_NAMESPACE +diff --git a/src/printsupport/dialogs/qprintpropertieswidget.ui b/src/printsupport/dialogs/qprintpropertieswidget.ui +index 66d7b80fcd..0e56fb33df 100644 +--- a/src/printsupport/dialogs/qprintpropertieswidget.ui ++++ b/src/printsupport/dialogs/qprintpropertieswidget.ui +@@ -32,6 +32,20 @@ + + + ++ ++ ++ Advanced ++ ++ ++ ++ ++ ++ true ++ ++ ++ ++ ++ + + + +-- +2.15.1 + diff --git a/0011-QtPrintSupport-Fix-build.patch b/0011-QtPrintSupport-Fix-build.patch new file mode 100644 index 0000000..febef1e --- /dev/null +++ b/0011-QtPrintSupport-Fix-build.patch @@ -0,0 +1,32 @@ +From e31c79ece49f0893882f9062edc9664926b9b13f Mon Sep 17 00:00:00 2001 +From: Friedemann Kleint +Date: Mon, 18 Dec 2017 09:31:11 +0100 +Subject: [PATCH 54/54] QtPrintSupport: Fix build + +dialogs/qprintdialog_unix.cpp:1104:21: error: incomplete type 'QTextCodec' used in nested name specifier + +Amends b4330bc391bbb08898f192ea3469b73aed09134c. + +Task-number: QTBUG-54464 +Change-Id: I555431d11a5c3f247d4f055d94255d2708c92374 +Reviewed-by: Albert Astals Cid +Reviewed-by: David Faure +--- + src/printsupport/dialogs/qprintdialog_unix.cpp | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/src/printsupport/dialogs/qprintdialog_unix.cpp b/src/printsupport/dialogs/qprintdialog_unix.cpp +index d5ad90e85e..9ad9fa35a5 100644 +--- a/src/printsupport/dialogs/qprintdialog_unix.cpp ++++ b/src/printsupport/dialogs/qprintdialog_unix.cpp +@@ -49,6 +49,7 @@ + #include "qfiledialog.h" + #endif + #include ++#include + #include + #if QT_CONFIG(filesystemmodel) + #include +-- +2.15.1 + diff --git a/libqt5-prioritise-gtk2-platformtheme.patch b/libqt5-prioritise-gtk2-platformtheme.patch index 62671d7..41e7984 100644 --- a/libqt5-prioritise-gtk2-platformtheme.patch +++ b/libqt5-prioritise-gtk2-platformtheme.patch @@ -1,8 +1,8 @@ -Index: qtbase-opensource-src-5.9.2/src/platformsupport/themes/genericunix/qgenericunixthemes.cpp +Index: qtbase-opensource-src-5.9.1/src/platformsupport/themes/genericunix/qgenericunixthemes.cpp =================================================================== ---- qtbase-opensource-src-5.9.2.orig/src/platformsupport/themes/genericunix/qgenericunixthemes.cpp -+++ qtbase-opensource-src-5.9.2/src/platformsupport/themes/genericunix/qgenericunixthemes.cpp -@@ -859,7 +859,9 @@ QStringList QGenericUnixTheme::themeName +--- qtbase-opensource-src-5.9.1.orig/src/platformsupport/themes/genericunix/qgenericunixthemes.cpp ++++ qtbase-opensource-src-5.9.1/src/platformsupport/themes/genericunix/qgenericunixthemes.cpp +@@ -828,7 +828,9 @@ QStringList QGenericUnixTheme::themeName result.push_back(QLatin1String(QKdeTheme::name)); #endif } else if (gtkBasedEnvironments.contains(desktopName)) { diff --git a/libqt5-qtbase.changes b/libqt5-qtbase.changes index 8fc1411..a48e635 100644 --- a/libqt5-qtbase.changes +++ b/libqt5-qtbase.changes @@ -1,3 +1,53 @@ +------------------------------------------------------------------- +Wed Dec 20 10:41:16 UTC 2017 - alarrosa@suse.com + +- Add 0001-Fix-custom-page-size-handling-in-the-Unix-print-dial.patch + to fix custom page size handling in the Unix print dialog (QTBUG-58733) + +------------------------------------------------------------------- +Fri Dec 15 17:08:31 UTC 2017 - alarrosa@suse.com + +- Add patches from upstream to reintroduce the advanced tab in + the Qt printer properties dialog: + 0001-Remove-QPrintDialogPrivate-applyPrinterProperties-no.patch + 0002-Remove-QUnixPrintWidgetPrivate-applyPrinterPropertie.patch + 0003-Remove-QPrintPropertiesDialog-applyPrinterProperties.patch + 0004-Remove-QCupsJobWidget-setPrinter.patch + 0005-Remove-QPrintPropertiesDialog-selectPrinter.patch + 0006-Remove-QPageSetupWidget-selectPrinter.patch + 0007-Introduce-QPrintDevice-property-setProperty.patch + 0008-Allow-access-to-ppd-file-and-ppdMarkOption-via-QPpdP.patch + 0009-QPlatformPrintDevice-use-QVector-not-QList-in-the-AP.patch + 0010-Reintroduce-the-Advanced-tab-in-the-QPrintProperties.patch + 0011-QtPrintSupport-Fix-build.patch +- Small change in 0001-Add-remote-print-queue-support.patch so + 0007-Allow-access-to-ppd-file-and-ppdMarkOption-via-QPpdP.patch + applies cleanly. + +------------------------------------------------------------------- +Fri Dec 8 23:11:00 UTC 2017 - christophe@krop.fr + +- Update the license tag (boo#967696) + +------------------------------------------------------------------- +Thu Dec 7 12:18:04 UTC 2017 - fabian@ritter-vogt.de + +- Update to 5.10.0 final + * New bugfix release + +------------------------------------------------------------------- +Sun Dec 3 14:12:46 UTC 2017 - fabian@ritter-vogt.de + +- Update to 5.10.0 RC 2 + * New bugfix release + +------------------------------------------------------------------- +Thu Nov 30 09:47:10 UTC 2017 - fabian@ritter-vogt.de + +- Update to 5.10.0 RC 1 + * New bugfix release +- Refresh tell-the-truth-about-private-api.patch + ------------------------------------------------------------------- Sat Nov 25 12:46:32 UTC 2017 - fabian@ritter-vogt.de @@ -8,11 +58,47 @@ Sat Nov 25 12:46:32 UTC 2017 - fabian@ritter-vogt.de - Drop patches, now upstream: * qglxconvenience-avoid-null-pointer-deref.patch +------------------------------------------------------------------- +Wed Nov 15 11:41:32 UTC 2017 - fabian@ritter-vogt.de + +- Update to 5.10 Beta 4 +- Contains bugfixes +- Refresh tell-the-truth-about-private-api.patch + +------------------------------------------------------------------- +Thu Nov 2 07:22:12 UTC 2017 - fabian@ritter-vogt.de + +- Update to 5.10 Beta 3 +- Contains bugfixes +- Remove patches, now upstream: + * 0001-Cups-Check-the-created-QPrintDevice-is-valid-before-.patch + +------------------------------------------------------------------- +Mon Oct 30 16:19:18 UTC 2017 - fabian@ritter-vogt.de + +- Update to 5.10 Beta 2 +- Contains bugfixes +- Remove patches, now upstream: + * qglxconvenience-avoid-null-pointer-deref.patch + ------------------------------------------------------------------- Fri Oct 27 18:52:40 UTC 2017 - fabian@ritter-vogt.de - Update 0001-QSslSocket-OpenSSL-1.1-backend.patch from git +------------------------------------------------------------------- +Tue Oct 24 18:26:45 UTC 2017 - fabian@ritter-vogt.de + +- Add patch to potentially fix printing: + * 0001-Cups-Check-the-created-QPrintDevice-is-valid-before-.patch + +------------------------------------------------------------------- +Mon Oct 9 16:17:18 UTC 2017 - fabian@ritter-vogt.de + +- Update to 5.10 Beta 1 +- For more information visit: + https://blog.qt.io/blog/2017/10/09/qt-5-10-beta-released/ + ------------------------------------------------------------------- Sun Oct 8 13:54:30 UTC 2017 - lbeltrame@kde.org @@ -32,6 +118,56 @@ Fri Sep 29 15:16:44 UTC 2017 - jengelh@inai.de - Update package descriptions and grouping. - Use find -exec's "+" strategy +------------------------------------------------------------------- +Mon Sep 25 14:42:37 CEST 2017 - fabian@ritter-vogt.de + +- Update to 5.10 Alpha 1: + * Qt Core + + Added rudimentary implementation of QStringView. It is missing some (important) const-QString functions, but is fully functional as an interface type. To be completed for Qt 5.11. + + Added many more functions to QLatin1String, too, co-evolving QLatin1String as the const char*-Latin-1-version of QStringView. + + Added QIODevice::skip() to improve performance in read operations. + + Explicitly little and big-endian integer types exposed (for instance qint16_le, quint32_be) for machine-independent data-type parsing. + + Added QRandomGenerator providing a simple API for high-quality (optionally seed-less) random numbers. + + Added accessors for metadata time fields of files to QFileInfo. + + Added QSemaphoreReleaser a RAII-style class for QSemaphore. + + Added QKeyValueIterator for more efficient iteration over keys of an associative container + + * Qt GUI + + Added cross-platform Vulkan enablers for Windows, Linux (xcb) and Android (level 23+): QVulkanInstance, QWindow with type VulkanSurface, and QVulkanWindow + + Added new flags and functions to QSurfaceFormat and QOpenGLWidget to request sRGB-capable default/backing framebuffers + + The OpenGL ES 3.2 API is now exposed in a cross-platform manner via QOpenGLExtraFunctions. + + QImages can now use more than 2GByte of pixel data. + + Added QFont::PreferNoShaping style strategy. + + * Qt Widgets + + QWidget::createWindowContainer() is now functional on Android + + QOpenGLWidget is now usable for rendering and reading back (grabbing) offscreen content. + + Added AA_DisableWindowContextHelpButton attribute that prevents the automatic" What's this" button on dialogs on Windows + + Added tabStopDistance property in QTextOption, QTextEdit and QPlainTextEdit + + Added selectionEnd(), selectionLength() to QLineEdit, complementing selectionStart() + + Added setDoubleStep to QInputDialog, to enable changing of the step amount for getDouble() + + Added isPersistentEditorOpen() to QAbstractItemView, QTreeWidget, QTableWidget and QListWidget + + Added new style hint: SH_TitleBar_ShowToolTipsOnButtons + + Added support for specifying custom internal texture formats in QOpenGLWidget + + QDockWidget acquired the ability to be dropped together side by side + + * Qt Network + + OpenSSL 1.1 back-end. + + Persistent store of HSTS policies in QNAM (QSettings-based). + + Implemented the h2c procotol upgrade used by non-SSL HTTP/2. +- For more information visit: + https://blog.qt.io/blog/2017/09/13/qt-5-10-alpha-released/ +- Remove patches, now upstream: + * de63bbd2f806b0219a60775017899cedb121581f.patch + * 0001-Fix-Qt5DBusMacros.cmake-for-CMake-3.9.patch + * 0001-QSslSocket-OpenSSL-1.1-backend.patch + * 0001-Fix-open-chmod-race-condition-in-QSaveFile.patch + * 0001-Fix-at-spi2-build.patch + * dont-abort-missing-display.patch +- Refresh qglxconvenience-avoid-null-pointer-deref.patch +- Build against pcre2 +- Enable EGLFS with GBM, SCTP, Vulkan + ------------------------------------------------------------------- Wed Sep 13 12:38:49 UTC 2017 - fabian@ritter-vogt.de diff --git a/libqt5-qtbase.spec b/libqt5-qtbase.spec index 03e0402..b4e57ba 100644 --- a/libqt5-qtbase.spec +++ b/libqt5-qtbase.spec @@ -20,23 +20,30 @@ %define journald 0 %ifarch %arm aarch64 -%define gles 1 +%global gles 1 %else -%define gles 0 +%global gles 0 +%endif + +%if 0%{?suse_version} >= 1330 +%global vulkan 1 +%else +# Vulkan headers too old +%global vulkan 0 %endif Name: libqt5-qtbase -Version: 5.9.3 +Version: 5.10.0 Release: 0 Summary: C++ Program Library, Core Components -License: GPL-3.0 or SUSE-LGPL-2.1-with-digia-exception-1.1 +License: LGPL-2.1-with-Qt-Company-Qt-exception-1.1 or LGPL-3.0-with-Qt-Company-Qt-exception-1.1 Group: System/Libraries Url: https://www.qt.io %define base_name libqt5 -%define real_version 5.9.3 -%define so_version 5.9.3 -%define tar_version qtbase-opensource-src-%{real_version} -Source: https://download.qt.io/official_releases/qt/5.9/%{real_version}/submodules/%{tar_version}.tar.xz +%define real_version 5.10.0 +%define so_version 5.10.0 +%define tar_version qtbase-everywhere-src-5.10.0 +Source: https://download.qt.io/official_releases/qt/5.10/%{real_version}/submodules/%{tar_version}.tar.xz # to get mtime of file: Source1: libqt5-qtbase.changes Source2: macros.qt5 @@ -53,14 +60,25 @@ Patch8: tell-the-truth-about-private-api.patch # PATCH-FIX-OPENSUSE libqt5-prioritise-gtk2-platformtheme.patch boo#1002900 -- Give Gtk2 Platform Theme (from qtstyleplugins) a priority over Gtk3 PT which currently lacks QGtk3Style. Patch10: libqt5-prioritise-gtk2-platformtheme.patch # PATCH-FEATURE-OPENSUSE 0001-Add-remote-print-queue-support.patch fate#322052 -- Automatically recognize and allow printing to remote cups servers -Patch11: 0001-Add-remote-print-queue-support.patch +Patch12: 0001-Add-remote-print-queue-support.patch # PATCH-FIX-OPENSUSE -Patch12: force-cmake-private-headers.patch +Patch15: force-cmake-private-headers.patch # PATCH-FIX-UPSTREAM -Patch13: qapplication-emit-palettechanged.patch -# patches 1000-2000 and above from upstream 5.9 branch # -# patches 2000-3000 and above from upstream 5.10/dev branch # -Patch2000: 0001-QSslSocket-OpenSSL-1.1-backend.patch +Patch17: qapplication-emit-palettechanged.patch +# patches 1000- 2000 and above from upstream 5.10 branch # +# patches 2000-3000 and above from upstream 5.11/dev branch # +Patch2000: 0001-Remove-QPrintDialogPrivate-applyPrinterProperties-no.patch +Patch2001: 0002-Remove-QUnixPrintWidgetPrivate-applyPrinterPropertie.patch +Patch2002: 0003-Remove-QPrintPropertiesDialog-applyPrinterProperties.patch +Patch2003: 0004-Remove-QCupsJobWidget-setPrinter.patch +Patch2004: 0005-Remove-QPrintPropertiesDialog-selectPrinter.patch +Patch2005: 0006-Remove-QPageSetupWidget-selectPrinter.patch +Patch2006: 0007-Introduce-QPrintDevice-property-setProperty.patch +Patch2007: 0008-Allow-access-to-ppd-file-and-ppdMarkOption-via-QPpdP.patch +Patch2008: 0009-QPlatformPrintDevice-use-QVector-not-QList-in-the-AP.patch +Patch2009: 0010-Reintroduce-the-Advanced-tab-in-the-QPrintProperties.patch +Patch2010: 0011-QtPrintSupport-Fix-build.patch +Patch2011: 0001-Fix-custom-page-size-handling-in-the-Unix-print-dial.patch BuildRequires: alsa-devel BuildRequires: cups-devel BuildRequires: double-conversion-devel @@ -70,9 +88,11 @@ BuildRequires: libmng-devel BuildRequires: libmysqlclient-devel BuildRequires: libpng-devel BuildRequires: libproxy-devel +BuildRequires: lksctp-tools-devel BuildRequires: libtiff-devel BuildRequires: openssl-devel BuildRequires: pcre-devel +BuildRequires: pcre2-devel BuildRequires: pkgconfig BuildRequires: pkgconfig(mtdev) %if %qt5_snapshot @@ -86,15 +106,18 @@ BuildRequires: pkgconfig(dbus-1) BuildRequires: pkgconfig(egl) BuildRequires: pkgconfig(fontconfig) BuildRequires: pkgconfig(freetype2) +BuildRequires: pkgconfig(gbm) BuildRequires: pkgconfig(gl) %if %gles BuildRequires: Mesa-libGLESv3-devel -BuildRequires: pkgconfig(gbm) BuildRequires: pkgconfig(glesv2) %endif BuildRequires: libicu-devel BuildRequires: libpulse-devel BuildRequires: tslib-devel +%if %{vulkan} +BuildRequires: vulkan-devel +%endif BuildRequires: xcb-util-image-devel BuildRequires: xcb-util-keysyms-devel BuildRequires: xcb-util-renderutil-devel @@ -138,16 +161,27 @@ handling. %define libqt5_translationdir %{libqt5_datadir}/translations %prep -%setup -q -n qtbase-opensource-src-%{real_version} +%setup -q -n %{tar_version} %patch3 -p1 %patch5 -p1 %patch6 -p1 %patch8 -p1 %patch10 -p1 -%patch11 -p1 %patch12 -p1 -%patch13 -p1 +%patch15 -p1 +%patch17 -p1 %patch2000 -p1 +%patch2001 -p1 +%patch2002 -p1 +%patch2003 -p1 +%patch2004 -p1 +%patch2005 -p1 +%patch2006 -p1 +%patch2007 -p1 +%patch2008 -p1 +%patch2009 -p1 +%patch2010 -p1 +%patch2011 -p1 # be sure not to use them rm -rf src/3rdparty/{libjpeg,freetype,zlib} @@ -588,6 +622,9 @@ Requires: pkgconfig(glesv2) %else Requires: pkgconfig(gl) %endif +%if %{vulkan} +Requires: vulkan-devel +%endif Requires: pkgconfig(egl) Requires: pkgconfig(libdrm) @@ -777,18 +814,12 @@ Recommends: libqt5-qtbase-devel Examples for the libqt5-qtbase modules. %build -#export QMAKESPEC=$PWD/mkspecs/linux-g++ %ifarch ppc64 RPM_OPT_FLAGS="%{optflags} -mminimal-toc" %endif export CXXFLAGS="$CXXFLAGS %{optflags} -DOPENSSL_LOAD_CONF" export CFLAGS="$CFLAGS %{optflags} -DOPENSSL_LOAD_CONF" export MAKEFLAGS="%{?_smp_mflags}" -%ifarch sparc64 -platform="-platform linux-g++-64" -%else -platform="" -%endif %define xkbconfigroot %(pkg-config --variable=xkb_base xkeyboard-config) #if %qt5_snapshot #force the configure script to generate the forwarding headers (it checks whether .git directory exists) @@ -800,7 +831,7 @@ sed -i 's|qt_instdate=`date +%Y-%m-%d`|qt_instdate=$CHANGES|g' configure # so non-qt5 apps/libs don't get stripped sed -i -e 's|^\(QMAKE_STRIP.*=\).*$|\1|g' mkspecs/common/linux.conf -echo yes | ./configure $platform \ +echo yes | ./configure \ -prefix %{_prefix} \ -L %{libqt5_libdir} \ -libdir %{libqt5_libdir} \ @@ -822,11 +853,10 @@ echo yes | ./configure $platform \ -no-reduce-relocations \ %endif %ifarch %ix86 -%if 0%{?sle_version:%sle_version} < 150000 +%if 0%{?sle_version} < 150000 -no-sse2 -no-pch \ %endif %endif - -optimized-qmake \ -accessibility \ -no-strip \ -opensource \ @@ -847,6 +877,7 @@ echo yes | ./configure $platform \ -system-zlib \ -no-pch \ -glib \ + -sctp \ -system-sqlite \ -no-sql-mysql \ -no-strip \ @@ -858,12 +889,12 @@ echo yes | ./configure $platform \ -egl \ -eglfs \ %if %gles - -eglfs -kms \ + -kms \ -opengl es2 \ %else -opengl desktop \ %endif - -release \ + -release \ -plugin-sql-sqlite -nomake tests \ -plugin-sql-psql -I/usr/include/pgsql/ -I/usr/include/pgsql/server \ -plugin-sql-odbc \ @@ -875,7 +906,7 @@ make %{?_smp_mflags} make INSTALL_ROOT=%{buildroot} install %ifarch %ix86 -%if 0%{?sle_version:%sle_version} < 150000 +%if 0%{?sle_version} < 150000 install -d %{buildroot}%{libqt5_libdir}/sse2/ pushd src/corelib; make clean ; ../../bin/qmake -config sse2; make %{?_smp_mflags} @@ -900,7 +931,7 @@ find %{buildroot}%{libqt5_libdir}/ -name 'lib*.a' -exec chmod -x -- {} + rm -fv %{buildroot}%{libqt5_libdir}/lib*.la rm -fv %{buildroot}%{libqt5_libdir}/*png.* -# +# rm -fv %{buildroot}%{libqt5_libdir}/cmake/Qt5*/Q*Plugin.cmake mkdir -p %{buildroot}%{libqt5_plugindir}/sqldrivers @@ -982,6 +1013,8 @@ popd %{libqt5_bindir}/rcc* %{_bindir}/uic* %{libqt5_bindir}/uic* +%{_bindir}/qvkgen* +%{libqt5_bindir}/qvkgen* %{_bindir}/syncqt.pl* %{_bindir}/fixqt4headers.pl* %{libqt5_bindir}/syncqt.pl* @@ -999,7 +1032,7 @@ popd %doc *.txt LICENSE.* %{libqt5_libdir}/libQt5Core.so.* %ifarch %ix86 -%if 0%{?sle_version:%sle_version} < 150000 +%if 0%{?sle_version} < 150000 %dir %{libqt5_libdir}/sse2 %{libqt5_libdir}/sse2/libQt5Core.so.* %endif @@ -1275,6 +1308,12 @@ popd %{libqt5_libdir}/libQt5ServiceSupport.prl %{libqt5_libdir}/libQt5ThemeSupport.a %{libqt5_libdir}/libQt5ThemeSupport.prl +%{libqt5_libdir}/libQt5EdidSupport.a +%{libqt5_libdir}/libQt5EdidSupport.prl +%if %{vulkan} +%{libqt5_libdir}/libQt5VulkanSupport.a +%{libqt5_libdir}/libQt5VulkanSupport.prl +%endif %{libqt5_includedir}/QtAccessibilitySupport/ %{libqt5_includedir}/QtDeviceDiscoverySupport/ %{libqt5_includedir}/QtEglSupport/ @@ -1289,6 +1328,10 @@ popd %{libqt5_includedir}/QtPlatformCompositorSupport/ %{libqt5_includedir}/QtServiceSupport/ %{libqt5_includedir}/QtThemeSupport/ +%{libqt5_includedir}/QtEdidSupport/ +%if %{vulkan} +%{libqt5_includedir}/QtVulkanSupport/ +%endif %exclude %{libqt5_includedir}/QtAccessibilitySupport/%{so_version}/ %exclude %{libqt5_includedir}/QtDeviceDiscoverySupport/%{so_version}/ %exclude %{libqt5_includedir}/QtEglSupport/%{so_version}/ @@ -1303,6 +1346,10 @@ popd %exclude %{libqt5_includedir}/QtPlatformCompositorSupport/%{so_version}/ %exclude %{libqt5_includedir}/QtServiceSupport/%{so_version}/ %exclude %{libqt5_includedir}/QtThemeSupport/%{so_version}/ +%exclude %{libqt5_includedir}/QtEdidSupport/%{so_version}/ +%if %{vulkan} +%exclude %{libqt5_includedir}/QtVulkanSupport/%{so_version}/ +%endif %files -n libQt5KmsSupport-devel-static %defattr(-,root,root,755) @@ -1360,6 +1407,10 @@ popd %{libqt5_includedir}/QtPlatformCompositorSupport/%{so_version}/ %{libqt5_includedir}/QtServiceSupport/%{so_version}/ %{libqt5_includedir}/QtThemeSupport/%{so_version}/ +%{libqt5_includedir}/QtEdidSupport/%{so_version}/ +%if %{vulkan} +%{libqt5_includedir}/QtVulkanSupport/%{so_version}/ +%endif %files -n libQt5PrintSupport-private-headers-devel %defattr(-,root,root,755) diff --git a/qtbase-everywhere-src-5.10.0.tar.xz b/qtbase-everywhere-src-5.10.0.tar.xz new file mode 100644 index 0000000..934ae5a --- /dev/null +++ b/qtbase-everywhere-src-5.10.0.tar.xz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:fd5578cd320a13617c12cf2b19439386b203d6d45548e855f94e07be9829f762 +size 45851596 diff --git a/qtbase-opensource-src-5.9.3.tar.xz b/qtbase-opensource-src-5.9.3.tar.xz deleted file mode 100644 index 4e61c80..0000000 --- a/qtbase-opensource-src-5.9.3.tar.xz +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:9e7c44005e7691dc7c85165bd4510282c47f0163521f4973eab71dbdb39a9982 -size 45160080 diff --git a/tell-the-truth-about-private-api.patch b/tell-the-truth-about-private-api.patch index 75ec9e3..ac59bdc 100644 --- a/tell-the-truth-about-private-api.patch +++ b/tell-the-truth-about-private-api.patch @@ -1,8 +1,8 @@ -diff --git a/mkspecs/features/qt_module.prf b/mkspecs/features/qt_module.prf -index f6cbf99..798472a 100644 ---- a/mkspecs/features/qt_module.prf -+++ b/mkspecs/features/qt_module.prf -@@ -214,9 +214,9 @@ android: CONFIG += qt_android_deps no_linker_version_script +Index: qtbase-everywhere-src-5.10.0-rc1/mkspecs/features/qt_module.prf +=================================================================== +--- qtbase-everywhere-src-5.10.0-rc1.orig/mkspecs/features/qt_module.prf ++++ qtbase-everywhere-src-5.10.0-rc1/mkspecs/features/qt_module.prf +@@ -216,9 +216,9 @@ android: CONFIG += qt_android_deps no_li QMAKE_LFLAGS += $${QMAKE_LFLAGS_VERSION_SCRIPT}$$verscript internal_module {