mirror of
https://github.com/mumble-voip/mumble.git
synced 2025-10-26 11:19:16 +00:00
src/tests: update tests to initialize and destroy the MumbleSSL module to ensure OpenSSL is properly initialized.
This commit is contained in:
parent
72e0a78272
commit
6892c8b29a
@ -9,12 +9,15 @@
|
||||
#include <QtCore>
|
||||
#include <QtTest>
|
||||
|
||||
#include "SSL.h"
|
||||
#include "Timer.h"
|
||||
#include "CryptState.h"
|
||||
|
||||
class TestCrypt : public QObject {
|
||||
Q_OBJECT
|
||||
private slots:
|
||||
void initTestCase();
|
||||
void cleanupTestCase();
|
||||
void testvectors();
|
||||
void authcrypt();
|
||||
void ivrecovery();
|
||||
@ -22,6 +25,14 @@ class TestCrypt : public QObject {
|
||||
void tamper();
|
||||
};
|
||||
|
||||
void TestCrypt::initTestCase() {
|
||||
MumbleSSL::initialize();
|
||||
}
|
||||
|
||||
void TestCrypt::cleanupTestCase() {
|
||||
MumbleSSL::destroy();
|
||||
}
|
||||
|
||||
void TestCrypt::reverserecovery() {
|
||||
CryptState enc, dec;
|
||||
enc.genKey();
|
||||
|
||||
@ -8,5 +8,5 @@ include(../test.pri)
|
||||
QT *= network
|
||||
|
||||
TARGET = TestCrypt
|
||||
HEADERS = Timer.h CryptState.h
|
||||
SOURCES = TestCrypt.cpp CryptState.cpp Timer.cpp
|
||||
HEADERS = SSL.h SSLLocks.h Timer.h CryptState.h
|
||||
SOURCES = SSL.cpp SSLLocks.cpp TestCrypt.cpp CryptState.cpp Timer.cpp
|
||||
|
||||
@ -7,11 +7,16 @@
|
||||
#include <QtTest>
|
||||
#include <QLatin1String>
|
||||
|
||||
#include "SSL.h"
|
||||
|
||||
#include "CryptographicHash.h"
|
||||
|
||||
class TestCryptographicHash : public QObject {
|
||||
Q_OBJECT
|
||||
private slots:
|
||||
void initTestCase();
|
||||
void cleanupTestCase();
|
||||
|
||||
void sha1_data();
|
||||
void sha1();
|
||||
|
||||
@ -23,6 +28,14 @@ class TestCryptographicHash : public QObject {
|
||||
void addDataAfterResult();
|
||||
};
|
||||
|
||||
void TestCryptographicHash::initTestCase() {
|
||||
MumbleSSL::initialize();
|
||||
}
|
||||
|
||||
void TestCryptographicHash::cleanupTestCase() {
|
||||
MumbleSSL::destroy();
|
||||
}
|
||||
|
||||
/// normalizeHash removes all whitespace from the hex-encoded hash string.
|
||||
static QString normalizeHash(QString str) {
|
||||
str.replace(QLatin1String(" "), QLatin1String(""));
|
||||
|
||||
@ -5,6 +5,8 @@
|
||||
|
||||
include(../test.pri)
|
||||
|
||||
QT += network
|
||||
|
||||
TARGET = TestCryptographicHash
|
||||
SOURCES = TestCryptographicHash.cpp CryptographicHash.cpp
|
||||
HEADERS = CryptographicHash.h
|
||||
SOURCES = SSL.cpp SSLLocks.cpp TestCryptographicHash.cpp CryptographicHash.cpp
|
||||
HEADERS = SSL.h SSLLocks.h CryptographicHash.h
|
||||
|
||||
@ -6,6 +6,8 @@
|
||||
#include <QtCore>
|
||||
#include <QtTest>
|
||||
|
||||
#include "SSL.h"
|
||||
|
||||
#include "CryptographicRandom.h"
|
||||
|
||||
#include <stdint.h>
|
||||
@ -15,11 +17,21 @@
|
||||
class TestCryptographicRandom : public QObject {
|
||||
Q_OBJECT
|
||||
private slots:
|
||||
void initTestCase();
|
||||
void cleanupTestCase();
|
||||
void fillBuffer();
|
||||
void uint32();
|
||||
void uniform();
|
||||
};
|
||||
|
||||
void TestCryptographicRandom::initTestCase() {
|
||||
MumbleSSL::initialize();
|
||||
}
|
||||
|
||||
void TestCryptographicRandom::cleanupTestCase() {
|
||||
MumbleSSL::destroy();
|
||||
}
|
||||
|
||||
// Verify the entropy of the data returned by the random source
|
||||
// by zlib compressing it and ensuring the compressed size is at
|
||||
// least 99% of the size of the input data.
|
||||
|
||||
@ -5,9 +5,11 @@
|
||||
|
||||
include(../test.pri)
|
||||
|
||||
QT += network
|
||||
|
||||
TARGET = TestCryptographicRandom
|
||||
SOURCES = TestCryptographicRandom.cpp CryptographicRandom.cpp arc4random_uniform.cpp
|
||||
HEADERS = CryptographicHash.h
|
||||
SOURCES = SSL.cpp SSLLocks.cpp TestCryptographicRandom.cpp CryptographicRandom.cpp arc4random_uniform.cpp
|
||||
HEADERS = SSL.h SSLLocks.h CryptographicHash.h
|
||||
|
||||
VPATH *= ../../../3rdparty/arc4random-src
|
||||
INCLUDEPATH *= ../../../3rdparty/arc4random-src
|
||||
|
||||
@ -6,6 +6,8 @@
|
||||
#include <QtCore>
|
||||
#include <QtTest>
|
||||
|
||||
#include "SSL.h"
|
||||
|
||||
#include "PasswordGenerator.h"
|
||||
|
||||
// Get the password alphabet from PasswordGenerator.
|
||||
@ -14,9 +16,19 @@ extern QVector<QChar> mumble_password_generator_alphabet();
|
||||
class TestPasswordGenerator : public QObject {
|
||||
Q_OBJECT
|
||||
private slots:
|
||||
void initTestCase();
|
||||
void cleanupTestCase();
|
||||
void random();
|
||||
};
|
||||
|
||||
void TestPasswordGenerator::initTestCase() {
|
||||
MumbleSSL::initialize();
|
||||
}
|
||||
|
||||
void TestPasswordGenerator::cleanupTestCase() {
|
||||
MumbleSSL::destroy();
|
||||
}
|
||||
|
||||
void TestPasswordGenerator::random() {
|
||||
QVector<QChar> alphabet = mumble_password_generator_alphabet();
|
||||
for (int i = 0; i < 100; i++) {
|
||||
|
||||
@ -5,9 +5,11 @@
|
||||
|
||||
include(../test.pri)
|
||||
|
||||
QT += network
|
||||
|
||||
TARGET = TestPasswordGenerator
|
||||
SOURCES = TestPasswordGenerator.cpp PasswordGenerator.cpp CryptographicRandom.cpp arc4random_uniform.cpp
|
||||
HEADERS = PasswordGenerator.h CryptographicHash.h
|
||||
SOURCES = SSL.cpp SSLLocks.cpp TestPasswordGenerator.cpp PasswordGenerator.cpp CryptographicRandom.cpp arc4random_uniform.cpp
|
||||
HEADERS = SSL.h SSLLocks.h PasswordGenerator.h CryptographicHash.h
|
||||
|
||||
VPATH *= ../../../3rdparty/arc4random-src
|
||||
INCLUDEPATH *= ../../../3rdparty/arc4random-src
|
||||
|
||||
@ -6,15 +6,27 @@
|
||||
#include <QtCore>
|
||||
#include <QtTest>
|
||||
|
||||
#include "SSL.h"
|
||||
|
||||
#include "SelfSignedCertificate.h"
|
||||
|
||||
class TestSelfSignedCertificate : public QObject {
|
||||
Q_OBJECT
|
||||
private slots:
|
||||
void initTestCase();
|
||||
void cleanupTestCase();
|
||||
void exerciseClientCert();
|
||||
void exerciseServerCert();
|
||||
};
|
||||
|
||||
void TestSelfSignedCertificate::initTestCase() {
|
||||
MumbleSSL::initialize();
|
||||
}
|
||||
|
||||
void TestSelfSignedCertificate::cleanupTestCase() {
|
||||
MumbleSSL::destroy();
|
||||
}
|
||||
|
||||
void TestSelfSignedCertificate::exerciseClientCert() {
|
||||
QSslCertificate cert;
|
||||
QSslKey key;
|
||||
|
||||
@ -9,5 +9,5 @@ include(../../../qmake/qt.pri)
|
||||
QT *= network
|
||||
|
||||
TARGET = TestSelfSignedCertificate
|
||||
SOURCES = TestSelfSignedCertificate.cpp SelfSignedCertificate.cpp
|
||||
HEADERS = SelfSignedCertificate.h
|
||||
SOURCES = SSL.cpp SSLLocks.cpp TestSelfSignedCertificate.cpp SelfSignedCertificate.cpp
|
||||
HEADERS = SSL.h SSLLocks.h SelfSignedCertificate.h
|
||||
|
||||
Loading…
Reference in New Issue
Block a user