From cec893e4f0d6480a9b3e38af38c7b887a29f206d Mon Sep 17 00:00:00 2001 From: Oliver Wolff Date: Tue, 12 Aug 2014 20:04:05 +0300 Subject: Introduce secure transport backend for Windows Runtime The change creates a stub implementation for WinRT, adding the needed files and classes to build SSL support on that platform. Task-number: QTBUG-37497 Change-Id: Idc3e8aa91c5eb8a938705f2385d1074fe6c1d83e Reviewed-by: Richard J. Moore Reviewed-by: Andrew Knight --- src/network/access/qhttpnetworkconnection_p.h | 2 + src/network/ssl/qsslcertificate.cpp | 3 + src/network/ssl/qsslcertificate_winrt.cpp | 191 ++++++++++++++++++++++++ src/network/ssl/qsslkey_winrt.cpp | 82 +++++++++++ src/network/ssl/qsslsocket.cpp | 3 + src/network/ssl/qsslsocket.h | 2 +- src/network/ssl/qsslsocket_p.h | 16 +- src/network/ssl/qsslsocket_winrt.cpp | 204 ++++++++++++++++++++++++++ src/network/ssl/qsslsocket_winrt_p.h | 101 +++++++++++++ src/network/ssl/ssl.pri | 30 ++-- tools/configure/configureapp.cpp | 35 ++++- 11 files changed, 645 insertions(+), 24 deletions(-) create mode 100644 src/network/ssl/qsslcertificate_winrt.cpp create mode 100644 src/network/ssl/qsslkey_winrt.cpp create mode 100644 src/network/ssl/qsslsocket_winrt.cpp create mode 100644 src/network/ssl/qsslsocket_winrt_p.h diff --git a/src/network/access/qhttpnetworkconnection_p.h b/src/network/access/qhttpnetworkconnection_p.h index a96f67485f..379ed5acae 100644 --- a/src/network/access/qhttpnetworkconnection_p.h +++ b/src/network/access/qhttpnetworkconnection_p.h @@ -73,7 +73,9 @@ #ifndef QT_NO_HTTP #ifndef QT_NO_SSL +#ifndef QT_NO_OPENSSL # include +#endif # include # include # include diff --git a/src/network/ssl/qsslcertificate.cpp b/src/network/ssl/qsslcertificate.cpp index d5d568e45d..47ea3343ea 100644 --- a/src/network/ssl/qsslcertificate.cpp +++ b/src/network/ssl/qsslcertificate.cpp @@ -116,6 +116,9 @@ #ifndef QT_NO_OPENSSL #include "qsslsocket_openssl_symbols_p.h" #endif +#ifdef Q_OS_WINRT +#include "qsslsocket_winrt_p.h" +#endif #include "qsslcertificate.h" #include "qsslcertificate_p.h" diff --git a/src/network/ssl/qsslcertificate_winrt.cpp b/src/network/ssl/qsslcertificate_winrt.cpp new file mode 100644 index 0000000000..9c857a6787 --- /dev/null +++ b/src/network/ssl/qsslcertificate_winrt.cpp @@ -0,0 +1,191 @@ +/**************************************************************************** +** +** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/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 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + + + +#include "qsslcertificate.h" +#include "qsslcertificate_p.h" + +QT_BEGIN_NAMESPACE + +bool QSslCertificate::operator==(const QSslCertificate &other) const +{ + if (d == other.d) + return true; + return false; +} + +bool QSslCertificate::isNull() const +{ + Q_UNIMPLEMENTED(); + return true; +} + +bool QSslCertificate::isSelfSigned() const +{ + Q_UNIMPLEMENTED(); + return true; +} + +QByteArray QSslCertificate::version() const +{ + Q_UNIMPLEMENTED(); + return QByteArray(); +} + +QByteArray QSslCertificate::serialNumber() const +{ + Q_UNIMPLEMENTED(); + return QByteArray(); +} + +QStringList QSslCertificate::issuerInfo(SubjectInfo info) const +{ + Q_UNIMPLEMENTED(); + return QStringList(); +} + +QStringList QSslCertificate::issuerInfo(const QByteArray &attribute) const +{ + Q_UNIMPLEMENTED(); + return QStringList(); +} + +QStringList QSslCertificate::subjectInfo(SubjectInfo info) const +{ + Q_UNIMPLEMENTED(); + return QStringList(); +} + +QStringList QSslCertificate::subjectInfo(const QByteArray &attribute) const +{ + Q_UNIMPLEMENTED(); + return QStringList(); +} + +QList QSslCertificate::subjectInfoAttributes() const +{ + Q_UNIMPLEMENTED(); + return QList(); +} + +QList QSslCertificate::issuerInfoAttributes() const +{ + Q_UNIMPLEMENTED(); + return QList(); +} + +QMultiMap QSslCertificate::subjectAlternativeNames() const +{ + Q_UNIMPLEMENTED(); + return QMultiMap(); +} + +QDateTime QSslCertificate::effectiveDate() const +{ + Q_UNIMPLEMENTED(); + return QDateTime(); +} + +QDateTime QSslCertificate::expiryDate() const +{ + Q_UNIMPLEMENTED(); + return QDateTime(); +} + +Qt::HANDLE QSslCertificate::handle() const +{ + Q_UNIMPLEMENTED(); + return 0; +} + +QSslKey QSslCertificate::publicKey() const +{ + Q_UNIMPLEMENTED(); + return QSslKey(); +} + +QList QSslCertificate::extensions() const +{ + Q_UNIMPLEMENTED(); + return QList(); +} + +QByteArray QSslCertificate::toPem() const +{ + Q_UNIMPLEMENTED(); + return QByteArray(); +} + +QByteArray QSslCertificate::toDer() const +{ + Q_UNIMPLEMENTED(); + return QByteArray(); +} + +QString QSslCertificate::toText() const +{ + Q_UNIMPLEMENTED(); + return QString(); +} + +void QSslCertificatePrivate::init(const QByteArray &data, QSsl::EncodingFormat format) +{ + Q_UNIMPLEMENTED(); +} + +QList QSslCertificatePrivate::certificatesFromPem(const QByteArray &pem, int count) +{ + Q_UNIMPLEMENTED(); + Q_UNUSED(pem) + Q_UNUSED(count) + return QList(); +} + +QList QSslCertificatePrivate::certificatesFromDer(const QByteArray &der, int count) +{ + Q_UNIMPLEMENTED(); + Q_UNUSED(der) + Q_UNUSED(count) + return QList(); +} + +QT_END_NAMESPACE diff --git a/src/network/ssl/qsslkey_winrt.cpp b/src/network/ssl/qsslkey_winrt.cpp new file mode 100644 index 0000000000..1e416a8c09 --- /dev/null +++ b/src/network/ssl/qsslkey_winrt.cpp @@ -0,0 +1,82 @@ +/**************************************************************************** +** +** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/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 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qsslkey.h" +#include "qsslkey_p.h" + +QT_BEGIN_NAMESPACE + +void QSslKeyPrivate::clear(bool deep) +{ + Q_UNIMPLEMENTED(); +} + +void QSslKeyPrivate::decodeDer(const QByteArray &der, const QByteArray &passPhrase, + bool deepClear) +{ + Q_UNIMPLEMENTED(); +} + +void QSslKeyPrivate::decodePem(const QByteArray &pem, const QByteArray &passPhrase, + bool deepClear) +{ + Q_UNIMPLEMENTED(); +} + +int QSslKeyPrivate::length() const +{ + Q_UNIMPLEMENTED(); + return -1; +} + +QByteArray QSslKeyPrivate::toPem(const QByteArray &passPhrase) const +{ + Q_UNIMPLEMENTED(); + return QByteArray(); +} + +Qt::HANDLE QSslKeyPrivate::handle() const +{ + Q_UNIMPLEMENTED(); + return 0; +} + +QT_END_NAMESPACE diff --git a/src/network/ssl/qsslsocket.cpp b/src/network/ssl/qsslsocket.cpp index 5020c8dc0c..5df550b1c8 100644 --- a/src/network/ssl/qsslsocket.cpp +++ b/src/network/ssl/qsslsocket.cpp @@ -294,6 +294,9 @@ #ifndef QT_NO_OPENSSL #include "qsslsocket_openssl_p.h" #endif +#ifdef Q_OS_WINRT +#include "qsslsocket_winrt_p.h" +#endif #include "qsslconfiguration_p.h" #include diff --git a/src/network/ssl/qsslsocket.h b/src/network/ssl/qsslsocket.h index 9cc5e02de3..312ddb9850 100644 --- a/src/network/ssl/qsslsocket.h +++ b/src/network/ssl/qsslsocket.h @@ -217,7 +217,7 @@ private: Q_PRIVATE_SLOT(d_func(), void _q_flushWriteBuffer()) Q_PRIVATE_SLOT(d_func(), void _q_flushReadBuffer()) Q_PRIVATE_SLOT(d_func(), void _q_resumeImplementation()) -#ifdef Q_OS_WIN +#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) Q_PRIVATE_SLOT(d_func(), void _q_caRootLoaded(QSslCertificate,QSslCertificate)) #endif friend class QSslSocketBackendPrivate; diff --git a/src/network/ssl/qsslsocket_p.h b/src/network/ssl/qsslsocket_p.h index a86fac8f94..06e12297a4 100644 --- a/src/network/ssl/qsslsocket_p.h +++ b/src/network/ssl/qsslsocket_p.h @@ -72,11 +72,13 @@ #include #elif defined(Q_OS_WIN) #include +#ifndef Q_OS_WINRT #include +#endif // !Q_OS_WINRT #ifndef HCRYPTPROV_LEGACY #define HCRYPTPROV_LEGACY HCRYPTPROV -#endif -#endif +#endif // !HCRYPTPROV_LEGACY +#endif // Q_OS_WIN QT_BEGIN_NAMESPACE @@ -86,7 +88,7 @@ QT_BEGIN_NAMESPACE typedef OSStatus (*PtrSecTrustCopyAnchorCertificates)(CFArrayRef*); #endif -#if defined(Q_OS_WIN) +#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) #if defined(Q_OS_WINCE) typedef HCERTSTORE (WINAPI *PtrCertOpenSystemStoreW)(LPCSTR, DWORD, HCRYPTPROV_LEGACY, DWORD, const void*); #else @@ -94,7 +96,7 @@ QT_BEGIN_NAMESPACE #endif typedef PCCERT_CONTEXT (WINAPI *PtrCertFindCertificateInStore)(HCERTSTORE, DWORD, DWORD, DWORD, const void*, PCCERT_CONTEXT); typedef BOOL (WINAPI *PtrCertCloseStore)(HCERTSTORE, DWORD); -#endif +#endif // Q_OS_WIN && !Q_OS_WINRT @@ -153,11 +155,11 @@ public: static PtrSecCertificateCopyData ptrSecCertificateCopyData; static PtrSecTrustSettingsCopyCertificates ptrSecTrustSettingsCopyCertificates; static PtrSecTrustCopyAnchorCertificates ptrSecTrustCopyAnchorCertificates; -#elif defined(Q_OS_WIN) +#elif defined(Q_OS_WIN) && !defined(Q_OS_WINRT) static PtrCertOpenSystemStoreW ptrCertOpenSystemStoreW; static PtrCertFindCertificateInStore ptrCertFindCertificateInStore; static PtrCertCloseStore ptrCertCloseStore; -#endif +#endif // Q_OS_WIN && !Q_OS_WINRT // The socket itself, including private slots. QTcpSocket *plainSocket; @@ -178,7 +180,7 @@ public: void _q_flushWriteBuffer(); void _q_flushReadBuffer(); void _q_resumeImplementation(); -#ifdef Q_OS_WIN +#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) virtual void _q_caRootLoaded(QSslCertificate,QSslCertificate) = 0; #endif diff --git a/src/network/ssl/qsslsocket_winrt.cpp b/src/network/ssl/qsslsocket_winrt.cpp new file mode 100644 index 0000000000..da4cf91f49 --- /dev/null +++ b/src/network/ssl/qsslsocket_winrt.cpp @@ -0,0 +1,204 @@ +/**************************************************************************** +** +** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/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 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.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 QSSLSOCKET_DEBUG +//#define QT_DECRYPT_SSL_TRAFFIC + +#include "qsslsocket_winrt_p.h" +#include "qsslsocket.h" +#include "qsslcertificate_p.h" + +QT_BEGIN_NAMESPACE + +bool QSslSocketPrivate::s_loadRootCertsOnDemand = false; + +QSslSocketBackendPrivate::QSslSocketBackendPrivate() +{ + ensureInitialized(); +} + +QSslSocketBackendPrivate::~QSslSocketBackendPrivate() +{ +} + +void QSslSocketPrivate::deinitialize() +{ + Q_UNIMPLEMENTED(); +} + +bool QSslSocketPrivate::supportsSsl() +{ + return true; +} + +bool QSslSocketPrivate::ensureLibraryLoaded() +{ + return true; +} + +void QSslSocketPrivate::ensureCiphersAndCertsLoaded() +{ + Q_UNIMPLEMENTED(); +} + +void QSslSocketPrivate::ensureInitialized() +{ +} + +long QSslSocketPrivate::sslLibraryVersionNumber() +{ + Q_UNIMPLEMENTED(); + return 0; +} + + +QString QSslSocketPrivate::sslLibraryVersionString() +{ + Q_UNIMPLEMENTED(); + return QString::number(sslLibraryVersionNumber()); +} + +long QSslSocketPrivate::sslLibraryBuildVersionNumber() +{ + Q_UNIMPLEMENTED(); + return 0; +} + +QString QSslSocketPrivate::sslLibraryBuildVersionString() +{ + Q_UNIMPLEMENTED(); + return QString::number(sslLibraryBuildVersionNumber()); +} + +void QSslSocketPrivate::resetDefaultCiphers() +{ + Q_UNIMPLEMENTED(); +} + +QList QSslSocketPrivate::systemCaCertificates() +{ + Q_UNIMPLEMENTED(); + ensureInitialized(); + QList systemCerts; + return systemCerts; +} + +void QSslSocketBackendPrivate::startClientEncryption() +{ + Q_UNIMPLEMENTED(); +} + +void QSslSocketBackendPrivate::startServerEncryption() +{ + Q_UNIMPLEMENTED(); +} + +void QSslSocketBackendPrivate::transmit() +{ + Q_UNIMPLEMENTED(); +} + +void QSslSocketBackendPrivate::disconnectFromHost() +{ + Q_UNIMPLEMENTED(); +} + +void QSslSocketBackendPrivate::disconnected() +{ + Q_UNIMPLEMENTED(); +} + +QSslCipher QSslSocketBackendPrivate::sessionCipher() const +{ + Q_UNIMPLEMENTED(); + return QSslCipher(); +} + +QSsl::SslProtocol QSslSocketBackendPrivate::sessionProtocol() const +{ + Q_UNIMPLEMENTED(); + return QSsl::UnknownProtocol; +} +void QSslSocketBackendPrivate::continueHandshake() +{ + Q_UNIMPLEMENTED(); +} + +QList QSslSocketBackendPrivate::verify(QList certificateChain, const QString &hostName) +{ + Q_UNIMPLEMENTED(); + Q_UNUSED(certificateChain) + Q_UNUSED(hostName) + QList errors; + + return errors; +} + +bool QSslSocketBackendPrivate::importPKCS12(QIODevice *device, + QSslKey *key, QSslCertificate *cert, + QList *caCertificates, + const QByteArray &passPhrase) +{ + Q_UNIMPLEMENTED(); + Q_UNUSED(device) + Q_UNUSED(key) + Q_UNUSED(cert) + Q_UNUSED(caCertificates) + Q_UNUSED(passPhrase) + return false; +} + +QT_END_NAMESPACE diff --git a/src/network/ssl/qsslsocket_winrt_p.h b/src/network/ssl/qsslsocket_winrt_p.h new file mode 100644 index 0000000000..791330a6fd --- /dev/null +++ b/src/network/ssl/qsslsocket_winrt_p.h @@ -0,0 +1,101 @@ +/**************************************************************************** +** +** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/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 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.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_OPENSSL_P_H +#define QSSLSOCKET_OPENSSL_P_H + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists for the convenience +// of the QLibrary class. This header file may change from +// version to version without notice, or even be removed. +// +// We mean it. +// + +#include "qsslsocket_p.h" + +QT_BEGIN_NAMESPACE + +class QSslSocketBackendPrivate : public QSslSocketPrivate +{ + Q_DECLARE_PUBLIC(QSslSocket) +public: + QSslSocketBackendPrivate(); + ~QSslSocketBackendPrivate(); + + // Platform specific functions + void startClientEncryption() Q_DECL_OVERRIDE; + void startServerEncryption() Q_DECL_OVERRIDE; + void transmit() Q_DECL_OVERRIDE; + void disconnectFromHost() Q_DECL_OVERRIDE; + void disconnected() Q_DECL_OVERRIDE; + QSslCipher sessionCipher() const Q_DECL_OVERRIDE; + QSsl::SslProtocol sessionProtocol() const Q_DECL_OVERRIDE; + void continueHandshake() Q_DECL_OVERRIDE; + + static QList verify(QList certificateChain, const QString &hostName); + static bool importPKCS12(QIODevice *device, + QSslKey *key, QSslCertificate *cert, + QList *caCertificates, + const QByteArray &passPhrase); +}; + +QT_END_NAMESPACE + +#endif diff --git a/src/network/ssl/ssl.pri b/src/network/ssl/ssl.pri index d7891b292a..0fbeb1d369 100644 --- a/src/network/ssl/ssl.pri +++ b/src/network/ssl/ssl.pri @@ -1,5 +1,5 @@ # OpenSSL support; compile in QSslSocket. -contains(QT_CONFIG, openssl) | contains(QT_CONFIG, openssl-linked) { +contains(QT_CONFIG, ssl) | contains(QT_CONFIG, openssl) | contains(QT_CONFIG, openssl-linked) { HEADERS += ssl/qssl.h \ ssl/qsslcertificate.h \ ssl/qsslcertificate_p.h \ @@ -11,25 +11,35 @@ contains(QT_CONFIG, openssl) | contains(QT_CONFIG, openssl-linked) { ssl/qsslkey.h \ ssl/qsslkey_p.h \ ssl/qsslsocket.h \ - ssl/qsslsocket_openssl_p.h \ - ssl/qsslsocket_openssl_symbols_p.h \ ssl/qsslsocket_p.h \ ssl/qsslcertificateextension.h \ - ssl/qsslcertificateextension_p.h \ - ssl/qsslcontext_openssl_p.h + ssl/qsslcertificateextension_p.h SOURCES += ssl/qssl.cpp \ ssl/qsslcertificate.cpp \ - ssl/qsslcertificate_openssl.cpp \ ssl/qsslconfiguration.cpp \ ssl/qsslcipher.cpp \ ssl/qsslkey_p.cpp \ ssl/qsslerror.cpp \ - ssl/qsslkey_openssl.cpp \ ssl/qsslsocket.cpp \ + ssl/qsslcertificateextension.cpp + + winrt { + HEADERS += ssl/qsslsocket_winrt_p.h + SOURCES += ssl/qsslcertificate_winrt.cpp \ + ssl/qsslkey_winrt.cpp \ + ssl/qsslsocket_winrt.cpp + } +} + +contains(QT_CONFIG, openssl) | contains(QT_CONFIG, openssl-linked) { + 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 \ + ssl/qsslkey_openssl.cpp \ ssl/qsslsocket_openssl.cpp \ - ssl/qsslsocket_openssl_symbols.cpp \ - ssl/qsslcertificateextension.cpp \ - ssl/qsslcontext_openssl.cpp + ssl/qsslsocket_openssl_symbols.cpp android:!android-no-sdk: SOURCES += ssl/qsslsocket_openssl_android.cpp diff --git a/tools/configure/configureapp.cpp b/tools/configure/configureapp.cpp index 63f85791a4..b959caa56e 100644 --- a/tools/configure/configureapp.cpp +++ b/tools/configure/configureapp.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). ** Copyright (C) 2013 Intel Corporation ** Contact: http://www.qt-project.org/legal ** @@ -274,6 +274,7 @@ Configure::Configure(int& argc, char** argv) dictionary[ "OPENGL" ] = "yes"; dictionary[ "OPENGL_ES_2" ] = "yes"; dictionary[ "OPENVG" ] = "no"; + dictionary[ "SSL" ] = "auto"; dictionary[ "OPENSSL" ] = "auto"; dictionary[ "DBUS" ] = "auto"; @@ -858,7 +859,11 @@ void Configure::parseCmdLine() else if (configCmdLine.at(i) == "-avx2") dictionary[ "AVX2" ] = "yes"; - else if (configCmdLine.at(i) == "-no-openssl") { + else if (configCmdLine.at(i) == "-no-ssl") { + dictionary[ "SSL"] = "no"; + } else if (configCmdLine.at(i) == "-ssl") { + dictionary[ "SSL" ] = "yes"; + } else if (configCmdLine.at(i) == "-no-openssl") { dictionary[ "OPENSSL"] = "no"; } else if (configCmdLine.at(i) == "-openssl") { dictionary[ "OPENSSL" ] = "yes"; @@ -1627,6 +1632,7 @@ void Configure::applySpecSpecifics() dictionary[ "OPENGL" ] = "yes"; dictionary[ "OPENGL_ES_2" ] = "yes"; dictionary[ "OPENVG" ] = "no"; + dictionary[ "SSL" ] = "yes"; dictionary[ "OPENSSL" ] = "no"; dictionary[ "DBUS" ] = "no"; dictionary[ "ZLIB" ] = "qt"; @@ -1643,6 +1649,7 @@ void Configure::applySpecSpecifics() dictionary[ "STYLE_WINDOWSCE" ] = "yes"; dictionary[ "STYLE_WINDOWSMOBILE" ] = "yes"; dictionary[ "OPENGL" ] = "no"; + dictionary[ "SSL" ] = "no"; dictionary[ "OPENSSL" ] = "no"; dictionary[ "RTTI" ] = "no"; dictionary[ "SSE2" ] = "no"; @@ -1958,6 +1965,8 @@ bool Configure::displayHelp() desc("AVX", "yes", "-avx", "Compile with use of AVX instructions."); desc("AVX2", "no", "-no-avx2", "Do not compile with use of AVX2 instructions."); desc("AVX2", "yes", "-avx2", "Compile with use of AVX2 instructions.\n"); + desc("SSL", "no", "-no-ssl", "Do not compile support for SSL."); + desc("SSL", "yes", "-ssl", "Enable run-time SSL support."); desc("OPENSSL", "no", "-no-openssl", "Do not compile support for OpenSSL."); desc("OPENSSL", "yes", "-openssl", "Enable run-time OpenSSL support."); desc("OPENSSL", "linked","-openssl-linked", "Enable linked OpenSSL support.\n"); @@ -2373,6 +2382,18 @@ void Configure::autoDetection() dictionary["AVX2"] = checkAvailability("AVX2") ? "yes" : "no"; if (dictionary["NEON"] == "auto") dictionary["NEON"] = checkAvailability("NEON") ? "yes" : "no"; + if (dictionary["SSL"] == "auto") { + if (platform() == WINDOWS_RT) { + dictionary["SSL"] = "yes"; + } else { + // On Desktop Windows openssl and ssl always have the same value (for now). OpenSSL is + // the only backend and if it is available and should be built, that also means that + // SSL support in general is enabled. + if (dictionary["OPENSSL"] == "auto") + dictionary["OPENSSL"] = checkAvailability("OPENSSL") ? "yes" : "no"; + dictionary["SSL"] = dictionary["OPENSSL"]; + } + } if (dictionary["OPENSSL"] == "auto") dictionary["OPENSSL"] = checkAvailability("OPENSSL") ? "yes" : "no"; if (dictionary["DBUS"] == "auto") @@ -2805,6 +2826,9 @@ void Configure::generateOutputVars() qtConfig += "egl"; } + if (dictionary[ "SSL" ] == "yes") + qtConfig += "ssl"; + if (dictionary[ "OPENSSL" ] == "yes") qtConfig += "openssl"; else if (dictionary[ "OPENSSL" ] == "linked") @@ -3515,10 +3539,8 @@ void Configure::generateConfigfiles() if (dictionary["GUI"] == "no") qconfigList += "QT_NO_GUI"; if (dictionary["OPENGL"] == "no") qconfigList += "QT_NO_OPENGL"; if (dictionary["OPENVG"] == "no") qconfigList += "QT_NO_OPENVG"; - if (dictionary["OPENSSL"] == "no") { - qconfigList += "QT_NO_OPENSSL"; - qconfigList += "QT_NO_SSL"; - } + if (dictionary["SSL"] == "no") qconfigList += "QT_NO_SSL"; + if (dictionary["OPENSSL"] == "no") qconfigList += "QT_NO_OPENSSL"; if (dictionary["OPENSSL"] == "linked") qconfigList += "QT_LINKED_OPENSSL"; if (dictionary["DBUS"] == "no") qconfigList += "QT_NO_DBUS"; if (dictionary["QML_DEBUG"] == "no") qconfigList += "QT_QML_NO_DEBUGGER"; @@ -3656,6 +3678,7 @@ void Configure::displayConfig() sout << "Glib support................" << dictionary[ "QT_GLIB" ] << endl; sout << "CUPS support................" << dictionary[ "QT_CUPS" ] << endl; sout << "OpenVG support.............." << dictionary[ "OPENVG" ] << endl; + sout << "SSL support................." << dictionary[ "SSL" ] << endl; sout << "OpenSSL support............." << dictionary[ "OPENSSL" ] << endl; sout << "Qt D-Bus support............" << dictionary[ "DBUS" ] << endl; sout << "Qt Widgets module support..." << dictionary[ "WIDGETS" ] << endl; -- cgit v1.2.3