cryptonote: do not overwrite const data

This commit is contained in:
moneromooo-monero 2017-11-09 10:45:15 +00:00
parent 49ce59462a
commit 54a4c1cbf7
No known key found for this signature in database
GPG key ID: 686F07454D6CEFC3
2 changed files with 4 additions and 4 deletions

View file

@ -994,7 +994,7 @@ namespace cryptonote
block_hashes_cached = block_hashes_cached_count; block_hashes_cached = block_hashes_cached_count;
} }
//--------------------------------------------------------------- //---------------------------------------------------------------
crypto::secret_key encrypt_key(const crypto::secret_key &key, const std::string &passphrase) crypto::secret_key encrypt_key(crypto::secret_key key, const std::string &passphrase)
{ {
crypto::hash hash; crypto::hash hash;
crypto::cn_slow_hash(passphrase.data(), passphrase.size(), hash); crypto::cn_slow_hash(passphrase.data(), passphrase.size(), hash);
@ -1002,7 +1002,7 @@ namespace cryptonote
return key; return key;
} }
//--------------------------------------------------------------- //---------------------------------------------------------------
crypto::secret_key decrypt_key(const crypto::secret_key &key, const std::string &passphrase) crypto::secret_key decrypt_key(crypto::secret_key key, const std::string &passphrase)
{ {
crypto::hash hash; crypto::hash hash;
crypto::cn_slow_hash(passphrase.data(), passphrase.size(), hash); crypto::cn_slow_hash(passphrase.data(), passphrase.size(), hash);

View file

@ -226,8 +226,8 @@ namespace cryptonote
bool is_valid_decomposed_amount(uint64_t amount); bool is_valid_decomposed_amount(uint64_t amount);
void get_hash_stats(uint64_t &tx_hashes_calculated, uint64_t &tx_hashes_cached, uint64_t &block_hashes_calculated, uint64_t & block_hashes_cached); void get_hash_stats(uint64_t &tx_hashes_calculated, uint64_t &tx_hashes_cached, uint64_t &block_hashes_calculated, uint64_t & block_hashes_cached);
crypto::secret_key encrypt_key(const crypto::secret_key &key, const std::string &passphrase); crypto::secret_key encrypt_key(crypto::secret_key key, const std::string &passphrase);
crypto::secret_key decrypt_key(const crypto::secret_key &key, const std::string &passphrase); crypto::secret_key decrypt_key(crypto::secret_key key, const std::string &passphrase);
#define CHECKED_GET_SPECIFIC_VARIANT(variant_var, specific_type, variable_name, fail_return_val) \ #define CHECKED_GET_SPECIFIC_VARIANT(variant_var, specific_type, variable_name, fail_return_val) \
CHECK_AND_ASSERT_MES(variant_var.type() == typeid(specific_type), fail_return_val, "wrong variant type: " << variant_var.type().name() << ", expected " << typeid(specific_type).name()); \ CHECK_AND_ASSERT_MES(variant_var.type() == typeid(specific_type), fail_return_val, "wrong variant type: " << variant_var.type().name() << ", expected " << typeid(specific_type).name()); \
specific_type& variable_name = boost::get<specific_type>(variant_var); specific_type& variable_name = boost::get<specific_type>(variant_var);