From 35117590c8f4634ddfdbe75966dd43adeca69369 Mon Sep 17 00:00:00 2001 From: Kai Pastor Date: Fri, 3 Jun 2016 07:33:55 +0200 Subject: Remove unneeded ';' after some macros The unneeded ';' triggered warnings in pedantic compilation mode. Change-Id: Id2324823e138560bb25234306601253d7bbd713e Reviewed-by: Richard J. Moore Reviewed-by: Friedemann Kleint Reviewed-by: Allan Sandfeld Jensen --- src/network/ssl/qsslsocket_mac_p.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/network/ssl') diff --git a/src/network/ssl/qsslsocket_mac_p.h b/src/network/ssl/qsslsocket_mac_p.h index 7a622db185..e8d9d34693 100644 --- a/src/network/ssl/qsslsocket_mac_p.h +++ b/src/network/ssl/qsslsocket_mac_p.h @@ -68,7 +68,7 @@ public: private: SSLContextRef context; - Q_DISABLE_COPY(QSecureTransportContext); + Q_DISABLE_COPY(QSecureTransportContext) }; class QSslSocketBackendPrivate : public QSslSocketPrivate @@ -115,7 +115,7 @@ private: QSecureTransportContext context; - Q_DISABLE_COPY(QSslSocketBackendPrivate); + Q_DISABLE_COPY(QSslSocketBackendPrivate) }; QT_END_NAMESPACE -- cgit v1.2.3 From a2ae631c04fee752e492f2c0b8fd25f06abffd6b Mon Sep 17 00:00:00 2001 From: Topi Reinio Date: Wed, 3 Aug 2016 12:00:41 +0200 Subject: Doc: Change instances of '(Mac) OS X' to 'macOS' As of version 10.12 (Sierra), the name of Apple's desktop operating system will be macOS. Change the occurrences where the Mac platform is discussed to use a macro \macos, which expands to 'macOS'. This helps with adapting to future renaming. Update the instructions on mac-specific Q_OS_* macro usage. Add a \target for the old 'Qt for OS X' topic to keep links working for other documentation modules that try to link with the old name. Change-Id: Id33fb0cd985df702a4ae4efb4c5fd428e77d9b85 Reviewed-by: Leena Miettinen --- src/network/ssl/qsslsocket.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/network/ssl') diff --git a/src/network/ssl/qsslsocket.cpp b/src/network/ssl/qsslsocket.cpp index c453606262..549906ac64 100644 --- a/src/network/ssl/qsslsocket.cpp +++ b/src/network/ssl/qsslsocket.cpp @@ -136,7 +136,7 @@ addDefaultCaCertificates(), and QSslConfiguration::defaultConfiguration().setCaCertificates(). \endlist - \note If available, root certificates on Unix (excluding OS X) will be + \note If available, root certificates on Unix (excluding \macos) will be loaded on demand from the standard certificate directories. If you do not want to load root certificates on demand, you need to call either QSslConfiguration::defaultConfiguration().setCaCertificates() before the first -- cgit v1.2.3 From 033ebfae211b5d6608f152f82beaca5cf445e0fc Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Sun, 7 Aug 2016 09:33:11 +0300 Subject: QSslDiffieHellmanParameters: make fit for release - add missing \since 5.8 on free functions - fix \relates of qHash to point to QSslDHP, not QHash, which is in another module - API fix: use named instead of unnamed ctors - share code between ctors - API fix: add inline move ctor (for now, this requires using a naked d pointer, which isn't much of a problem, since the class is immutable). Change-Id: Ic30f9c3c03b8a3798e0676e38991ead85c587214 Reviewed-by: Timur Pocheptsov --- src/network/ssl/qsslcontext_openssl.cpp | 2 +- src/network/ssl/qssldiffiehellmanparameters.cpp | 68 +++++++++++++++---------- src/network/ssl/qssldiffiehellmanparameters.h | 13 ++--- 3 files changed, 50 insertions(+), 33 deletions(-) (limited to 'src/network/ssl') diff --git a/src/network/ssl/qsslcontext_openssl.cpp b/src/network/ssl/qsslcontext_openssl.cpp index dec8e12abb..c92d8fc3f8 100644 --- a/src/network/ssl/qsslcontext_openssl.cpp +++ b/src/network/ssl/qsslcontext_openssl.cpp @@ -320,7 +320,7 @@ init_context: } if (!dhparams.isEmpty()) { - const QByteArray ¶ms = dhparams.d.data()->derData; + 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) diff --git a/src/network/ssl/qssldiffiehellmanparameters.cpp b/src/network/ssl/qssldiffiehellmanparameters.cpp index e6a2fe8a2a..d0fcb3189a 100644 --- a/src/network/ssl/qssldiffiehellmanparameters.cpp +++ b/src/network/ssl/qssldiffiehellmanparameters.cpp @@ -77,7 +77,7 @@ QT_BEGIN_NAMESPACE QSslDiffieHellmanParameters QSslDiffieHellmanParameters::defaultParameters() { // The 1024-bit MODP group from RFC 2459 (Second Oakley Group) - return QSslDiffieHellmanParameters( + return fromEncoded( QByteArray::fromBase64(QByteArrayLiteral( "MIGHAoGBAP//////////yQ/aoiFowjTExmKLgNwc0SkCTgiKZ8x0Agu+pjsTmyJR" "Sgh5jjQE3e+VGbPNOkMbMCsKbfJfFDdP4TVtbVHCReSFtXZiXn7G9ExC6aY37WsL" @@ -100,73 +100,82 @@ QSslDiffieHellmanParameters QSslDiffieHellmanParameters::defaultParameters() QSslDiffieHellmanParameters::QSslDiffieHellmanParameters() : d(new QSslDiffieHellmanParametersPrivate) { + d->ref.ref(); } /*! Constructs a QSslDiffieHellmanParameters object using the byte array \a encoded in either PEM or DER form as specified by \a encoding. - After construction, the isValid() method should be used to + Use the isValid() method on the returned object to check whether the Diffie-Hellman parameters were valid and loaded correctly. \sa isValid() \sa QSslConfiguration */ -QSslDiffieHellmanParameters::QSslDiffieHellmanParameters(const QByteArray &encoded, QSsl::EncodingFormat encoding) - : d(new QSslDiffieHellmanParametersPrivate) +QSslDiffieHellmanParameters QSslDiffieHellmanParameters::fromEncoded(const QByteArray &encoded, QSsl::EncodingFormat encoding) { + QSslDiffieHellmanParameters result; switch (encoding) { case QSsl::Der: - d->decodeDer(encoded); + result.d->decodeDer(encoded); break; case QSsl::Pem: - d->decodePem(encoded); + result.d->decodePem(encoded); break; } + return result; } /*! Constructs a QSslDiffieHellmanParameters object by - reading from \a device in either PEM or DER form. + reading from \a device in either PEM or DER form as specified by \a encoding. - After construction, the isValid() method should be used + Use the isValid() method on the returned object to check whether the Diffie-Hellman parameters were valid and loaded correctly. + In particular, if \a device is \c nullptr or not open for reading, an invalid + object will be returned. + \sa isValid() \sa QSslConfiguration */ -QSslDiffieHellmanParameters::QSslDiffieHellmanParameters(QIODevice *device, QSsl::EncodingFormat encoding) - : d(new QSslDiffieHellmanParametersPrivate) +QSslDiffieHellmanParameters QSslDiffieHellmanParameters::fromEncoded(QIODevice *device, QSsl::EncodingFormat encoding) { - if (!device) - return; - - const QByteArray encoded = device->readAll(); - - switch (encoding) { - case QSsl::Der: - d->decodeDer(encoded); - break; - case QSsl::Pem: - d->decodePem(encoded); - break; - } + if (device) + return fromEncoded(device->readAll(), encoding); + else + return QSslDiffieHellmanParameters(); } /*! Constructs an identical copy of \a other. */ -QSslDiffieHellmanParameters::QSslDiffieHellmanParameters(const QSslDiffieHellmanParameters &other) : d(other.d) +QSslDiffieHellmanParameters::QSslDiffieHellmanParameters(const QSslDiffieHellmanParameters &other) + : d(other.d) { + if (d) + d->ref.ref(); } +/*! + \fn QSslDiffieHellmanParameters(QSslDiffieHellmanParameters &&other) + + Move-constructs from \a other. + + \note The moved-from object \a other is placed in a partially-formed state, in which + the only valid operations are destruction and assignment of a new value. +*/ + /*! Destroys the QSslDiffieHellmanParameters object. */ QSslDiffieHellmanParameters::~QSslDiffieHellmanParameters() { + if (d && !d->ref.deref()) + delete d; } /*! @@ -177,7 +186,8 @@ QSslDiffieHellmanParameters::~QSslDiffieHellmanParameters() */ QSslDiffieHellmanParameters &QSslDiffieHellmanParameters::operator=(const QSslDiffieHellmanParameters &other) { - d = other.d; + QSslDiffieHellmanParameters copy(other); + swap(copy); return *this; } @@ -185,6 +195,9 @@ QSslDiffieHellmanParameters &QSslDiffieHellmanParameters::operator=(const QSslDi \fn QSslDiffieHellmanParameters &QSslDiffieHellmanParameters::operator=(QSslDiffieHellmanParameters &&other) Move-assigns \a other to this QSslDiffieHellmanParameters instance. + + \note The moved-from object \a other is placed in a partially-formed state, in which + the only valid operations are destruction and assignment of a new value. */ /*! @@ -265,6 +278,7 @@ QString QSslDiffieHellmanParameters::errorString() const Q_DECL_NOTHROW } /*! + \since 5.8 \relates QSslDiffieHellmanParameters Returns \c true if \a lhs is equal to \a rhs; otherwise returns \c false. @@ -276,6 +290,7 @@ bool operator==(const QSslDiffieHellmanParameters &lhs, const QSslDiffieHellmanP #ifndef QT_NO_DEBUG_STREAM /*! + \since 5.8 \relates QSslDiffieHellmanParameters Writes the set of Diffie-Hellman parameters in \a dhparam into the debug object \a debug for @@ -295,7 +310,8 @@ QDebug operator<<(QDebug debug, const QSslDiffieHellmanParameters &dhparam) #endif /*! - \relates QHash + \since 5.8 + \relates QSslDiffieHellmanParameters Returns an hash value for \a dhparam, using \a seed to seed the calculation. diff --git a/src/network/ssl/qssldiffiehellmanparameters.h b/src/network/ssl/qssldiffiehellmanparameters.h index aa40be83a6..4533ea4ed2 100644 --- a/src/network/ssl/qssldiffiehellmanparameters.h +++ b/src/network/ssl/qssldiffiehellmanparameters.h @@ -82,24 +82,25 @@ public: Q_NETWORK_EXPORT static QSslDiffieHellmanParameters defaultParameters(); Q_NETWORK_EXPORT QSslDiffieHellmanParameters(); - Q_NETWORK_EXPORT explicit QSslDiffieHellmanParameters(const QByteArray &encoded, QSsl::EncodingFormat format = QSsl::Pem); - Q_NETWORK_EXPORT explicit QSslDiffieHellmanParameters(QIODevice *device, QSsl::EncodingFormat format = QSsl::Pem); Q_NETWORK_EXPORT QSslDiffieHellmanParameters(const QSslDiffieHellmanParameters &other); + QSslDiffieHellmanParameters(QSslDiffieHellmanParameters &&other) Q_DECL_NOTHROW : d(other.d) { other.d = nullptr; } Q_NETWORK_EXPORT ~QSslDiffieHellmanParameters(); + Q_NETWORK_EXPORT QSslDiffieHellmanParameters &operator=(const QSslDiffieHellmanParameters &other); -#ifdef Q_COMPILER_RVALUE_REFS QSslDiffieHellmanParameters &operator=(QSslDiffieHellmanParameters &&other) Q_DECL_NOTHROW { swap(other); return *this; } -#endif void swap(QSslDiffieHellmanParameters &other) Q_DECL_NOTHROW { qSwap(d, other.d); } + Q_NETWORK_EXPORT static QSslDiffieHellmanParameters fromEncoded(const QByteArray &encoded, QSsl::EncodingFormat format = QSsl::Pem); + Q_NETWORK_EXPORT static QSslDiffieHellmanParameters fromEncoded(QIODevice *device, QSsl::EncodingFormat format = QSsl::Pem); + Q_NETWORK_EXPORT bool isEmpty() const Q_DECL_NOTHROW; Q_NETWORK_EXPORT bool isValid() const Q_DECL_NOTHROW; - Q_NETWORK_EXPORT QSslDiffieHellmanParameters::Error error() const Q_DECL_NOTHROW; + Q_NETWORK_EXPORT Error error() const Q_DECL_NOTHROW; Q_NETWORK_EXPORT QString errorString() const Q_DECL_NOTHROW; private: - QExplicitlySharedDataPointer d; + QSslDiffieHellmanParametersPrivate *d; friend class QSslContext; friend Q_NETWORK_EXPORT bool operator==(const QSslDiffieHellmanParameters &lhs, const QSslDiffieHellmanParameters &rhs) Q_DECL_NOTHROW; #ifndef QT_NO_DEBUG_STREAM -- cgit v1.2.3 From 60985aa42b37217fb4c01ed85bbf6f14410c3491 Mon Sep 17 00:00:00 2001 From: Lars Knoll Date: Fri, 5 Aug 2016 13:35:39 +0200 Subject: Use qtConfig throughout in qtbase Use the new qtConfig macro in all pro/pri files. This required adding some feature entries, and adding {private,public}Feature to every referenced already existing entry. Change-Id: I164214dad1154df6ad84e86d99ed14994ef97cf4 Reviewed-by: Lars Knoll Reviewed-by: Oswald Buddenhagen --- src/network/ssl/ssl.pri | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/network/ssl') diff --git a/src/network/ssl/ssl.pri b/src/network/ssl/ssl.pri index edbbeadf51..8139af50af 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, ssl) { +qtConfig(ssl) { HEADERS += ssl/qasn1element_p.h \ ssl/qssl.h \ ssl/qssl_p.h \ @@ -45,7 +45,7 @@ contains(QT_CONFIG, ssl) { ssl/qsslellipticcurve_dummy.cpp } - contains(QT_CONFIG, securetransport) { + qtConfig(securetransport) { HEADERS += ssl/qsslsocket_mac_p.h SOURCES += ssl/qsslcertificate_qt.cpp \ ssl/qssldiffiehellmanparameters_dummy.cpp \ @@ -56,7 +56,7 @@ contains(QT_CONFIG, ssl) { ssl/qsslellipticcurve_dummy.cpp } - contains(QT_CONFIG, openssl) | contains(QT_CONFIG, openssl-linked) { + qtConfig(openssl)|qtConfig(openssl-linked) { HEADERS += ssl/qsslcontext_openssl_p.h \ ssl/qsslsocket_openssl_p.h \ ssl/qsslsocket_openssl_symbols_p.h -- cgit v1.2.3 From 57378a108ca488cbf5cfaa32590fc762dcbf3315 Mon Sep 17 00:00:00 2001 From: Jake Petroules Date: Thu, 19 May 2016 23:01:59 -0700 Subject: Add support for Apple watchOS MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I3f9e00569458a463af2eaa5a3a16a6afd1e9c1ea Reviewed-by: Tor Arne Vestbø --- src/network/ssl/qsslsocket_mac.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/network/ssl') diff --git a/src/network/ssl/qsslsocket_mac.cpp b/src/network/ssl/qsslsocket_mac.cpp index 438ea9a38e..4c06404415 100644 --- a/src/network/ssl/qsslsocket_mac.cpp +++ b/src/network/ssl/qsslsocket_mac.cpp @@ -204,7 +204,7 @@ bool QSslSocketPrivate::s_loadedCiphersAndCerts = false; bool QSslSocketPrivate::s_loadRootCertsOnDemand = false; -#if !defined(QT_PLATFORM_UIKIT) // dhparam is not used on iOS or tvOS. (see the SSLSetDiffieHellmanParams call below) +#if !defined(QT_PLATFORM_UIKIT) // dhparam is only used on macOS. (see the SSLSetDiffieHellmanParams call below) static const uint8_t dhparam[] = "\x30\x82\x01\x08\x02\x82\x01\x01\x00\x97\xea\xd0\x46\xf7\xae\xa7\x76\x80" "\x9c\x74\x56\x98\xd8\x56\x97\x2b\x20\x6c\x77\xe2\x82\xbb\xc8\x84\xbe\xe7" @@ -223,7 +223,7 @@ static const uint8_t dhparam[] = "\x90\x0b\x35\x64\xff\xd9\xe3\xac\xf2\xf2\xeb\x3a\x63\x02\x01\x02"; #endif -// No ioErr on iOS/tvOS. (defined in MacErrors.h on OS X) +// No ioErr on iOS/tvOS/watchOS. (defined in MacErrors.h on macOS) #if defined(QT_PLATFORM_UIKIT) # define ioErr -36 #endif -- cgit v1.2.3