mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2025-08-04 20:44:14 -04:00
Deep copy subkeys when cloning CompositeKey.
This commit is contained in:
parent
ac60f7ce70
commit
0014d50b59
5 changed files with 110 additions and 0 deletions
|
@ -22,6 +22,15 @@
|
|||
|
||||
#include <QtCore/QtConcurrentRun>
|
||||
|
||||
CompositeKey::CompositeKey()
|
||||
{
|
||||
}
|
||||
|
||||
CompositeKey::CompositeKey(const CompositeKey& key)
|
||||
{
|
||||
*this = key;
|
||||
}
|
||||
|
||||
CompositeKey::~CompositeKey()
|
||||
{
|
||||
qDeleteAll(m_keys);
|
||||
|
@ -32,6 +41,14 @@ CompositeKey* CompositeKey::clone() const
|
|||
return new CompositeKey(*this);
|
||||
}
|
||||
|
||||
CompositeKey& CompositeKey::operator=(const CompositeKey& key)
|
||||
{
|
||||
Q_FOREACH (Key* subKey, key.m_keys) {
|
||||
m_keys.append(subKey->clone());
|
||||
}
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
QByteArray CompositeKey::rawKey() const
|
||||
{
|
||||
|
@ -46,6 +63,9 @@ QByteArray CompositeKey::rawKey() const
|
|||
|
||||
QByteArray CompositeKey::transform(const QByteArray& seed, int rounds) const
|
||||
{
|
||||
Q_ASSERT(seed.size() == 32);
|
||||
Q_ASSERT(rounds > 0);
|
||||
|
||||
QByteArray key = rawKey();
|
||||
|
||||
QFuture<QByteArray> future1 = QtConcurrent::run(transformKeyRaw, key.left(16), seed, rounds);
|
||||
|
|
|
@ -25,8 +25,11 @@
|
|||
class CompositeKey : public Key
|
||||
{
|
||||
public:
|
||||
CompositeKey();
|
||||
CompositeKey(const CompositeKey& key);
|
||||
~CompositeKey();
|
||||
CompositeKey* clone() const;
|
||||
CompositeKey& operator=(const CompositeKey& key);
|
||||
|
||||
QByteArray rawKey() const;
|
||||
QByteArray transform(const QByteArray& seed, int rounds) const;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue