summarylogtreecommitdiffstats
path: root/0003-Use-the-correct-cipher-for-benchmark.patch
diff options
context:
space:
mode:
Diffstat (limited to '0003-Use-the-correct-cipher-for-benchmark.patch')
-rw-r--r--0003-Use-the-correct-cipher-for-benchmark.patch132
1 files changed, 0 insertions, 132 deletions
diff --git a/0003-Use-the-correct-cipher-for-benchmark.patch b/0003-Use-the-correct-cipher-for-benchmark.patch
deleted file mode 100644
index ea306e230cfb..000000000000
--- a/0003-Use-the-correct-cipher-for-benchmark.patch
+++ /dev/null
@@ -1,132 +0,0 @@
-From bb693692988026dabe68e8294fe9e17f99fe1499 Mon Sep 17 00:00:00 2001
-From: Timothy Redaelli <timothy.redaelli@gmail.com>
-Date: Thu, 6 Aug 2015 15:12:37 +0200
-Subject: [PATCH 3/3] Use the correct cipher for benchmark
-
----
- src/gui/DatabaseSettingsWidget.cpp | 10 +++++++++-
- src/keys/CompositeKey.cpp | 11 ++++++-----
- src/keys/CompositeKey.h | 3 ++-
- src/keys/CompositeKey_p.h | 4 +++-
- 4 files changed, 20 insertions(+), 8 deletions(-)
-
-diff --git a/src/gui/DatabaseSettingsWidget.cpp b/src/gui/DatabaseSettingsWidget.cpp
-index 34c55b5c..ee50eae3 100644
---- a/src/gui/DatabaseSettingsWidget.cpp
-+++ b/src/gui/DatabaseSettingsWidget.cpp
-@@ -21,9 +21,11 @@
- #include "core/Database.h"
- #include "core/Group.h"
- #include "core/Metadata.h"
-+#include "crypto/SymmetricCipher.h"
- #include "format/KeePass2.h"
- #include "keys/CompositeKey.h"
-
-+
- DatabaseSettingsWidget::DatabaseSettingsWidget(QWidget* parent)
- : DialogyWidget(parent)
- , m_ui(new Ui::DatabaseSettingsWidget())
-@@ -143,7 +145,13 @@ void DatabaseSettingsWidget::reject()
- void DatabaseSettingsWidget::transformRoundsBenchmark()
- {
- QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
-- int rounds = CompositeKey::transformKeyBenchmark(1000);
-+ int rounds;
-+ if (m_ui->AlgorithmComboBox->currentIndex() == 0) {
-+ rounds = CompositeKey::transformKeyBenchmark(1000, SymmetricCipher::Aes256);
-+ }
-+ else {
-+ rounds = CompositeKey::transformKeyBenchmark(1000, SymmetricCipher::Twofish);
-+ }
- if (rounds != -1) {
- m_ui->transformRoundsSpinBox->setValue(rounds);
- }
-diff --git a/src/keys/CompositeKey.cpp b/src/keys/CompositeKey.cpp
-index 5bf9cae5..4326449b 100644
---- a/src/keys/CompositeKey.cpp
-+++ b/src/keys/CompositeKey.cpp
-@@ -145,10 +145,10 @@ void CompositeKey::addKey(const Key& key)
- m_keys.append(key.clone());
- }
-
--int CompositeKey::transformKeyBenchmark(int msec)
-+int CompositeKey::transformKeyBenchmark(int msec, SymmetricCipher::Algorithm algo)
- {
-- TransformKeyBenchmarkThread thread1(msec);
-- TransformKeyBenchmarkThread thread2(msec);
-+ TransformKeyBenchmarkThread thread1(msec, algo);
-+ TransformKeyBenchmarkThread thread2(msec, algo);
-
- thread1.start();
- thread2.start();
-@@ -160,8 +160,9 @@ int CompositeKey::transformKeyBenchmark(int msec)
- }
-
-
--TransformKeyBenchmarkThread::TransformKeyBenchmarkThread(int msec)
-+TransformKeyBenchmarkThread::TransformKeyBenchmarkThread(int msec, SymmetricCipher::Algorithm algo)
- : m_msec(msec)
-+ , algo(algo)
- , m_rounds(0)
- {
- Q_ASSERT(msec > 0);
-@@ -178,7 +179,7 @@ void TransformKeyBenchmarkThread::run()
- QByteArray seed = QByteArray(32, '\x4B');
- QByteArray iv(16, 0);
-
-- SymmetricCipher cipher(SymmetricCipher::Aes256, SymmetricCipher::Ecb,
-+ SymmetricCipher cipher(algo, SymmetricCipher::Ecb,
- SymmetricCipher::Encrypt);
- cipher.init(seed, iv);
-
-diff --git a/src/keys/CompositeKey.h b/src/keys/CompositeKey.h
-index 3290d367..0163c914 100644
---- a/src/keys/CompositeKey.h
-+++ b/src/keys/CompositeKey.h
-@@ -20,6 +20,7 @@
-
- #include <QList>
-
-+#include "crypto/SymmetricCipher.h"
- #include "keys/Key.h"
-
- class CompositeKey : public Key
-@@ -38,7 +39,7 @@ public:
- bool* ok, QString* errorString) const;
- void addKey(const Key& key);
-
-- static int transformKeyBenchmark(int msec);
-+ static int transformKeyBenchmark(int msec, SymmetricCipher::Algorithm algo);
-
- private:
- static QByteArray transformKeyRaw(const QByteArray& key, const QByteArray& seed,
-diff --git a/src/keys/CompositeKey_p.h b/src/keys/CompositeKey_p.h
-index 27fa7abc..9f321b2c 100644
---- a/src/keys/CompositeKey_p.h
-+++ b/src/keys/CompositeKey_p.h
-@@ -19,19 +19,21 @@
- #define KEEPASSX_COMPOSITEKEY_P_H
-
- #include <QThread>
-+#include "crypto/SymmetricCipher.h"
-
- class TransformKeyBenchmarkThread : public QThread
- {
- Q_OBJECT
-
- public:
-- explicit TransformKeyBenchmarkThread(int msec);
-+ explicit TransformKeyBenchmarkThread(int msec, SymmetricCipher::Algorithm algo);
- int rounds();
-
- protected:
- void run();
-
- private:
-+ SymmetricCipher::Algorithm algo;
- int m_msec;
- int m_rounds;
- };
---
-2.5.0
-