Skip to content

Commit

Permalink
Add accessors for the build-time version of openssl.
Browse files Browse the repository at this point in the history
Many bugs originate due to mismatches between the build-time and
run-time versions of openssl but they're hard to debug as we don't
provide access to the build-time info. This addresses that weakness.

[ChangeLog][QtNetwork][QSslSocket] Added accessors for the version
of openssl used at build-time. This will help when debugging
problems caused by a mismatch with the run-time version.

Change-Id: I6a4c21c8f16ab4c90cdf166f38c62fe37bf1f165
Reviewed-by: Peter Hartmann <[email protected]>
  • Loading branch information
richmoore authored and The Qt Project committed Mar 10, 2014
1 parent 233a2f3 commit 3683bc9
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 0 deletions.
26 changes: 26 additions & 0 deletions src/network/ssl/qsslsocket.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1679,6 +1679,32 @@ QString QSslSocket::sslLibraryVersionString()
return QSslSocketPrivate::sslLibraryVersionString();
}

/*!
\since 5.4
Returns the version number of the SSL library in use at compile
time. If no SSL support is available then this will return an
undefined value.
\sa sslLibraryVersionNumber()
*/
long QSslSocket::sslLibraryBuildVersionNumber()
{
return QSslSocketPrivate::sslLibraryBuildVersionNumber();
}

/*!
\since 5.4
Returns the version string of the SSL library in use at compile
time. If no SSL support is available then this will return an
empty value.
\sa sslLibraryVersionString()
*/
QString QSslSocket::sslLibraryBuildVersionString()
{
return QSslSocketPrivate::sslLibraryBuildVersionString();
}

/*!
Starts a delayed SSL handshake for a client connection. This
function can be called when the socket is in the \l ConnectedState
Expand Down
2 changes: 2 additions & 0 deletions src/network/ssl/qsslsocket.h
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,8 @@ class Q_NETWORK_EXPORT QSslSocket : public QTcpSocket
static bool supportsSsl();
static long sslLibraryVersionNumber();
static QString sslLibraryVersionString();
static long sslLibraryBuildVersionNumber();
static QString sslLibraryBuildVersionString();

void ignoreSslErrors(const QList<QSslError> &errors);

Expand Down
10 changes: 10 additions & 0 deletions src/network/ssl/qsslsocket_openssl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -584,6 +584,16 @@ QString QSslSocketPrivate::sslLibraryVersionString()
return QString::fromLatin1(versionString);
}

long QSslSocketPrivate::sslLibraryBuildVersionNumber()
{
return OPENSSL_VERSION_NUMBER;
}

QString QSslSocketPrivate::sslLibraryBuildVersionString()
{
return QLatin1String(OPENSSL_VERSION_TEXT);
}

/*!
\internal
Expand Down
2 changes: 2 additions & 0 deletions src/network/ssl/qsslsocket_p.h
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,8 @@ class QSslSocketPrivate : public QTcpSocketPrivate
static bool supportsSsl();
static long sslLibraryVersionNumber();
static QString sslLibraryVersionString();
static long sslLibraryBuildVersionNumber();
static QString sslLibraryBuildVersionString();
static void ensureInitialized();
static void deinitialize();
static QList<QSslCipher> defaultCiphers();
Expand Down

0 comments on commit 3683bc9

Please sign in to comment.