summaryrefslogtreecommitdiffstats
path: root/tests/auto/network/ssl
diff options
context:
space:
mode:
authorMårten Nordheim <marten.nordheim@qt.io>2019-03-28 17:02:32 +0100
committerMårten Nordheim <marten.nordheim@qt.io>2021-04-08 12:42:26 +0100
commitd32b93afb3a13e26610c8773130ea89d58a18cf5 (patch)
tree262dbd13dff4089484f0a7a6151f163630cfdb5e /tests/auto/network/ssl
parent1999e2adc12a66488b241ff0e00c8716bd217c0a (diff)
tst_qsslkey: Clean up #if-ery
It was more complex than needed in a few places. Change-Id: I0609423f82420f72c65637cf398ccd7694ee85e5 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Diffstat (limited to 'tests/auto/network/ssl')
-rw-r--r--tests/auto/network/ssl/qsslkey/tst_qsslkey.cpp24
1 files changed, 12 insertions, 12 deletions
diff --git a/tests/auto/network/ssl/qsslkey/tst_qsslkey.cpp b/tests/auto/network/ssl/qsslkey/tst_qsslkey.cpp
index e5ce31440b..e86dcb83e8 100644
--- a/tests/auto/network/ssl/qsslkey/tst_qsslkey.cpp
+++ b/tests/auto/network/ssl/qsslkey/tst_qsslkey.cpp
@@ -42,7 +42,7 @@
#include <QtCore/qlist.h>
#ifdef QT_BUILD_INTERNAL
- #ifndef QT_NO_SSL
+ #if QT_CONFIG(ssl)
#include "private/qsslkey_p.h"
#define TEST_CRYPTO
#endif
@@ -79,7 +79,7 @@ public:
public slots:
void initTestCase();
-#ifndef QT_NO_SSL
+#if QT_CONFIG(ssl)
private slots:
void emptyConstructor();
@@ -107,7 +107,7 @@ private slots:
void encrypt();
#endif
-#endif
+#endif // ssl
private:
QString testDataDir;
@@ -182,7 +182,7 @@ void tst_QSslKey::initTestCase()
}
}
-#ifndef QT_NO_SSL
+#if QT_CONFIG(ssl)
static QByteArray readFile(const QString &absFilePath)
{
@@ -225,7 +225,7 @@ void tst_QSslKey::createPlainTestRows(bool pemOnly)
if (keyInfo.fileInfo.fileName().contains("RC2-64"))
continue; // Schannel treats RC2 as 128 bit
#endif
-#if !defined(QT_NO_SSL) && defined(QT_NO_OPENSSL) // generic backend
+#if QT_CONFIG(ssl) && defined(QT_NO_OPENSSL) // generic backend
if (keyInfo.fileInfo.fileName().contains(QRegularExpression("-aes\\d\\d\\d-")))
continue; // No AES support in the generic back-end
if (keyInfo.fileInfo.fileName().contains("pkcs8-pkcs12"))
@@ -331,7 +331,7 @@ void tst_QSslKey::constructorHandle()
#endif
}
-#endif
+#endif // !QT_NO_OPENSSL
void tst_QSslKey::copyAndAssign_data()
{
@@ -527,11 +527,11 @@ void tst_QSslKey::passphraseChecks_data()
QTest::newRow("DES") << QString(testDataDir + "rsa-with-passphrase-des.pem") << pass;
QTest::newRow("3DES") << QString(testDataDir + "rsa-with-passphrase-3des.pem") << pass;
QTest::newRow("RC2") << QString(testDataDir + "rsa-with-passphrase-rc2.pem") << pass;
-#if (!defined(QT_NO_OPENSSL) && !defined(OPENSSL_NO_AES)) || (defined(QT_NO_OPENSSL) && QT_CONFIG(ssl))
+#if defined(QT_NO_OPENSSL) || !defined(OPENSSL_NO_AES)
QTest::newRow("AES128") << QString(testDataDir + "rsa-with-passphrase-aes128.pem") << aesPass;
QTest::newRow("AES192") << QString(testDataDir + "rsa-with-passphrase-aes192.pem") << aesPass;
QTest::newRow("AES256") << QString(testDataDir + "rsa-with-passphrase-aes256.pem") << aesPass;
-#endif // (OpenSSL && AES) || generic backend
+#endif // Generic backend || OpenSSL built with AES
}
void tst_QSslKey::passphraseChecks()
@@ -713,7 +713,7 @@ void tst_QSslKey::encrypt_data()
<< QByteArray::fromHex("5AEC1A5B295660B02613454232F7DECE")
<< iv;
-#if (!defined(QT_NO_OPENSSL) && !defined(OPENSSL_NO_AES)) || (defined(QT_NO_OPENSSL) && QT_CONFIG(ssl))
+#if defined(QT_NO_OPENSSL) || !defined(OPENSSL_NO_AES)
// AES needs a longer IV
iv = QByteArray("abcdefghijklmnop");
QTest::newRow("AES-128-CBC, length 0")
@@ -748,7 +748,7 @@ void tst_QSslKey::encrypt_data()
<< QByteArray(8, 'a')
<< QByteArray::fromHex("879C8C25EC135CDF0B14490A0A7C2F67")
<< iv;
-#endif // (OpenSSL && AES) || generic backend
+#endif // Generic backend || OpenSSL built with AES
}
void tst_QSslKey::encrypt()
@@ -771,9 +771,9 @@ void tst_QSslKey::encrypt()
QByteArray decrypted = QSslKeyPrivate::decrypt(cipher, cipherText, key, iv);
QCOMPARE(decrypted, plainText);
}
-#endif
+#endif // TEST_CRYPTO
-#endif
+#endif // ssl
QTEST_MAIN(tst_QSslKey)
#include "tst_qsslkey.moc"