Merge pull request #2860

3dffe71b new wipeable_string class to replace std::string passphrases (moneromooo-monero)
7a2a5741 utils: initialize easylogging++ in on_startup (moneromooo-monero)
54950829 use memwipe in a few relevant places (moneromooo-monero)
000666ff add a memwipe function (moneromooo-monero)
This commit is contained in:
Riccardo Spagni 2017-12-16 23:19:27 +02:00
commit 6c0953b15a
No known key found for this signature in database
GPG key ID: 55432DF31CCD4FCD
22 changed files with 528 additions and 69 deletions

View file

@ -433,7 +433,7 @@ bool simple_wallet::print_seed(bool encrypted)
m_wallet->set_seed_language(mnemonic_language);
}
std::string seed_pass;
epee::wipeable_string seed_pass;
if (encrypted)
{
auto pwd_container = tools::password_container::prompt(true, tr("Enter optional seed encryption passphrase, empty to see raw seed"));
@ -1426,7 +1426,7 @@ bool simple_wallet::init(const boost::program_options::variables_map& vm)
auto pwd_container = tools::password_container::prompt(false, tr("Enter seed encryption passphrase, empty if none"));
if (std::cin.eof() || !pwd_container)
return false;
std::string seed_pass = pwd_container->password();
epee::wipeable_string seed_pass = pwd_container->password();
if (!seed_pass.empty())
m_recovery_key = cryptonote::decrypt_key(m_recovery_key, seed_pass);
}
@ -2087,12 +2087,12 @@ bool simple_wallet::open_wallet(const boost::program_options::variables_map& vm)
fail_msg_writer() << tr("wallet file path not valid: ") << m_wallet_file;
return false;
}
std::string password;
epee::wipeable_string password;
try
{
auto rc = tools::wallet2::make_from_file(vm, m_wallet_file, password_prompter);
m_wallet = std::move(rc.first);
password = std::move(rc.second).password();
password = std::move(std::move(rc.second).password());
if (!m_wallet)
{
return false;