diff --git a/src/crypter.cpp b/src/crypter.cpp index 2f94e0827..122e06d97 100644 --- a/src/crypter.cpp +++ b/src/crypter.cpp @@ -178,6 +178,8 @@ bool CCryptoKeyStore::Unlock(const CKeyingMaterial& vMasterKeyIn) break; } keyPass = true; + if (fDecryptionThoroughlyChecked) + break; } if (keyPass && keyFail) { @@ -187,6 +189,7 @@ bool CCryptoKeyStore::Unlock(const CKeyingMaterial& vMasterKeyIn) if (keyFail || !keyPass) return false; vMasterKey = vMasterKeyIn; + fDecryptionThoroughlyChecked = true; } NotifyStatusChanged(this); return true; diff --git a/src/crypter.h b/src/crypter.h index 4791428b4..f16fcef9c 100644 --- a/src/crypter.h +++ b/src/crypter.h @@ -121,6 +121,9 @@ private: // if fUseCrypto is false, vMasterKey must be empty bool fUseCrypto; + // keeps track of whether Unlock has run a thourough check before + bool fDecryptionThoroughlyChecked; + protected: bool SetCrypted(); @@ -130,7 +133,7 @@ protected: bool Unlock(const CKeyingMaterial& vMasterKeyIn); public: - CCryptoKeyStore() : fUseCrypto(false) + CCryptoKeyStore() : fUseCrypto(false), fDecryptionThoroughlyChecked(false) { }