diff --git a/src/common/encryption_filter.h b/src/common/encryption_filter.h index 838fcc95..d9035047 100644 --- a/src/common/encryption_filter.h +++ b/src/common/encryption_filter.h @@ -13,254 +13,231 @@ #include "crypto/chacha8_stream.h" - -/************************************************************************/ -/* */ -/************************************************************************/ - -class encrypt_chacha_processer_base +namespace tools { -public: - typedef char char_type; - //typedef boost::iostreams::multichar_output_filter_tag category; - //typedef boost::iostreams::flushable_tag category; - static const uint32_t block_size = ECRYPT_BLOCKLENGTH; - encrypt_chacha_processer_base(std::string const &pass, const crypto::chacha8_iv& iv) :m_iv(iv), m_ctx(AUTO_VAL_INIT(m_ctx)) - { - crypto::generate_chacha8_key(pass, m_key); - ECRYPT_keysetup(&m_ctx, &m_key.data[0], sizeof(m_key.data) * 8, sizeof(m_iv.data) * 8); - ECRYPT_ivsetup(&m_ctx, &m_iv.data[0]); - } - ~encrypt_chacha_processer_base() - { + /************************************************************************/ + /* */ + /************************************************************************/ - } - - template - std::streamsize process(char_type const * const buf, std::streamsize const n, cb_handler cb) const + class encrypt_chacha_processer_base { - if (n == 0) - return n; - if (n%ECRYPT_BLOCKLENGTH == 0 && m_buff.empty()) + public: + typedef char char_type; + //typedef boost::iostreams::multichar_output_filter_tag category; + //typedef boost::iostreams::flushable_tag category; + static const uint32_t block_size = ECRYPT_BLOCKLENGTH; + + encrypt_chacha_processer_base(std::string const &pass, const crypto::chacha8_iv& iv) :m_iv(iv), m_ctx(AUTO_VAL_INIT(m_ctx)) { - std::vector buff(n); - ECRYPT_encrypt_blocks(&m_ctx, (u8*)buf, (u8*)&buff[0], (u32)(n / ECRYPT_BLOCKLENGTH)); - cb(&buff[0], n); - //m_underlying_stream.write(&buff[0], n); - return n; + crypto::generate_chacha8_key(pass, m_key); + ECRYPT_keysetup(&m_ctx, &m_key.data[0], sizeof(m_key.data) * 8, sizeof(m_iv.data) * 8); + ECRYPT_ivsetup(&m_ctx, &m_iv.data[0]); } - else + ~encrypt_chacha_processer_base() { - m_buff.append(buf, n); - size_t encr_count = m_buff.size() - m_buff.size() % ECRYPT_BLOCKLENGTH; - if (!encr_count) + + } + + template + std::streamsize process(char_type const * const buf, std::streamsize const n, cb_handler cb) const + { + if (n == 0) return n; - std::vector buff(encr_count); - ECRYPT_encrypt_blocks(&m_ctx, (u8*)m_buff.data(), (u8*)&buff[0], (u32)(m_buff.size() / ECRYPT_BLOCKLENGTH)); - //m_underlying_stream.write(&buff[0], encr_count); - cb(&buff[0], encr_count); - m_buff.erase(0, encr_count); - return encr_count; + if (n%ECRYPT_BLOCKLENGTH == 0 && m_buff.empty()) + { + std::vector buff(n); + ECRYPT_encrypt_blocks(&m_ctx, (u8*)buf, (u8*)&buff[0], (u32)(n / ECRYPT_BLOCKLENGTH)); + cb(&buff[0], n); + //m_underlying_stream.write(&buff[0], n); + return n; + } + else + { + m_buff.append(buf, n); + size_t encr_count = m_buff.size() - m_buff.size() % ECRYPT_BLOCKLENGTH; + if (!encr_count) + return n; + std::vector buff(encr_count); + ECRYPT_encrypt_blocks(&m_ctx, (u8*)m_buff.data(), (u8*)&buff[0], (u32)(m_buff.size() / ECRYPT_BLOCKLENGTH)); + //m_underlying_stream.write(&buff[0], encr_count); + cb(&buff[0], encr_count); + m_buff.erase(0, encr_count); + return encr_count; + } + } - } + template + bool flush(cb_handler cb) + { + if (m_buff.empty()) + return true; - template - bool flush(cb_handler cb) - { - if (m_buff.empty()) + std::vector buff(m_buff.size()); + ECRYPT_encrypt_bytes(&m_ctx, (u8*)m_buff.data(), (u8*)&buff[0], (u32)m_buff.size()); + cb(&buff[0], m_buff.size()); + //m_underlying_stream.write(&buff[0], m_buff.size()); return true; - - std::vector buff(m_buff.size()); - ECRYPT_encrypt_bytes(&m_ctx, (u8*)m_buff.data(), (u8*)&buff[0], (u32)m_buff.size()); - cb(&buff[0], m_buff.size()); - //m_underlying_stream.write(&buff[0], m_buff.size()); - return true; - } - -private: - const crypto::chacha8_iv& m_iv; - mutable ECRYPT_ctx m_ctx; - //std::ostream &m_underlying_stream; - crypto::chacha8_key m_key; - mutable std::string m_buff; -}; - -/************************************************************************/ -/* */ -/************************************************************************/ - - -class encrypt_chacha_out_filter: public encrypt_chacha_processer_base -{ -public: - typedef char char_type; - struct category: - public boost::iostreams::multichar_output_filter_tag, - public boost::iostreams::flushable_tag - { }; - - encrypt_chacha_out_filter(std::string const &pass, const crypto::chacha8_iv& iv) :encrypt_chacha_processer_base(pass, iv) - { - } - ~encrypt_chacha_out_filter() - { - } - - template - std::streamsize write(t_sink& snk, char_type const * const buf, std::streamsize const n) const - { - return encrypt_chacha_processer_base::process(buf, n, [&](char_type const * const buf_lambda, std::streamsize const n_lambda) { - boost::iostreams::write(snk, &buf_lambda[0], n_lambda); - }); - } - - template - bool flush(Sink& snk) - { - - encrypt_chacha_processer_base::flush([&](char_type const * const buf_lambda, std::streamsize const n_lambda) { - boost::iostreams::write(snk, &buf_lambda[0], n_lambda); - }); - return true; - } - -private: -}; - - -/************************************************************************/ -/* */ -/************************************************************************/ - -class encrypt_chacha_in_filter : public encrypt_chacha_processer_base -{ -public: - typedef char char_type; - struct category: //public boost::iostreams::seekable_device_tag, - public boost::iostreams::multichar_input_filter_tag, - public boost::iostreams::flushable_tag - //public boost::iostreams::seekable_filter_tag - { }; - encrypt_chacha_in_filter(std::string const &pass, const crypto::chacha8_iv& iv) :encrypt_chacha_processer_base(pass, iv), m_was_eof(false) - { - } - ~encrypt_chacha_in_filter() - { - } - - template - std::streamsize read(Source& src, char* s, std::streamsize n) - { - if(m_buff.size() >= static_cast(n)) - { - return withdraw_to_read_buff(s, n); - } - if(m_was_eof && m_buff.empty()) - { - return -1; } - std::streamsize size_to_read_for_decrypt = (n - m_buff.size()); - size_to_read_for_decrypt += size_to_read_for_decrypt % encrypt_chacha_processer_base::block_size; - size_t offset_in_buff = m_buff.size(); - m_buff.resize(m_buff.size() + size_to_read_for_decrypt); + private: + const crypto::chacha8_iv& m_iv; + mutable ECRYPT_ctx m_ctx; + //std::ostream &m_underlying_stream; + crypto::chacha8_key m_key; + mutable std::string m_buff; + }; - std::streamsize result = boost::iostreams::read(src, (char*)&m_buff.data()[offset_in_buff], size_to_read_for_decrypt); - if(result == size_to_read_for_decrypt) + /************************************************************************/ + /* */ + /************************************************************************/ + + + class encrypt_chacha_out_filter : public encrypt_chacha_processer_base + { + public: + typedef char char_type; + struct category : + public boost::iostreams::multichar_output_filter_tag, + public boost::iostreams::flushable_tag + { }; + + encrypt_chacha_out_filter(std::string const &pass, const crypto::chacha8_iv& iv) :encrypt_chacha_processer_base(pass, iv) { - //regular read proocess, readed data enought to get decrypteds - encrypt_chacha_processer_base::process(&m_buff.data()[offset_in_buff], size_to_read_for_decrypt, [&](char_type const* const buf_lambda, std::streamsize const n_lambda) - { - CHECK_AND_ASSERT_THROW_MES(n_lambda == size_to_read_for_decrypt, "Error in decrypt: check n_lambda == size_to_read_for_decrypt failed"); - std::memcpy((char*)&m_buff.data()[offset_in_buff], buf_lambda, n_lambda); + } + ~encrypt_chacha_out_filter() + { + } + + template + std::streamsize write(t_sink& snk, char_type const * const buf, std::streamsize const n) const + { + return encrypt_chacha_processer_base::process(buf, n, [&](char_type const * const buf_lambda, std::streamsize const n_lambda) { + boost::iostreams::write(snk, &buf_lambda[0], n_lambda); }); - return withdraw_to_read_buff(s, n); } - else + + template + bool flush(Sink& snk) { - //been read some size_but it's basically might be eof - if(!m_was_eof) + + encrypt_chacha_processer_base::flush([&](char_type const * const buf_lambda, std::streamsize const n_lambda) { + boost::iostreams::write(snk, &buf_lambda[0], n_lambda); + }); + return true; + } + + private: + }; + + + /************************************************************************/ + /* */ + /************************************************************************/ + + class encrypt_chacha_in_filter : public encrypt_chacha_processer_base + { + public: + typedef char char_type; + struct category : //public boost::iostreams::seekable_device_tag, + public boost::iostreams::multichar_input_filter_tag, + public boost::iostreams::flushable_tag + //public boost::iostreams::seekable_filter_tag + { }; + encrypt_chacha_in_filter(std::string const &pass, const crypto::chacha8_iv& iv) :encrypt_chacha_processer_base(pass, iv), m_was_eof(false) + { + } + ~encrypt_chacha_in_filter() + { + } + + template + std::streamsize read(Source& src, char* s, std::streamsize n) + { + if (m_buff.size() >= static_cast(n)) { - size_t offset_before_flush = offset_in_buff; - if(result != -1) - { - //eof - encrypt_chacha_processer_base::process(&m_buff.data()[offset_in_buff], result, [&](char_type const* const buf_lambda, std::streamsize const n_lambda) { - std::memcpy((char*)&m_buff.data()[offset_in_buff], buf_lambda, n_lambda); - offset_before_flush = offset_in_buff + n_lambda; - }); - } - - encrypt_chacha_processer_base::flush([&](char_type const* const buf_lambda, std::streamsize const n_lambda) { - if(n_lambda + offset_before_flush > m_buff.size()) - { - m_buff.resize(n_lambda + offset_before_flush); - } - std::memcpy((char*)&m_buff.data()[offset_before_flush], buf_lambda, n_lambda); - m_buff.resize(offset_before_flush + n_lambda); - }); - - //just to make sure that it's over - std::string buff_stub(10, ' '); - std::streamsize r = boost::iostreams::read(src, (char*)&buff_stub.data()[0], 10); - CHECK_AND_ASSERT_THROW_MES(r == -1, "expected EOF"); - m_was_eof = true; return withdraw_to_read_buff(s, n); } - else + if (m_was_eof && m_buff.empty()) { - return -1; + return -1; + } + + std::streamsize size_to_read_for_decrypt = (n - m_buff.size()); + size_to_read_for_decrypt += size_to_read_for_decrypt % encrypt_chacha_processer_base::block_size; + size_t offset_in_buff = m_buff.size(); + m_buff.resize(m_buff.size() + size_to_read_for_decrypt); + + std::streamsize result = boost::iostreams::read(src, (char*)&m_buff.data()[offset_in_buff], size_to_read_for_decrypt); + if (result == size_to_read_for_decrypt) + { + //regular read proocess, readed data enought to get decrypteds + encrypt_chacha_processer_base::process(&m_buff.data()[offset_in_buff], size_to_read_for_decrypt, [&](char_type const* const buf_lambda, std::streamsize const n_lambda) + { + CHECK_AND_ASSERT_THROW_MES(n_lambda == size_to_read_for_decrypt, "Error in decrypt: check n_lambda == size_to_read_for_decrypt failed"); + std::memcpy((char*)&m_buff.data()[offset_in_buff], buf_lambda, n_lambda); + }); + return withdraw_to_read_buff(s, n); + } + else + { + //been read some size_but it's basically might be eof + if (!m_was_eof) + { + size_t offset_before_flush = offset_in_buff; + if (result != -1) + { + //eof + encrypt_chacha_processer_base::process(&m_buff.data()[offset_in_buff], result, [&](char_type const* const buf_lambda, std::streamsize const n_lambda) { + std::memcpy((char*)&m_buff.data()[offset_in_buff], buf_lambda, n_lambda); + offset_before_flush = offset_in_buff + n_lambda; + }); + } + + encrypt_chacha_processer_base::flush([&](char_type const* const buf_lambda, std::streamsize const n_lambda) { + if (n_lambda + offset_before_flush > m_buff.size()) + { + m_buff.resize(n_lambda + offset_before_flush); + } + std::memcpy((char*)&m_buff.data()[offset_before_flush], buf_lambda, n_lambda); + m_buff.resize(offset_before_flush + n_lambda); + }); + + //just to make sure that it's over + std::string buff_stub(10, ' '); + std::streamsize r = boost::iostreams::read(src, (char*)&buff_stub.data()[0], 10); + CHECK_AND_ASSERT_THROW_MES(r == -1, "expected EOF"); + m_was_eof = true; + return withdraw_to_read_buff(s, n); + } + else + { + return -1; + } } } - } - template - bool flush(Sink& snk) - { - - return true; - } - -private: - - std::streamsize withdraw_to_read_buff(char* s, std::streamsize n) - { - - size_t copy_size = m_buff.size() > static_cast(n) ? static_cast(n) : m_buff.size(); - std::memcpy(s, m_buff.data(), copy_size); - m_buff.erase(0, copy_size); - return copy_size; - } - - /* - std::streamsize withdraw_to_read_buff(char* s, std::streamsize n, char_type const * const buf_lambda, std::streamsize const n_lambda) - { - if (m_buff.size()) + template + bool flush(Sink& snk) { - //need to use m_buff anyway - m_buff.append(buf_lambda, n_lambda); - size_t copy_size = n > m_buff.size() ? m_buff.size() : n; - std::memcpy(s, buf_lambda, copy_size); + + return true; + } + + private: + + std::streamsize withdraw_to_read_buff(char* s, std::streamsize n) + { + + size_t copy_size = m_buff.size() > static_cast(n) ? static_cast(n) : m_buff.size(); + std::memcpy(s, m_buff.data(), copy_size); m_buff.erase(0, copy_size); return copy_size; - } - else - { - size_t copy_size = n > n_lambda ? n_lambda : n; - std::memcpy(s, buf_lambda, copy_size); - if (n_lambda > copy_size) - { - //need to add tail to m_buff - m_buff.append(buf_lambda + copy_size, n_lambda - copy_size); - } - return copy_size; - } - } - */ + } - std::string m_buff; - bool m_was_eof; -}; + std::string m_buff; + bool m_was_eof; + }; +} \ No newline at end of file diff --git a/src/currency_core/account.cpp b/src/currency_core/account.cpp index b3dd880d..ada25025 100644 --- a/src/currency_core/account.cpp +++ b/src/currency_core/account.cpp @@ -81,7 +81,7 @@ namespace currency if (m_keys.account_address.flags & ACCOUNT_PUBLIC_ADDRESS_FLAG_AUDITABLE) auditable_flag = 1; - uint64_t auditable_flag_and_checksum = (auditable_flag & 1) | (checksum << 1); + uint32_t auditable_flag_and_checksum = (auditable_flag & 1) | (checksum << 1); std::string auditable_flag_and_checksum_word = tools::mnemonic_encoding::word_by_num(auditable_flag_and_checksum); return keys_seed_text + " " + timestamp_word + " " + auditable_flag_and_checksum_word; @@ -148,7 +148,7 @@ namespace currency if (auditable_flag_and_checksum != UINT64_MAX) { auditable_flag = (auditable_flag_and_checksum & 1) != 0; // auditable flag is the lower 1 bit - uint16_t checksum = auditable_flag_and_checksum >> 1; // checksum -- everything else + uint16_t checksum = static_cast(auditable_flag_and_checksum >> 1); // checksum -- everything else constexpr uint16_t checksum_max = tools::mnemonic_encoding::NUMWORDS >> 1; // maximum value of checksum crypto::hash h = crypto::cn_fast_hash(keys_seed_binary.data(), keys_seed_binary.size()); *reinterpret_cast(&h) = m_creation_timestamp; diff --git a/src/currency_core/currency_config.h b/src/currency_core/currency_config.h index 958b0c5d..6bb298f6 100644 --- a/src/currency_core/currency_config.h +++ b/src/currency_core/currency_config.h @@ -146,7 +146,8 @@ #define WALLET_FILE_SIGNATURE_OLD 0x1111012101101011LL // Bender's nightmare #define WALLET_FILE_SIGNATURE_V2 0x1111011201101011LL // another Bender's nightmare -#define WALLET_FILE_MAX_BODY_SIZE 0x88888888L //2GB +#define WALLET_FILE_BINARY_HEADER_VERSION 1001 + #define WALLET_FILE_MAX_KEYS_SIZE 10000 // #define WALLET_BRAIN_DATE_OFFSET 1543622400 #define WALLET_BRAIN_DATE_QUANTUM 604800 //by last word we encode a number of week since launch of the project, diff --git a/src/wallet/wallet2.cpp b/src/wallet/wallet2.cpp index b78ea372..aeb533b4 100644 --- a/src/wallet/wallet2.cpp +++ b/src/wallet/wallet2.cpp @@ -7,6 +7,8 @@ #include #include #include +#include +#include #include #include #include @@ -26,6 +28,7 @@ using namespace epee; #include "serialization/binary_utils.h" #include "currency_core/bc_payments_id_service.h" #include "version.h" +#include "common/encryption_filter.h" using namespace currency; #define MINIMUM_REQUIRED_WALLET_FREE_SPACE_BYTES (100*1024*1024) // 100 MB @@ -2120,7 +2123,7 @@ bool wallet2::reset_all() return true; } //---------------------------------------------------------------------------------------------------- -bool wallet2::store_keys(std::string& buff, const std::string& password, bool store_as_watch_only /* = false */) +bool wallet2::store_keys(std::string& buff, const std::string& password, wallet2::keys_file_data& keys_file_data, bool store_as_watch_only /* = false */) { currency::account_base acc = m_account; if (store_as_watch_only) @@ -2130,8 +2133,6 @@ bool wallet2::store_keys(std::string& buff, const std::string& password, bool st bool r = epee::serialization::store_t_to_binary(acc, account_data); WLT_CHECK_AND_ASSERT_MES(r, false, "failed to serialize wallet keys"); - wallet2::keys_file_data keys_file_data = boost::value_initialized(); - crypto::chacha8_key key; crypto::generate_chacha8_key(password, key); std::string cipher; @@ -2148,7 +2149,8 @@ bool wallet2::store_keys(std::string& buff, const std::string& password, bool st bool wallet2::backup_keys(const std::string& path) { std::string buff; - bool r = store_keys(buff, m_password); + wallet2::keys_file_data keys_file_data = AUTO_VAL_INIT(keys_file_data); + bool r = store_keys(buff, m_password, keys_file_data); WLT_CHECK_AND_ASSERT_MES(r, false, "Failed to store keys"); r = file_io_utils::save_string_to_file(path, buff); @@ -2234,10 +2236,9 @@ bool wallet2::prepare_file_names(const std::wstring& file_path) return true; } //---------------------------------------------------------------------------------------------------- -void wallet2::load_keys(const std::string& buff, const std::string& password, uint64_t file_signature) +void wallet2::load_keys(const std::string& buff, const std::string& password, uint64_t file_signature, keys_file_data& kf_data) { bool r = false; - wallet2::keys_file_data kf_data = AUTO_VAL_INIT(kf_data); if (file_signature == WALLET_FILE_SIGNATURE_OLD) { wallet2::keys_file_data_old kf_data_old; @@ -2356,16 +2357,30 @@ void wallet2::load(const std::wstring& wallet_, const std::string& password) THROW_IF_TRUE_WALLET_EX(data_file.fail(), error::file_read_error, epee::string_encoding::convert_to_ansii(m_wallet_file)); THROW_IF_TRUE_WALLET_EX(wbh.m_signature != WALLET_FILE_SIGNATURE_OLD && wbh.m_signature != WALLET_FILE_SIGNATURE_V2, error::file_read_error, epee::string_encoding::convert_to_ansii(m_wallet_file)); - THROW_IF_TRUE_WALLET_EX(wbh.m_cb_body > WALLET_FILE_MAX_BODY_SIZE || + THROW_IF_TRUE_WALLET_EX( wbh.m_cb_keys > WALLET_FILE_MAX_KEYS_SIZE, error::file_read_error, epee::string_encoding::convert_to_ansii(m_wallet_file)); keys_buff.resize(wbh.m_cb_keys); data_file.read((char*)keys_buff.data(), wbh.m_cb_keys); + wallet2::keys_file_data kf_data = AUTO_VAL_INIT(kf_data); + load_keys(keys_buff, password, wbh.m_signature, kf_data); - load_keys(keys_buff, password, wbh.m_signature); - - bool need_to_resync = !tools::portable_unserialize_obj_from_stream(*this, data_file); + bool need_to_resync = false; + if (wbh.m_ver == 1000) + { + need_to_resync = !tools::portable_unserialize_obj_from_stream(*this, data_file); + } + else + { + tools::encrypt_chacha_in_filter decrypt_filter(password, kf_data.iv); + boost::iostreams::filtering_istream in; + in.push(decrypt_filter); + in.push(data_file); + need_to_resync = !tools::portable_unserialize_obj_from_stream(*this, in); + } + + if (m_watch_only && !is_auditable()) load_keys2ki(true, need_to_resync); @@ -2405,7 +2420,8 @@ void wallet2::store(const std::wstring& path_to_save, const std::string& passwor //prepare data std::string keys_buff; - bool r = store_keys(keys_buff, password, m_watch_only); + wallet2::keys_file_data keys_file_data = AUTO_VAL_INIT(keys_file_data); + bool r = store_keys(keys_buff, password, keys_file_data, m_watch_only); WLT_THROW_IF_FALSE_WALLET_CMN_ERR_EX(r, "failed to store_keys for wallet " << ascii_path_to_save); //store data @@ -2413,7 +2429,7 @@ void wallet2::store(const std::wstring& path_to_save, const std::string& passwor wbh.m_signature = WALLET_FILE_SIGNATURE_V2; wbh.m_cb_keys = keys_buff.size(); //@#@ change it to proper - wbh.m_cb_body = 1000; + wbh.m_ver = WALLET_FILE_BINARY_HEADER_VERSION; std::string header_buff((const char*)&wbh, sizeof(wbh)); uint64_t ts = m_core_runtime_config.get_core_time(); @@ -2428,8 +2444,13 @@ void wallet2::store(const std::wstring& path_to_save, const std::string& passwor data_file << header_buff << keys_buff; WLT_LOG_L0("Storing to temporary file " << tmp_file_path.string() << " ..."); + //creating encryption stream + tools::encrypt_chacha_out_filter decrypt_filter(m_password, keys_file_data.iv); + boost::iostreams::filtering_ostream out; + out.push(decrypt_filter); + out.push(data_file); - r = tools::portble_serialize_obj_to_stream(*this, data_file); + r = tools::portble_serialize_obj_to_stream(*this, out); if (!r) { data_file.close(); diff --git a/src/wallet/wallet2.h b/src/wallet/wallet2.h index 8fcbcf4b..58308b3c 100644 --- a/src/wallet/wallet2.h +++ b/src/wallet/wallet2.h @@ -88,7 +88,9 @@ namespace tools { uint64_t m_signature; uint16_t m_cb_keys; - uint64_t m_cb_body; + //uint64_t m_cb_body; <-- this field never used, soo replace it with two other variables "m_ver" + and "m_reserved" + uint32_t m_ver; + uint32_t m_reserved; //for future use }; #pragma pack (pop) @@ -472,7 +474,7 @@ namespace tools void store(const std::wstring& path); void store(const std::wstring& path, const std::string& password); void store_watch_only(const std::wstring& path, const std::string& password) const; - bool store_keys(std::string& buff, const std::string& password, bool store_as_watch_only = false); + bool store_keys(std::string& buff, const std::string& password, wallet2::keys_file_data& keys_file_data, bool store_as_watch_only = false); std::wstring get_wallet_path()const { return m_wallet_file; } std::string get_wallet_password()const { return m_password; } currency::account_base& get_account() { return m_account; } @@ -803,7 +805,7 @@ private: void add_transfers_to_expiration_list(const std::vector& selected_transfers, uint64_t expiration, uint64_t change_amount, const crypto::hash& related_tx_id); void remove_transfer_from_expiration_list(uint64_t transfer_index); - void load_keys(const std::string& keys_file_name, const std::string& password, uint64_t file_signature); + void load_keys(const std::string& keys_file_name, const std::string& password, uint64_t file_signature, keys_file_data& kf_data); void process_new_transaction(const currency::transaction& tx, uint64_t height, const currency::block& b, const std::vector* pglobal_indexes); void fetch_tx_global_indixes(const currency::transaction& tx, std::vector& goutputs_indexes); void fetch_tx_global_indixes(const std::list>& txs, std::vector>& goutputs_indexes); diff --git a/tests/performance_tests/chacha_stream_performance_test.cpp b/tests/performance_tests/chacha_stream_performance_test.cpp index 71e14b01..2509bcb5 100644 --- a/tests/performance_tests/chacha_stream_performance_test.cpp +++ b/tests/performance_tests/chacha_stream_performance_test.cpp @@ -20,7 +20,7 @@ bool perform_crypt_stream_iteration(const std::list verification_list; boost::filesystem::ofstream store_data_file; store_data_file.open("./test.bin", std::ios_base::binary | std::ios_base::out | std::ios::trunc); - encrypt_chacha_out_filter encrypt_filter("pass", iv); + tools::encrypt_chacha_out_filter encrypt_filter("pass", iv); boost::iostreams::filtering_ostream out; out.push(encrypt_filter); out.push(store_data_file); @@ -34,7 +34,7 @@ bool perform_crypt_stream_iteration(const std::list(); boost::filesystem::ofstream store_data_file; store_data_file.open("./test.bin", std::ios_base::binary | std::ios_base::out | std::ios::trunc); - encrypt_chacha_out_filter encrypt_filter("pass", iv); + tools::encrypt_chacha_out_filter encrypt_filter("pass", iv); boost::iostreams::filtering_ostream out; out.push(encrypt_filter); out.push(store_data_file); @@ -45,7 +45,7 @@ TEST(chacha_stream_test, basic_test_with_serialization_on_top) boost::filesystem::ifstream data_file; data_file.open("./test.bin", std::ios_base::binary | std::ios_base::in); - encrypt_chacha_in_filter decrypt_filter("pass", iv); + tools::encrypt_chacha_in_filter decrypt_filter("pass", iv); boost::iostreams::filtering_istream in; in.push(decrypt_filter); @@ -84,7 +84,7 @@ TEST(chacha_stream_test, diversity_test_on_different_stream_behaviour) crypto::chacha8_iv iv = crypto::rand(); boost::filesystem::ofstream store_data_file; store_data_file.open("./test.bin", std::ios_base::binary | std::ios_base::out | std::ios::trunc); - encrypt_chacha_out_filter encrypt_filter("pass", iv); + tools::encrypt_chacha_out_filter encrypt_filter("pass", iv); //boost::iostreams::stream outputStream(sink_encrypt); boost::iostreams::filtering_ostream out; out.push(encrypt_filter); @@ -98,7 +98,7 @@ TEST(chacha_stream_test, diversity_test_on_different_stream_behaviour) { boost::filesystem::ifstream data_file; data_file.open("./test.bin", std::ios_base::binary | std::ios_base::in); - encrypt_chacha_in_filter decrypt_filter("pass", iv); + tools::encrypt_chacha_in_filter decrypt_filter("pass", iv); boost::iostreams::filtering_istream in; in.push(decrypt_filter);