diff --git a/src/crypto/kdf/Kdf.cpp b/src/crypto/kdf/Kdf.cpp index fcedc488f..797723193 100644 --- a/src/crypto/kdf/Kdf.cpp +++ b/src/crypto/kdf/Kdf.cpp @@ -24,7 +24,7 @@ Kdf::Kdf(const QUuid& uuid) : m_rounds(KDF_DEFAULT_ROUNDS) - , m_seed(QByteArray(KDF_DEFAULT_SEED_SIZE, 0)) + , m_seed(QByteArray(KDF_MAX_SEED_SIZE, 0)) , m_uuid(uuid) { } @@ -56,7 +56,7 @@ bool Kdf::setRounds(int rounds) bool Kdf::setSeed(const QByteArray& seed) { - if (seed.size() != m_seed.size()) { + if (seed.size() < KDF_MIN_SEED_SIZE || seed.size() > KDF_MAX_SEED_SIZE) { return false; } diff --git a/src/crypto/kdf/Kdf.h b/src/crypto/kdf/Kdf.h index 36b4772f2..368fb16f7 100644 --- a/src/crypto/kdf/Kdf.h +++ b/src/crypto/kdf/Kdf.h @@ -21,7 +21,8 @@ #include #include -#define KDF_DEFAULT_SEED_SIZE 32 +#define KDF_MIN_SEED_SIZE 8 +#define KDF_MAX_SEED_SIZE 32 #define KDF_DEFAULT_ROUNDS 1000000ull class Kdf