diff options
author | Friedemann Kleint <Friedemann.Kleint@theqtcompany.com> | 2015-02-19 14:19:18 +0100 |
---|---|---|
committer | Friedemann Kleint <Friedemann.Kleint@theqtcompany.com> | 2015-02-25 14:06:12 +0000 |
commit | 7106ffb0394c4919da57716a2f877e8ccb3f19f6 (patch) | |
tree | 961a762e106a0dfa642995a36fe8f8cbf36bc4db | |
parent | 9d4641f56e76a21385db58f821ac929567d97a8c (diff) |
QSslSocket: Factor out error message about failure to set the elliptic curves.
Change-Id: Ic5305216536ee3938c389336c979b5c90fc886e4
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
-rw-r--r-- | src/network/ssl/qsslcontext_openssl.cpp | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/network/ssl/qsslcontext_openssl.cpp b/src/network/ssl/qsslcontext_openssl.cpp index f30f77d206..a7295933b5 100644 --- a/src/network/ssl/qsslcontext_openssl.cpp +++ b/src/network/ssl/qsslcontext_openssl.cpp @@ -86,6 +86,11 @@ 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); +} + QSslContext* QSslContext::fromConfiguration(QSslSocket::SslMode mode, const QSslConfiguration &configuration, bool allowRootCertOnDemandLoading) { QSslContext *sslContext = new QSslContext(); @@ -342,7 +347,7 @@ init_context: SSL_CTRL_SET_CURVES, qcurves.size(), const_cast<int *>(reinterpret_cast<const int *>(qcurves.data())))) { - sslContext->errorStr = QSslSocket::tr("Error when setting the elliptic curves (%1)").arg(QSslSocketBackendPrivate::getErrorsFromOpenSsl()); + sslContext->errorStr = msgErrorSettingEllipticCurves(QSslSocketBackendPrivate::getErrorsFromOpenSsl()); sslContext->errorCode = QSslError::UnspecifiedError; return sslContext; } @@ -350,7 +355,7 @@ init_context: #endif // OPENSSL_VERSION_NUMBER >= 0x10002000L && !defined(OPENSSL_NO_EC) { // specific curves requested, but not possible to set -> error - sslContext->errorStr = QSslSocket::tr("Error when setting the elliptic curves (OpenSSL version too old, need at least v1.0.2)"); + sslContext->errorStr = msgErrorSettingEllipticCurves(QSslSocket::tr("OpenSSL version too old, need at least v1.0.2")); sslContext->errorCode = QSslError::UnspecifiedError; return sslContext; } |