diff options
author | Jonathan White <support@dmapps.us> | 2018-01-01 21:21:02 +0300 |
---|---|---|
committer | Jonathan White <support@dmapps.us> | 2018-01-13 22:23:30 +0300 |
commit | 542ee42313f16d7f6522c746b0403da0369a4e99 (patch) | |
tree | 65a48e988dc872229b07d2090c2e22c75f0a6aa0 /src/crypto/kdf/Kdf.h | |
parent | 9140893cd3e7658cd5ecda2fed4207fda6893f81 (diff) |
Add Argon2Kdf and enable parameters in db settings
Note: This implementation is not yet connected to the
database itself and will corrupt existing kdbx3 db's.
* Implemented memory and parallelism parameters for Argon2Kdf
* Using libargon2; libsodium does not support Argon2d algorithm
* Moved basic rounds parameter into Kdf class
* Reimplemented benchmark algorithm; previous was utterly broken
Diffstat (limited to 'src/crypto/kdf/Kdf.h')
-rw-r--r-- | src/crypto/kdf/Kdf.h | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/src/crypto/kdf/Kdf.h b/src/crypto/kdf/Kdf.h index 5330e71d0..cb0bcc364 100644 --- a/src/crypto/kdf/Kdf.h +++ b/src/crypto/kdf/Kdf.h @@ -22,6 +22,9 @@ #include "core/Uuid.h" +#define KDF_DEFAULT_SEED_SIZE 32 +#define KDF_DEFAULT_ROUNDS 100000ull + class Kdf { public: @@ -30,12 +33,13 @@ public: Uuid uuid() const; - virtual quint64 rounds() const = 0; - virtual bool setRounds(quint64 rounds) = 0; - virtual QByteArray seed() const = 0; - virtual bool setSeed(const QByteArray& seed) = 0; + int rounds() const; + virtual bool setRounds(int rounds); + QByteArray seed() const; + virtual bool setSeed(const QByteArray& seed); + virtual void randomizeSeed(); + virtual bool transform(const QByteArray& raw, QByteArray& result) const = 0; - virtual void randomizeTransformSalt() = 0; virtual QSharedPointer<Kdf> clone() const = 0; int benchmark(int msec) const; @@ -43,6 +47,9 @@ public: protected: virtual int benchmarkImpl(int msec) const = 0; + int m_rounds; + QByteArray m_seed; + private: class BenchmarkThread; const Uuid m_uuid; |