Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- bool CCryptoKeyStore::Unlock(const CKeyingMaterial& vMasterKeyIn)
- {
- {
- LOCK(cs_KeyStore);
- if (!SetCrypted())
- return false;
- CryptedKeyMap::const_iterator mi = mapCryptedKeys.begin();
- for (; mi != mapCryptedKeys.end(); ++mi)
- {
- const CPubKey &vchPubKey = (*mi).second.first;
- const std::vector<unsigned char> &vchCryptedSecret =
- (*mi).second.second;
- CKeyingMaterial vchSecret;
- if(!DecryptSecret(vMasterKeyIn, vchCryptedSecret,
- vchPubKey.GetHash(), vchSecret))
- return false;
- if (vchSecret.size() != 32)
- return false;
- CKey key;
- key.Set(vchSecret.begin(), vchSecret.end(),
- vchPubKey.IsCompressed());
- if (key.GetPubKey() == vchPubKey)
- break;
- return false;
- }
- vMasterKey = vMasterKeyIn;
- }
- NotifyStatusChanged(this);
- return true;
- }
- This suspicious code was found in Bitcoin project by PVS-Studio static code analyzer.
- Warning message is:
- V612 An unconditional 'return' within a loop. crypter.cpp 169
- PVS-Studio is a static analyzer for detecting bugs in the source code of applications written in C, C++, C++11, C++/CX. Site: http://www.viva64.com/en/pvs-studio/
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement