diff options
author | Timur Pocheptsov <timur.pocheptsov@qt.io> | 2021-01-25 11:28:48 +0100 |
---|---|---|
committer | Timur Pocheptsov <timur.pocheptsov@qt.io> | 2021-01-28 16:21:07 +0100 |
commit | 1a2dd9276759742a7eda704341ee618d296ad8bf (patch) | |
tree | d6d0b7f8cf473c2d682aeae12bc2bad0680ace0b /src/network/ssl/qsslsocket_schannel.cpp | |
parent | 795ea19ca0a7e484793655b35f19de8dbc88e987 (diff) |
TLS backend: merge with its factory
QTlsBackend is a factory itself - it creates TLS/X509 objects. Having
an intermediary between Factory->Backend->TLS primitive does not look
very natural thus let's squash the first two parts. Backend is a factory
creating TLS primitives, but its static functions also provide information
about backends availablei and give access to those backends.
Fixes: QTBUG-90606
Task-number: QTBUG-65922
Change-Id: I8409d81fd11fb46e6ab4465b4937a7680a8c2447
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
Reviewed-by: MÃ¥rten Nordheim <marten.nordheim@qt.io>
Diffstat (limited to 'src/network/ssl/qsslsocket_schannel.cpp')
-rw-r--r-- | src/network/ssl/qsslsocket_schannel.cpp | 22 |
1 files changed, 4 insertions, 18 deletions
diff --git a/src/network/ssl/qsslsocket_schannel.cpp b/src/network/ssl/qsslsocket_schannel.cpp index ca9bad96b6..d36b1790e1 100644 --- a/src/network/ssl/qsslsocket_schannel.cpp +++ b/src/network/ssl/qsslsocket_schannel.cpp @@ -46,6 +46,7 @@ #include "qsslcertificateextension.h" #include "qsslcertificate_p.h" #include "qsslcipher_p.h" +#include "qtlsbackend_p.h" #include <QtCore/qscopeguard.h> #include <QtCore/qoperatingsystemversion.h> @@ -163,21 +164,7 @@ class SchannelBackend : public QTlsBackend private: QString backendName() const override { - return QTlsBackendFactory::builtinBackendNames[QTlsBackendFactory::nameIndexSchannel]; - } -}; - -bool supportsTls13(); -class SchannelBackendFactory : public QTlsBackendFactory -{ -private: - QString backendName() const override - { - return QTlsBackendFactory::builtinBackendNames[QTlsBackendFactory::nameIndexSchannel]; - } - QTlsBackend *create() const override - { - return new SchannelBackend; + return builtinBackendNames[nameIndexSchannel]; } QList<QSsl::SslProtocol> supportedProtocols() const override @@ -223,8 +210,7 @@ private: } }; -Q_GLOBAL_STATIC(SchannelBackendFactory, factory); - +Q_GLOBAL_STATIC(SchannelBackend, backend) SecBuffer createSecBuffer(void *ptr, unsigned long length, unsigned long bufferType) { @@ -2217,7 +2203,7 @@ void QSslSocketPrivate::registerAdHocFactory() { // TLSTODO: this is a temporary solution, waiting for // backends to move to ... plugins. - if (!factory()) + if (!backend()) qCWarning(lcSsl, "Failed to create backend factory"); } |