diff options
author | Louis-Bertrand Varin <louisbvarin@gmail.com> | 2018-03-31 23:01:30 +0300 |
---|---|---|
committer | Louis-Bertrand Varin <louisbvarin@gmail.com> | 2018-03-31 23:01:30 +0300 |
commit | 8324d03f0a015e62b6182843b4478226a5197090 (patch) | |
tree | faf34febaec7c7e764d357dc5e439f6f2b1fcaf3 /src/keys | |
parent | 74efc57369b068a0f93cb84ac68b6c17f64c8abe (diff) |
Formatting the code.
Diffstat (limited to 'src/keys')
-rw-r--r-- | src/keys/ChallengeResponseKey.h | 4 | ||||
-rw-r--r-- | src/keys/CompositeKey.cpp | 2 | ||||
-rw-r--r-- | src/keys/CompositeKey.h | 6 | ||||
-rw-r--r-- | src/keys/FileKey.cpp | 3 | ||||
-rw-r--r-- | src/keys/FileKey.h | 5 | ||||
-rw-r--r-- | src/keys/Key.h | 4 | ||||
-rw-r--r-- | src/keys/YkChallengeResponseKey.cpp | 20 | ||||
-rw-r--r-- | src/keys/YkChallengeResponseKey.h | 1 | ||||
-rw-r--r-- | src/keys/drivers/YubiKey.cpp | 13 | ||||
-rw-r--r-- | src/keys/drivers/YubiKey.h | 10 | ||||
-rw-r--r-- | src/keys/drivers/YubiKeyStub.cpp | 4 |
11 files changed, 42 insertions, 30 deletions
diff --git a/src/keys/ChallengeResponseKey.h b/src/keys/ChallengeResponseKey.h index 698846a03..702ee2511 100644 --- a/src/keys/ChallengeResponseKey.h +++ b/src/keys/ChallengeResponseKey.h @@ -24,7 +24,9 @@ class ChallengeResponseKey { public: - virtual ~ChallengeResponseKey() {} + virtual ~ChallengeResponseKey() + { + } virtual QByteArray rawKey() const = 0; virtual bool challenge(const QByteArray& challenge) = 0; }; diff --git a/src/keys/CompositeKey.cpp b/src/keys/CompositeKey.cpp index 6391819b5..3bce1559a 100644 --- a/src/keys/CompositeKey.cpp +++ b/src/keys/CompositeKey.cpp @@ -22,8 +22,8 @@ #include <format/KeePass2.h> #include "core/Global.h" -#include "crypto/kdf/AesKdf.h" #include "crypto/CryptoHash.h" +#include "crypto/kdf/AesKdf.h" CompositeKey::CompositeKey() { diff --git a/src/keys/CompositeKey.h b/src/keys/CompositeKey.h index fe93a38b4..50d9dbd37 100644 --- a/src/keys/CompositeKey.h +++ b/src/keys/CompositeKey.h @@ -20,12 +20,12 @@ #define KEEPASSX_COMPOSITEKEY_H #include <QList> -#include <QString> #include <QSharedPointer> +#include <QString> #include "crypto/kdf/Kdf.h" -#include "keys/Key.h" #include "keys/ChallengeResponseKey.h" +#include "keys/Key.h" class CompositeKey : public Key { @@ -41,7 +41,7 @@ public: QByteArray rawKey() const override; QByteArray rawKey(const QByteArray* transformSeed, bool* ok = nullptr) const; bool transform(const Kdf& kdf, QByteArray& result) const Q_REQUIRED_RESULT; - bool challenge(const QByteArray& seed, QByteArray &result) const; + bool challenge(const QByteArray& seed, QByteArray& result) const; void addKey(const Key& key); void addChallengeResponseKey(QSharedPointer<ChallengeResponseKey> key); diff --git a/src/keys/FileKey.cpp b/src/keys/FileKey.cpp index 26db40d85..b491fc51e 100644 --- a/src/keys/FileKey.cpp +++ b/src/keys/FileKey.cpp @@ -347,8 +347,7 @@ bool FileKey::loadHashed(QIODevice* device) return false; } cryptoHash.addData(buffer); - } - while (!buffer.isEmpty()); + } while (!buffer.isEmpty()); m_key = cryptoHash.result(); diff --git a/src/keys/FileKey.h b/src/keys/FileKey.h index 2aa48909b..3f04edede 100644 --- a/src/keys/FileKey.h +++ b/src/keys/FileKey.h @@ -25,10 +25,11 @@ class QIODevice; -class FileKey: public Key +class FileKey : public Key { public: - enum Type { + enum Type + { None, Hashed, KeePass2XML, diff --git a/src/keys/Key.h b/src/keys/Key.h index 2172f5702..4014e3907 100644 --- a/src/keys/Key.h +++ b/src/keys/Key.h @@ -23,7 +23,9 @@ class Key { public: - virtual ~Key() {} + virtual ~Key() + { + } virtual QByteArray rawKey() const = 0; virtual Key* clone() const = 0; }; diff --git a/src/keys/YkChallengeResponseKey.cpp b/src/keys/YkChallengeResponseKey.cpp index ac50a5bba..913e2d32a 100644 --- a/src/keys/YkChallengeResponseKey.cpp +++ b/src/keys/YkChallengeResponseKey.cpp @@ -23,16 +23,16 @@ #include "crypto/Random.h" #include "gui/MainWindow.h" -#include <QFile> -#include <QXmlStreamReader> -#include <QtConcurrent> #include <QApplication> #include <QEventLoop> +#include <QFile> #include <QFutureWatcher> +#include <QXmlStreamReader> +#include <QtConcurrent> YkChallengeResponseKey::YkChallengeResponseKey(int slot, bool blocking) - : m_slot(slot), - m_blocking(blocking) + : m_slot(slot) + , m_blocking(blocking) { if (KEEPASSXC_MAIN_WINDOW) { connect(this, SIGNAL(userInteractionRequired()), KEEPASSXC_MAIN_WINDOW, SLOT(showYubiKeyPopup())); @@ -64,9 +64,8 @@ bool YkChallengeResponseKey::challenge(const QByteArray& challenge, unsigned ret emit userInteractionRequired(); } - QFuture<YubiKey::ChallengeResult> future = QtConcurrent::run([this, challenge]() { - return YubiKey::instance()->challenge(m_slot, true, challenge, m_key); - }); + QFuture<YubiKey::ChallengeResult> future = QtConcurrent::run( + [this, challenge]() { return YubiKey::instance()->challenge(m_slot, true, challenge, m_key); }); QEventLoop loop; QFutureWatcher<YubiKey::ChallengeResult> watcher; @@ -99,9 +98,8 @@ QString YkChallengeResponseKey::getName() const YubiKey::instance()->getSerial(serial); - return fmt.arg(QString::number(serial), - QString::number(m_slot), - (m_blocking) ? QObject::tr("Press") : QObject::tr("Passive")); + return fmt.arg( + QString::number(serial), QString::number(m_slot), (m_blocking) ? QObject::tr("Press") : QObject::tr("Passive")); } bool YkChallengeResponseKey::isBlocking() const diff --git a/src/keys/YkChallengeResponseKey.h b/src/keys/YkChallengeResponseKey.h index 2816602a4..912896e9d 100644 --- a/src/keys/YkChallengeResponseKey.h +++ b/src/keys/YkChallengeResponseKey.h @@ -29,7 +29,6 @@ class YkChallengeResponseKey : public QObject, public ChallengeResponseKey Q_OBJECT public: - YkChallengeResponseKey(int slot = -1, bool blocking = false); QByteArray rawKey() const; diff --git a/src/keys/drivers/YubiKey.cpp b/src/keys/drivers/YubiKey.cpp index 4b98a6e48..b94916197 100644 --- a/src/keys/drivers/YubiKey.cpp +++ b/src/keys/drivers/YubiKey.cpp @@ -21,12 +21,12 @@ #include <QDebug> #include <ykcore.h> -#include <yubikey.h> #include <ykdef.h> #include <ykstatus.h> +#include <yubikey.h> -#include "core/Tools.h" #include "core/Global.h" +#include "core/Tools.h" #include "crypto/Random.h" #include "YubiKey.h" @@ -36,7 +36,10 @@ #define m_yk (static_cast<YK_KEY*>(m_yk_void)) #define m_ykds (static_cast<YK_STATUS*>(m_ykds_void)) -YubiKey::YubiKey() : m_yk_void(NULL), m_ykds_void(NULL), m_mutex(QMutex::Recursive) +YubiKey::YubiKey() + : m_yk_void(NULL) + , m_ykds_void(NULL) + , m_mutex(QMutex::Recursive) { } @@ -188,8 +191,8 @@ YubiKey::ChallengeResult YubiKey::challenge(int slot, bool mayBlock, const QByte paddedChallenge.append(QByteArray(padLen, padLen)); } - const unsigned char *c; - unsigned char *r; + const unsigned char* c; + unsigned char* r; c = reinterpret_cast<const unsigned char*>(paddedChallenge.constData()); r = reinterpret_cast<unsigned char*>(response.data()); diff --git a/src/keys/drivers/YubiKey.h b/src/keys/drivers/YubiKey.h index 328688f08..39085546b 100644 --- a/src/keys/drivers/YubiKey.h +++ b/src/keys/drivers/YubiKey.h @@ -19,8 +19,8 @@ #ifndef KEEPASSX_YUBIKEY_H #define KEEPASSX_YUBIKEY_H -#include <QObject> #include <QMutex> +#include <QObject> /** * Singleton class to manage the interface to the hardware @@ -30,7 +30,13 @@ class YubiKey : public QObject Q_OBJECT public: - enum ChallengeResult { ERROR = -1, SUCCESS = 0, WOULDBLOCK, ALREADY_RUNNING }; + enum ChallengeResult + { + ERROR = -1, + SUCCESS = 0, + WOULDBLOCK, + ALREADY_RUNNING + }; /** * @brief YubiKey::instance - get instance of singleton diff --git a/src/keys/drivers/YubiKeyStub.cpp b/src/keys/drivers/YubiKeyStub.cpp index 9f6314f0e..3cff04965 100644 --- a/src/keys/drivers/YubiKeyStub.cpp +++ b/src/keys/drivers/YubiKeyStub.cpp @@ -23,7 +23,9 @@ #include "YubiKey.h" -YubiKey::YubiKey() : m_yk_void(NULL), m_ykds_void(NULL) +YubiKey::YubiKey() + : m_yk_void(NULL) + , m_ykds_void(NULL) { } |