Changeset View
Changeset View
Standalone View
Standalone View
src/wallet/crypter.h
// Copyright (c) 2009-2016 The Bitcoin Core developers | // Copyright (c) 2009-2016 The Bitcoin Core developers | ||||
// Distributed under the MIT software license, see the accompanying | // Distributed under the MIT software license, see the accompanying | ||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php. | // file COPYING or http://www.opensource.org/licenses/mit-license.php. | ||||
#ifndef BITCOIN_WALLET_CRYPTER_H | #ifndef BITCOIN_WALLET_CRYPTER_H | ||||
#define BITCOIN_WALLET_CRYPTER_H | #define BITCOIN_WALLET_CRYPTER_H | ||||
#include "keystore.h" | #include "keystore.h" | ||||
#include "serialize.h" | #include "serialize.h" | ||||
#include "support/allocators/secure.h" | #include "support/allocators/secure.h" | ||||
#include <atomic> | |||||
class uint256; | class uint256; | ||||
const unsigned int WALLET_CRYPTO_KEY_SIZE = 32; | const unsigned int WALLET_CRYPTO_KEY_SIZE = 32; | ||||
const unsigned int WALLET_CRYPTO_SALT_SIZE = 8; | const unsigned int WALLET_CRYPTO_SALT_SIZE = 8; | ||||
const unsigned int WALLET_CRYPTO_IV_SIZE = 16; | const unsigned int WALLET_CRYPTO_IV_SIZE = 16; | ||||
/** | /** | ||||
* Private key encryption is done based on a CMasterKey, which holds a salt and | * Private key encryption is done based on a CMasterKey, which holds a salt and | ||||
▲ Show 20 Lines • Show All 95 Lines • ▼ Show 20 Lines | |||||
* active. | * active. | ||||
*/ | */ | ||||
class CCryptoKeyStore : public CBasicKeyStore { | class CCryptoKeyStore : public CBasicKeyStore { | ||||
private: | private: | ||||
CKeyingMaterial vMasterKey; | CKeyingMaterial vMasterKey; | ||||
//! if fUseCrypto is true, mapKeys must be empty | //! if fUseCrypto is true, mapKeys must be empty | ||||
//! if fUseCrypto is false, vMasterKey must be empty | //! if fUseCrypto is false, vMasterKey must be empty | ||||
bool fUseCrypto; | std::atomic<bool> fUseCrypto; | ||||
//! keeps track of whether Unlock has run a thorough check before | //! keeps track of whether Unlock has run a thorough check before | ||||
bool fDecryptionThoroughlyChecked; | bool fDecryptionThoroughlyChecked; | ||||
protected: | protected: | ||||
bool SetCrypted(); | bool SetCrypted(); | ||||
//! will encrypt previously unencrypted keys | //! will encrypt previously unencrypted keys | ||||
▲ Show 20 Lines • Show All 56 Lines • Show Last 20 Lines |