Improve code style.

This commit is contained in:
Felix Geyer 2012-04-18 22:08:22 +02:00
parent 4e5e5c71ca
commit 2e011d5362
29 changed files with 95 additions and 89 deletions

View file

@ -27,8 +27,7 @@
#endif #endif
#include <QtCore/QIODevice> #include <QtCore/QIODevice>
namespace Endian namespace Endian {
{
qint16 bytesToInt16(const QByteArray& ba, QSysInfo::Endian byteOrder) qint16 bytesToInt16(const QByteArray& ba, QSysInfo::Endian byteOrder)
{ {

View file

@ -23,8 +23,8 @@
class QIODevice; class QIODevice;
namespace Endian namespace Endian {
{
qint16 bytesToInt16(const QByteArray& ba, QSysInfo::Endian byteOrder); qint16 bytesToInt16(const QByteArray& ba, QSysInfo::Endian byteOrder);
quint16 bytesToUInt16(const QByteArray& ba, QSysInfo::Endian byteOrder); quint16 bytesToUInt16(const QByteArray& ba, QSysInfo::Endian byteOrder);
qint32 bytesToInt32(const QByteArray& ba, QSysInfo::Endian byteOrder); qint32 bytesToInt32(const QByteArray& ba, QSysInfo::Endian byteOrder);
@ -46,6 +46,7 @@ namespace Endian
bool writeInt16(qint16 num, QIODevice* device, QSysInfo::Endian byteOrder); bool writeInt16(qint16 num, QIODevice* device, QSysInfo::Endian byteOrder);
bool writeInt32(qint32 num, QIODevice* device, QSysInfo::Endian byteOrder); bool writeInt32(qint32 num, QIODevice* device, QSysInfo::Endian byteOrder);
bool writeInt64(qint64 num, QIODevice* device, QSysInfo::Endian byteOrder); bool writeInt64(qint64 num, QIODevice* device, QSysInfo::Endian byteOrder);
};
} // namespace Endian
#endif // KEEPASSX_ENDIAN_H #endif // KEEPASSX_ENDIAN_H

View file

@ -17,7 +17,8 @@
#include "EntryAttributes.h" #include "EntryAttributes.h"
const QStringList EntryAttributes::DEFAULT_ATTRIBUTES(QStringList() << "Title" << "URL" << "UserName" << "Password" << "Notes"); const QStringList EntryAttributes::DEFAULT_ATTRIBUTES(QStringList() << "Title" << "URL"
<< "UserName" << "Password" << "Notes");
EntryAttributes::EntryAttributes(QObject* parent) EntryAttributes::EntryAttributes(QObject* parent)
: QObject(parent) : QObject(parent)

View file

@ -38,7 +38,7 @@ public:
void clear(); void clear();
bool areCustomKeysDifferent(const EntryAttributes* other); bool areCustomKeysDifferent(const EntryAttributes* other);
const static QStringList DEFAULT_ATTRIBUTES; static const QStringList DEFAULT_ATTRIBUTES;
static bool isDefaultAttribute(const QString& key); static bool isDefaultAttribute(const QString& key);
Q_SIGNALS: Q_SIGNALS:
@ -51,7 +51,7 @@ Q_SIGNALS:
void removed(QString key); void removed(QString key);
void aboutToBeReset(); void aboutToBeReset();
void reset(); void reset();
private: private:
QMap<QString, QString> m_attributes; QMap<QString, QString> m_attributes;
QSet<QString> m_protectedAttributes; QSet<QString> m_protectedAttributes;

View file

@ -59,6 +59,7 @@ int TimeInfo::usageCount() const
{ {
return m_usageCount; return m_usageCount;
} }
QDateTime TimeInfo::locationChanged() const QDateTime TimeInfo::locationChanged() const
{ {
return m_locationChanged; return m_locationChanged;

View file

@ -15,8 +15,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#ifndef KEEPASSX_DBTIMEINFO_H #ifndef KEEPASSX_TIMEINFO_H
#define KEEPASSX_DBTIMEINFO_H #define KEEPASSX_TIMEINFO_H
#include <QtCore/QDateTime> #include <QtCore/QDateTime>
@ -51,4 +51,4 @@ private:
QDateTime m_locationChanged; QDateTime m_locationChanged;
}; };
#endif // KEEPASSX_DBTIMEINFO_H #endif // KEEPASSX_TIMEINFO_H

View file

@ -20,7 +20,9 @@
#include <QtCore/QLocale> #include <QtCore/QLocale>
#include <QtCore/QStringList> #include <QtCore/QStringList>
QString Tools::humanReadableFileSize(qint64 bytes) namespace Tools {
QString humanReadableFileSize(qint64 bytes)
{ {
double size = bytes; double size = bytes;
@ -35,3 +37,5 @@ QString Tools::humanReadableFileSize(qint64 bytes)
return QString("%1 %2").arg(QLocale().toString(size, 'f', 2), units.at(i)); return QString("%1 %2").arg(QLocale().toString(size, 'f', 2), units.at(i));
} }
} // namespace Tools

View file

@ -24,6 +24,6 @@ namespace Tools {
QString humanReadableFileSize(qint64 bytes); QString humanReadableFileSize(qint64 bytes);
} } // namespace Tools
#endif // KEEPASSX_TOOLS_H #endif // KEEPASSX_TOOLS_H

View file

@ -51,7 +51,7 @@ QByteArray Uuid::toByteArray() const
bool Uuid::isNull() const bool Uuid::isNull() const
{ {
for (int i=0; i<m_data.size(); ++i) { for (int i = 0; i < m_data.size(); ++i) {
if (m_data[i] != 0) { if (m_data[i] != 0) {
return false; return false;
} }

View file

@ -44,7 +44,7 @@ void SymmetricCipherSalsa20::init()
void SymmetricCipherSalsa20::setKey(const QByteArray& key) void SymmetricCipherSalsa20::setKey(const QByteArray& key)
{ {
Q_ASSERT( (key.size() == 16) || (key.size() == 32) ); Q_ASSERT((key.size() == 16) || (key.size() == 32));
m_key = key; m_key = key;
ECRYPT_keysetup(&m_ctx, reinterpret_cast<const u8*>(m_key.constData()), m_key.size()*8, 64); ECRYPT_keysetup(&m_ctx, reinterpret_cast<const u8*>(m_key.constData()), m_key.size()*8, 64);
@ -60,7 +60,7 @@ void SymmetricCipherSalsa20::setIv(const QByteArray& iv)
QByteArray SymmetricCipherSalsa20::process(const QByteArray& data) QByteArray SymmetricCipherSalsa20::process(const QByteArray& data)
{ {
Q_ASSERT( (data.size() < blockSize()) || ((data.size() % blockSize())==0) ); Q_ASSERT((data.size() < blockSize()) || ((data.size() % blockSize()) == 0));
QByteArray result; QByteArray result;
result.resize(data.size()); result.resize(data.size());
@ -73,7 +73,7 @@ QByteArray SymmetricCipherSalsa20::process(const QByteArray& data)
void SymmetricCipherSalsa20::processInPlace(QByteArray& data) void SymmetricCipherSalsa20::processInPlace(QByteArray& data)
{ {
Q_ASSERT( (data.size() < blockSize()) || ((data.size() % blockSize())==0) ); Q_ASSERT((data.size() < blockSize()) || ((data.size() % blockSize()) == 0));
ECRYPT_encrypt_bytes(&m_ctx, reinterpret_cast<const u8*>(data.constData()), ECRYPT_encrypt_bytes(&m_ctx, reinterpret_cast<const u8*>(data.constData()),
reinterpret_cast<u8*>(data.data()), data.size()); reinterpret_cast<u8*>(data.data()), data.size());

View file

@ -53,7 +53,7 @@ QByteArray KeePass2RandomStream::process(const QByteArray& data)
QByteArray result; QByteArray result;
result.resize(data.size()); result.resize(data.size());
for (int i=0; i<data.size(); i++) { for (int i = 0; i < data.size(); i++) {
result[i] = data[i] ^ randomData[i]; result[i] = data[i] ^ randomData[i];
} }
@ -64,7 +64,7 @@ void KeePass2RandomStream::processInPlace(QByteArray& data)
{ {
QByteArray randomData = randomBytes(data.size()); QByteArray randomData = randomBytes(data.size());
for (int i=0; i<data.size(); i++) { for (int i = 0; i < data.size(); i++) {
data[i] = data[i] ^ randomData[i]; data[i] = data[i] ^ randomData[i];
} }
} }

View file

@ -79,7 +79,8 @@ Database* KeePass2Reader::readDatabase(QIODevice* device, const CompositeKey& ke
hash.addData(m_db->transformedMasterKey()); hash.addData(m_db->transformedMasterKey());
QByteArray finalKey = hash.result(); QByteArray finalKey = hash.result();
SymmetricCipherStream cipherStream(device, SymmetricCipher::Aes256, SymmetricCipher::Cbc, SymmetricCipher::Decrypt, finalKey, m_encryptionIV); SymmetricCipherStream cipherStream(device, SymmetricCipher::Aes256, SymmetricCipher::Cbc,
SymmetricCipher::Decrypt, finalKey, m_encryptionIV);
cipherStream.open(QIODevice::ReadOnly); cipherStream.open(QIODevice::ReadOnly);
QByteArray realStart = cipherStream.read(32); QByteArray realStart = cipherStream.read(32);

View file

@ -62,17 +62,24 @@ void KeePass2Writer::writeDatabase(QIODevice* device, Database* db)
CHECK_RETURN(writeData(Endian::int32ToBytes(KeePass2::FILE_VERSION, KeePass2::BYTEORDER))); CHECK_RETURN(writeData(Endian::int32ToBytes(KeePass2::FILE_VERSION, KeePass2::BYTEORDER)));
CHECK_RETURN(writeHeaderField(KeePass2::CipherID, db->cipher().toByteArray())); CHECK_RETURN(writeHeaderField(KeePass2::CipherID, db->cipher().toByteArray()));
CHECK_RETURN(writeHeaderField(KeePass2::CompressionFlags, Endian::int32ToBytes(db->compressionAlgo(), KeePass2::BYTEORDER))); CHECK_RETURN(writeHeaderField(KeePass2::CompressionFlags,
Endian::int32ToBytes(db->compressionAlgo(),
KeePass2::BYTEORDER)));
CHECK_RETURN(writeHeaderField(KeePass2::MasterSeed, masterSeed)); CHECK_RETURN(writeHeaderField(KeePass2::MasterSeed, masterSeed));
CHECK_RETURN(writeHeaderField(KeePass2::TransformSeed, db->transformSeed())); CHECK_RETURN(writeHeaderField(KeePass2::TransformSeed, db->transformSeed()));
CHECK_RETURN(writeHeaderField(KeePass2::TransformRounds, Endian::int64ToBytes(db->transformRounds(), KeePass2::BYTEORDER))); CHECK_RETURN(writeHeaderField(KeePass2::TransformRounds,
Endian::int64ToBytes(db->transformRounds(),
KeePass2::BYTEORDER)));
CHECK_RETURN(writeHeaderField(KeePass2::EncryptionIV, encryptionIV)); CHECK_RETURN(writeHeaderField(KeePass2::EncryptionIV, encryptionIV));
CHECK_RETURN(writeHeaderField(KeePass2::ProtectedStreamKey, protectedStreamKey)); CHECK_RETURN(writeHeaderField(KeePass2::ProtectedStreamKey, protectedStreamKey));
CHECK_RETURN(writeHeaderField(KeePass2::StreamStartBytes, startBytes)); CHECK_RETURN(writeHeaderField(KeePass2::StreamStartBytes, startBytes));
CHECK_RETURN(writeHeaderField(KeePass2::InnerRandomStreamID, Endian::int32ToBytes(KeePass2::Salsa20, KeePass2::BYTEORDER))); CHECK_RETURN(writeHeaderField(KeePass2::InnerRandomStreamID,
Endian::int32ToBytes(KeePass2::Salsa20,
KeePass2::BYTEORDER)));
CHECK_RETURN(writeHeaderField(KeePass2::EndOfHeader, endOfHeader)); CHECK_RETURN(writeHeaderField(KeePass2::EndOfHeader, endOfHeader));
SymmetricCipherStream cipherStream(device, SymmetricCipher::Aes256, SymmetricCipher::Cbc, SymmetricCipher::Encrypt, finalKey, encryptionIV); SymmetricCipherStream cipherStream(device, SymmetricCipher::Aes256, SymmetricCipher::Cbc,
SymmetricCipher::Encrypt, finalKey, encryptionIV);
cipherStream.open(QIODevice::WriteOnly); cipherStream.open(QIODevice::WriteOnly);
m_device = &cipherStream; m_device = &cipherStream;
CHECK_RETURN(writeData(startBytes)); CHECK_RETURN(writeData(startBytes));

View file

@ -376,7 +376,6 @@ Group* KeePass2XmlReader::parseGroup()
else { else {
raiseError(3); raiseError(3);
} }
} }
else if (m_xml.name() == "EnableSearching") { else if (m_xml.name() == "EnableSearching") {
QString str = readString(); QString str = readString();
@ -733,7 +732,7 @@ QColor KeePass2XmlReader::readColor()
} }
QColor color; QColor color;
for (int i=0; i<= 2; i++) { for (int i = 0; i <= 2; i++) {
QString rgbPartStr = colorStr.mid(1 + 2*i, 2); QString rgbPartStr = colorStr.mid(1 + 2*i, 2);
bool ok; bool ok;
int rgbPart = rgbPartStr.toInt(&ok, 16); int rgbPart = rgbPartStr.toInt(&ok, 16);

View file

@ -65,7 +65,9 @@ void ChangeMasterKeyWidget::generateKey()
if (m_ui->passwordGroup->isChecked()) { if (m_ui->passwordGroup->isChecked()) {
if (m_ui->enterPasswordEdit->text() == m_ui->repeatPasswordEdit->text()) { if (m_ui->enterPasswordEdit->text() == m_ui->repeatPasswordEdit->text()) {
if (m_ui->enterPasswordEdit->text().isEmpty()) { if (m_ui->enterPasswordEdit->text().isEmpty()) {
if (QMessageBox::question(this, tr("Question"), tr("Do you really want to use an empty string as password?"), QMessageBox::Yes | QMessageBox::No) != QMessageBox::Yes) { if (QMessageBox::question(this, tr("Question"),
tr("Do you really want to use an empty string as password?"),
QMessageBox::Yes | QMessageBox::No) != QMessageBox::Yes) {
return; return;
} }
} }

View file

@ -15,8 +15,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#ifndef KEEPASSX_KEYOPENDIALOG_H #ifndef KEEPASSX_DATABASEOPENDIALOG_H
#define KEEPASSX_KEYOPENDIALOG_H #define KEEPASSX_DATABASEOPENDIALOG_H
#include <QtCore/QScopedPointer> #include <QtCore/QScopedPointer>
#include <QtGui/QDialog> #include <QtGui/QDialog>
@ -56,4 +56,4 @@ private:
Q_DISABLE_COPY(DatabaseOpenDialog) Q_DISABLE_COPY(DatabaseOpenDialog)
}; };
#endif // KEEPASSX_KEYOPENDIALOG_H #endif // KEEPASSX_DATABASEOPENDIALOG_H

View file

@ -159,7 +159,6 @@ void DatabaseWidget::updateMasterKey(bool accepted)
{ {
if (accepted) { if (accepted) {
m_db->setKey(m_changeMasterKeyWidget->newMasterKey()); m_db->setKey(m_changeMasterKeyWidget->newMasterKey());
} }
else if (!m_db->hasKey()) { else if (!m_db->hasKey()) {
Q_EMIT closeRequest(); Q_EMIT closeRequest();

View file

@ -26,7 +26,7 @@
class CategoryListViewDelegate : public QStyledItemDelegate class CategoryListViewDelegate : public QStyledItemDelegate
{ {
public: public:
CategoryListViewDelegate(QObject *parent) : QStyledItemDelegate(parent) {} explicit CategoryListViewDelegate(QObject *parent) : QStyledItemDelegate(parent) {}
QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const
{ {
@ -39,7 +39,7 @@ public:
class CategoryListWidget : public QListWidget class CategoryListWidget : public QListWidget
{ {
public: public:
CategoryListWidget(QWidget* parent = 0) : QListWidget(parent) explicit CategoryListWidget(QWidget* parent = 0) : QListWidget(parent)
{ {
setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Expanding); setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Expanding);
setItemDelegate(new CategoryListViewDelegate(this)); setItemDelegate(new CategoryListViewDelegate(this));

View file

@ -15,8 +15,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#ifndef KEEPASSX_GROUPDIALOG_H #ifndef KEEPASSX_EDITGROUPWIDGET_H
#define KEEPASSX_GROUPDIALOG_H #define KEEPASSX_EDITGROUPWIDGET_H
#include <QtCore/QScopedPointer> #include <QtCore/QScopedPointer>
#include <QtGui/QWidget> #include <QtGui/QWidget>
@ -51,4 +51,4 @@ private:
Q_DISABLE_COPY(EditGroupWidget) Q_DISABLE_COPY(EditGroupWidget)
}; };
#endif // KEEPASSX_GROUPDIALOG_H #endif // KEEPASSX_EDITGROUPWIDGET_H

View file

@ -65,7 +65,7 @@ void MainWindow::setMenuActionState(int index)
index = dbWidget->currentIndex(); index = dbWidget->currentIndex();
} }
switch(index) { switch (index) {
case 0: // view case 0: // view
m_ui->actionEntryNew->setEnabled(true); m_ui->actionEntryNew->setEnabled(true);
m_ui->actionGroupNew->setEnabled(true); m_ui->actionGroupNew->setEnabled(true);

View file

@ -17,11 +17,11 @@
#include "CompositeKey.h" #include "CompositeKey.h"
#include <QtCore/QtConcurrentRun>
#include "crypto/CryptoHash.h" #include "crypto/CryptoHash.h"
#include "crypto/SymmetricCipher.h" #include "crypto/SymmetricCipher.h"
#include <QtCore/QtConcurrentRun>
CompositeKey::CompositeKey() CompositeKey::CompositeKey()
{ {
} }
@ -90,7 +90,7 @@ QByteArray CompositeKey::transformKeyRaw(const QByteArray& key, const QByteArray
QByteArray result = key; QByteArray result = key;
for (int i=0; i<rounds; i++) { for (int i = 0; i < rounds; i++) {
cipher.processInPlace(result); cipher.processInPlace(result);
} }

View file

@ -34,39 +34,39 @@ bool FileKey::load(QIODevice* device)
return false; return false;
} }
if (device->size() == 0) { if (device->size() == 0) {
return false; return false;
} }
if (!device->reset()) { if (!device->reset()) {
return false; return false;
} }
if (loadXml(device)) { if (loadXml(device)) {
return true; return true;
} }
if (!device->reset()) { if (!device->reset()) {
return false; return false;
} }
if (loadBinary(device)) { if (loadBinary(device)) {
return true; return true;
} }
if (!device->reset()) { if (!device->reset()) {
return false; return false;
} }
if (loadHex(device)) { if (loadHex(device)) {
return true; return true;
} }
if (!device->reset()) { if (!device->reset()) {
return false; return false;
} }
if (loadHashed(device)) { if (loadHashed(device)) {
return true; return true;
} }
return false; return false;
} }
bool FileKey::load(const QString& fileName, QString* errorMsg) bool FileKey::load(const QString& fileName, QString* errorMsg)

View file

@ -35,17 +35,6 @@ int main(int argc, char **argv)
Crypto::init(); Crypto::init();
CompositeKey key;
PasswordKey password;
password.setPassword("a");
key.addKey(password);
//KeePass2Reader* xreader = new KeePass2Reader();
//Database* db = xreader->readDatabase(QString(KEEPASSX_TEST_DIR).append("/NewDatabase.kdbx"), key);
//KeePass2XmlReader* reader = new KeePass2XmlReader();
//Database* db = reader->readDatabase(QString(KEEPASSX_TEST_DIR).append("/NewDatabase.xml"));
MainWindow mainWindow; MainWindow mainWindow;
mainWindow.show(); mainWindow.show();

View file

@ -148,7 +148,7 @@ bool SymmetricCipherStream::writeBlock()
else if (m_buffer.size() != m_cipher->blockSize()) { else if (m_buffer.size() != m_cipher->blockSize()) {
// PKCS7 padding // PKCS7 padding
int padLen = m_cipher->blockSize() - m_buffer.size(); int padLen = m_cipher->blockSize() - m_buffer.size();
for (int i=m_buffer.size(); i<m_cipher->blockSize(); i++) { for (int i = m_buffer.size(); i < m_cipher->blockSize(); i++) {
m_buffer.append(static_cast<char>(padLen)); m_buffer.append(static_cast<char>(padLen));
} }
} }

View file

@ -52,7 +52,7 @@ void TestKeePass2RandomStream::test()
QByteArray cipherData; QByteArray cipherData;
cipherData.resize(SIZE); cipherData.resize(SIZE);
for (int i=0; i<SIZE; i++) { for (int i = 0; i < SIZE; i++) {
cipherData[i] = data[i] ^ cipherPad[i]; cipherData[i] = data[i] ^ cipherPad[i];
} }

View file

@ -110,8 +110,8 @@ void TestKeePass2XmlReader::testCustomIcons()
QCOMPARE(icon.width(), 16); QCOMPARE(icon.width(), 16);
QCOMPARE(icon.height(), 16); QCOMPARE(icon.height(), 16);
for (int x=0; x<16; x++) { for (int x = 0; x < 16; x++) {
for (int y=0; y<16; y++) { for (int y = 0; y < 16; y++) {
QRgb rgb = icon.pixel(x, y); QRgb rgb = icon.pixel(x, y);
QCOMPARE(qRed(rgb), 128); QCOMPARE(qRed(rgb), 128);
QCOMPARE(qGreen(rgb), 0); QCOMPARE(qGreen(rgb), 0);

View file

@ -31,4 +31,4 @@ private Q_SLOTS:
void testEntrySets(); void testEntrySets();
}; };
#endif #endif // KEEPASSX_TESTMODIFIED_H

View file

@ -41,14 +41,16 @@ void TestSymmetricCipher::testAes256CbcEncryption()
QByteArray cipherText = QByteArray::fromHex("f58c4c04d6e5f1ba779eabfb5f7bfbd6"); QByteArray cipherText = QByteArray::fromHex("f58c4c04d6e5f1ba779eabfb5f7bfbd6");
cipherText.append(QByteArray::fromHex("9cfc4e967edb808d679f777bc6702c7d")); cipherText.append(QByteArray::fromHex("9cfc4e967edb808d679f777bc6702c7d"));
SymmetricCipher cipher(SymmetricCipher::Aes256, SymmetricCipher::Cbc, SymmetricCipher::Encrypt, key, iv); SymmetricCipher cipher(SymmetricCipher::Aes256, SymmetricCipher::Cbc, SymmetricCipher::Encrypt,
key, iv);
QCOMPARE(cipher.blockSize(), 16); QCOMPARE(cipher.blockSize(), 16);
QCOMPARE(cipher.process(plainText), QCOMPARE(cipher.process(plainText),
cipherText); cipherText);
QBuffer buffer; QBuffer buffer;
SymmetricCipherStream stream(&buffer, SymmetricCipher::Aes256, SymmetricCipher::Cbc, SymmetricCipher::Encrypt, key, iv); SymmetricCipherStream stream(&buffer, SymmetricCipher::Aes256, SymmetricCipher::Cbc,
SymmetricCipher::Encrypt, key, iv);
buffer.open(QIODevice::WriteOnly); buffer.open(QIODevice::WriteOnly);
stream.open(QIODevice::WriteOnly); stream.open(QIODevice::WriteOnly);
@ -88,7 +90,8 @@ void TestSymmetricCipher::testAes256CbcDecryption()
plainText); plainText);
QBuffer buffer(&cipherText); QBuffer buffer(&cipherText);
SymmetricCipherStream stream(&buffer, SymmetricCipher::Aes256, SymmetricCipher::Cbc, SymmetricCipher::Decrypt, key, iv); SymmetricCipherStream stream(&buffer, SymmetricCipher::Aes256, SymmetricCipher::Cbc,
SymmetricCipher::Decrypt, key, iv);
buffer.open(QIODevice::ReadOnly); buffer.open(QIODevice::ReadOnly);
stream.open(QIODevice::ReadOnly); stream.open(QIODevice::ReadOnly);
@ -118,7 +121,7 @@ void TestSymmetricCipher::testSalsa20()
SymmetricCipher cipher(SymmetricCipher::Salsa20, SymmetricCipher::Stream, SymmetricCipher::Encrypt, key, iv); SymmetricCipher cipher(SymmetricCipher::Salsa20, SymmetricCipher::Stream, SymmetricCipher::Encrypt, key, iv);
QByteArray cipherTextA; QByteArray cipherTextA;
for (int i=0; i<8; i++) { for (int i = 0; i < 8; i++) {
cipherTextA.append(cipher.process(QByteArray(64, '\0'))); cipherTextA.append(cipher.process(QByteArray(64, '\0')));
} }
cipher.reset(); cipher.reset();

View file

@ -90,7 +90,7 @@ void TestGui::testEditEntry()
void TestGui::cleanupTestCase() void TestGui::cleanupTestCase()
{ {
delete m_mainWindow; delete m_mainWindow;
} }
KEEPASSX_QTEST_GUI_MAIN(TestGui) KEEPASSX_QTEST_GUI_MAIN(TestGui)