mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2025-08-02 11:36:18 -04:00
Allow for KDF seeds between 8 and 32 bytes
Correcting undocumented feature from KeePass2 Fixes #2581
This commit is contained in:
parent
f446774605
commit
1d24b52fa6
2 changed files with 4 additions and 3 deletions
|
@ -24,7 +24,7 @@
|
||||||
|
|
||||||
Kdf::Kdf(const QUuid& uuid)
|
Kdf::Kdf(const QUuid& uuid)
|
||||||
: m_rounds(KDF_DEFAULT_ROUNDS)
|
: m_rounds(KDF_DEFAULT_ROUNDS)
|
||||||
, m_seed(QByteArray(KDF_DEFAULT_SEED_SIZE, 0))
|
, m_seed(QByteArray(KDF_MAX_SEED_SIZE, 0))
|
||||||
, m_uuid(uuid)
|
, m_uuid(uuid)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
@ -56,7 +56,7 @@ bool Kdf::setRounds(int rounds)
|
||||||
|
|
||||||
bool Kdf::setSeed(const QByteArray& seed)
|
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;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -21,7 +21,8 @@
|
||||||
#include <QUuid>
|
#include <QUuid>
|
||||||
#include <QVariant>
|
#include <QVariant>
|
||||||
|
|
||||||
#define KDF_DEFAULT_SEED_SIZE 32
|
#define KDF_MIN_SEED_SIZE 8
|
||||||
|
#define KDF_MAX_SEED_SIZE 32
|
||||||
#define KDF_DEFAULT_ROUNDS 1000000ull
|
#define KDF_DEFAULT_ROUNDS 1000000ull
|
||||||
|
|
||||||
class Kdf
|
class Kdf
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue