Fix test compilation errors

* Use legacy AES-KDF mode for KeePass1Reader
This commit is contained in:
Janek Bevendorff 2018-01-13 02:47:02 +01:00 committed by Jonathan White
parent 824607080a
commit 90380adc90
No known key found for this signature in database
GPG Key ID: 440FC65F2E0C6E01
3 changed files with 8 additions and 9 deletions

View File

@ -30,7 +30,6 @@
#include "core/Tools.h"
#include "crypto/CryptoHash.h"
#include "format/KeePass1.h"
#include "keys/CompositeKey.h"
#include "keys/FileKey.h"
#include "keys/PasswordKey.h"
#include "streams/SymmetricCipherStream.h"
@ -94,13 +93,13 @@ Database* KeePass1Reader::readDatabase(QIODevice* device, const QString& passwor
bool ok;
quint32 signature1 = Endian::readSizedInt<quint32>(m_device, KeePass1::BYTEORDER, &ok);
auto signature1 = Endian::readSizedInt<quint32>(m_device, KeePass1::BYTEORDER, &ok);
if (!ok || signature1 != KeePass1::SIGNATURE_1) {
raiseError(tr("Not a KeePass database."));
return nullptr;
}
quint32 signature2 = Endian::readSizedInt<quint32>(m_device, KeePass1::BYTEORDER, &ok);
auto signature2 = Endian::readSizedInt<quint32>(m_device, KeePass1::BYTEORDER, &ok);
if (!ok || signature2 != KeePass1::SIGNATURE_2) {
raiseError(tr("Not a KeePass database."));
return nullptr;
@ -112,7 +111,7 @@ Database* KeePass1Reader::readDatabase(QIODevice* device, const QString& passwor
return nullptr;
}
quint32 version = Endian::readSizedInt<quint32>(m_device, KeePass1::BYTEORDER, &ok);
auto version = Endian::readSizedInt<quint32>(m_device, KeePass1::BYTEORDER, &ok);
if (!ok || (version & KeePass1::FILE_VERSION_CRITICAL_MASK)
!= (KeePass1::FILE_VERSION & KeePass1::FILE_VERSION_CRITICAL_MASK)) {
raiseError(tr("Unsupported KeePass database version."));
@ -131,13 +130,13 @@ Database* KeePass1Reader::readDatabase(QIODevice* device, const QString& passwor
return nullptr;
}
quint32 numGroups = Endian::readSizedInt<quint32>(m_device, KeePass1::BYTEORDER, &ok);
auto numGroups = Endian::readSizedInt<quint32>(m_device, KeePass1::BYTEORDER, &ok);
if (!ok) {
raiseError("Invalid number of groups");
return nullptr;
}
quint32 numEntries = Endian::readSizedInt<quint32>(m_device, KeePass1::BYTEORDER, &ok);
auto numEntries = Endian::readSizedInt<quint32>(m_device, KeePass1::BYTEORDER, &ok);
if (!ok) {
raiseError("Invalid number of entries");
return nullptr;
@ -160,7 +159,7 @@ Database* KeePass1Reader::readDatabase(QIODevice* device, const QString& passwor
raiseError("Invalid number of transform rounds");
return nullptr;
}
auto kdf = QSharedPointer<AesKdf>::create();
auto kdf = QSharedPointer<AesKdf>::create(true);
kdf->setRounds(m_transformRounds);
kdf->setSeed(m_transformSeed);
db->setKdf(kdf);

View File

@ -110,7 +110,7 @@ void TestKeePass1Reader::testBasic()
void TestKeePass1Reader::testMasterKey()
{
QVERIFY(m_db->hasKey());
QCOMPARE(m_db->kdf()->rounds(), static_cast<quint64>(713));
QCOMPARE(m_db->kdf()->rounds(), 713);
}
void TestKeePass1Reader::testCustomIcons()

View File

@ -911,7 +911,7 @@ void TestGui::testDatabaseSettings()
QTest::keyClick(transformRoundsSpinBox, Qt::Key_Enter);
// wait for modified timer
QTRY_COMPARE(m_tabWidget->tabText(m_tabWidget->currentIndex()), QString("Save*"));
QCOMPARE(m_db->kdf()->rounds(), Q_UINT64_C(123456));
QCOMPARE(m_db->kdf()->rounds(), 123456);
triggerAction("actionDatabaseSave");
QCOMPARE(m_tabWidget->tabText(m_tabWidget->currentIndex()), QString("Save"));