summaryrefslogtreecommitdiffstats
path: root/src/network/ssl/qtlsbackend.cpp
diff options
context:
space:
mode:
authorTimur Pocheptsov <timur.pocheptsov@qt.io>2021-02-22 13:45:07 +0100
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2021-03-02 18:03:00 +0000
commit79138e41d6bf9ca60056a5c7fe0f35f3b67a9237 (patch)
tree9da7a367e4f0b6d5431d5bb342e6abeefe6b0048 /src/network/ssl/qtlsbackend.cpp
parent49bed939b61ce4e15d927e62d7341bc7258c9d33 (diff)
Move QSslCertificate's details and cert-related code to the plugins
Also since we have to properly support 'no-ssl' configure option (alas, we support QSslCertificate on such builds) - introduce a minimal crippled QTlsBackendCertOnly, which depends on X509CertificateGeneric. Fixes: QTBUG-90954 Task-number: QTBUG-65922 Change-Id: Ib9d62903f16b7c0eaaa23e319a822c24a7631dc6 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: MÃ¥rten Nordheim <marten.nordheim@qt.io> (cherry picked from commit 41fc143635c25f937a557f09890601f6c7d38736) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'src/network/ssl/qtlsbackend.cpp')
-rw-r--r--src/network/ssl/qtlsbackend.cpp43
1 files changed, 42 insertions, 1 deletions
diff --git a/src/network/ssl/qtlsbackend.cpp b/src/network/ssl/qtlsbackend.cpp
index 1df462e3627..dcffb0afd1f 100644
--- a/src/network/ssl/qtlsbackend.cpp
+++ b/src/network/ssl/qtlsbackend.cpp
@@ -38,7 +38,15 @@
****************************************************************************/
#include "qtlsbackend_p.h"
+
+#if QT_CONFIG(ssl)
#include "qsslsocket_p.h"
+#include "qsslkey_p.h"
+#include "qsslkey.h"
+#else
+#include "qtlsbackend_cert_p.h"
+#endif
+
#include "qssl_p.h"
#include <QtCore/private/qfactoryloader_p.h>
@@ -93,8 +101,13 @@ public:
while (loader->instance(index))
++index;
- // TLSTODO: obviously, this one should go away:
+ // TLSTODO: obviously, these two below should
+ // disappear as soon as plugins are in place.
+#if QT_CONFIG(ssl)
QSslSocketPrivate::registerAdHocFactory();
+#else
+ static QTlsBackendCertOnly certGenerator;
+#endif // QT_CONFIG(ssl)
return loaded = true;
}
@@ -180,6 +193,12 @@ QByteArray TlsKey::pemFooter() const
X509Certificate::~X509Certificate() = default;
+TlsKey *X509Certificate::publicKey() const
+{
+ // 'no-ssl' build has no key support either.
+ return nullptr;
+}
+
} // namespace QSsl
const QString QTlsBackend::builtinBackendNames[] = {
@@ -286,6 +305,9 @@ QString QTlsBackend::defaultBackendName()
if (names.contains(name))
return name;
+ if (names.size())
+ return names[0];
+
return {};
}
@@ -301,6 +323,15 @@ QTlsBackend *QTlsBackend::findBackend(const QString &backendName)
return nullptr;
}
+QTlsBackend *QTlsBackend::activeOrAnyBackend()
+{
+#if QT_CONFIG(ssl)
+ return QSslSocketPrivate::tlsBackendInUse();
+#else
+ return findBackend(defaultBackendName());
+#endif // QT_CONFIG(ssl)
+}
+
QList<QSsl::SslProtocol> QTlsBackend::supportedProtocols(const QString &backendName)
{
if (!backends())
@@ -334,4 +365,14 @@ QList<QSsl::ImplementedClass> QTlsBackend::implementedClasses(const QString &bac
return {};
}
+void QTlsBackend::resetBackend(QSslKey &key, QSsl::TlsKey *keyBackend)
+{
+#if QT_CONFIG(ssl)
+ key.d->keyBackend.reset(keyBackend);
+#else
+ Q_UNUSED(key);
+ Q_UNUSED(keyBackend);
+#endif // QT_CONFIG(ssl)
+}
+
QT_END_NAMESPACE