mirror of
https://codeberg.org/anoncontributorxmr/monero.git
synced 2024-11-22 15:32:24 +00:00
Merge pull request #8394
4278a3a
cryptonote_basic: catch crypto api errors (moneromooo-monero)
This commit is contained in:
commit
7a118f08f4
3 changed files with 12 additions and 7 deletions
|
@ -1042,7 +1042,7 @@ namespace cryptonote
|
|||
crypto::public_key subaddress_spendkey;
|
||||
if (out_can_be_to_acc(view_tag_opt, derivation, output_index))
|
||||
{
|
||||
hwdev.derive_subaddress_public_key(out_key, derivation, output_index, subaddress_spendkey);
|
||||
CHECK_AND_ASSERT_MES(hwdev.derive_subaddress_public_key(out_key, derivation, output_index, subaddress_spendkey), boost::none, "Failed to derive subaddress public key");
|
||||
auto found = subaddresses.find(subaddress_spendkey);
|
||||
if (found != subaddresses.end())
|
||||
return subaddress_receive_info{ found->second, derivation };
|
||||
|
@ -1054,7 +1054,7 @@ namespace cryptonote
|
|||
CHECK_AND_ASSERT_MES(output_index < additional_derivations.size(), boost::none, "wrong number of additional derivations");
|
||||
if (out_can_be_to_acc(view_tag_opt, additional_derivations[output_index], output_index))
|
||||
{
|
||||
hwdev.derive_subaddress_public_key(out_key, additional_derivations[output_index], output_index, subaddress_spendkey);
|
||||
CHECK_AND_ASSERT_MES(hwdev.derive_subaddress_public_key(out_key, additional_derivations[output_index], output_index, subaddress_spendkey), boost::none, "Failed to derive subaddress public key");
|
||||
auto found = subaddresses.find(subaddress_spendkey);
|
||||
if (found != subaddresses.end())
|
||||
return subaddress_receive_info{ found->second, additional_derivations[output_index] };
|
||||
|
|
|
@ -694,7 +694,8 @@ namespace hw {
|
|||
log_hexbuffer("derive_subaddress_public_key: [[IN]] pub ", pub_x.data, 32);
|
||||
log_hexbuffer("derive_subaddress_public_key: [[IN]] derivation", derivation_x.data, 32);
|
||||
log_message ("derive_subaddress_public_key: [[IN]] index ", std::to_string((int)output_index_x));
|
||||
this->controle_device->derive_subaddress_public_key(pub_x, derivation_x,output_index_x,derived_pub_x);
|
||||
if (!this->controle_device->derive_subaddress_public_key(pub_x, derivation_x,output_index_x,derived_pub_x))
|
||||
return false;
|
||||
log_hexbuffer("derive_subaddress_public_key: [[OUT]] derived_pub", derived_pub_x.data, 32);
|
||||
#endif
|
||||
|
||||
|
@ -702,7 +703,8 @@ namespace hw {
|
|||
//If we are in TRANSACTION_PARSE, the given derivation has been retrieved uncrypted (wihtout the help
|
||||
//of the device), so continue that way.
|
||||
MDEBUG( "derive_subaddress_public_key : PARSE mode with known viewkey");
|
||||
crypto::derive_subaddress_public_key(pub, derivation, output_index,derived_pub);
|
||||
if (!crypto::derive_subaddress_public_key(pub, derivation, output_index,derived_pub))
|
||||
return false;
|
||||
} else {
|
||||
AUTO_LOCK_CMD();
|
||||
int offset = set_command_header_noopt(INS_DERIVE_SUBADDRESS_PUBLIC_KEY);
|
||||
|
@ -1052,7 +1054,8 @@ namespace hw {
|
|||
crypto::key_derivation derivation_x;
|
||||
log_hexbuffer("generate_key_derivation: [[IN]] pub ", pub_x.data, 32);
|
||||
log_hexbuffer("generate_key_derivation: [[IN]] sec ", sec_x.data, 32);
|
||||
this->controle_device->generate_key_derivation(pub_x, sec_x, derivation_x);
|
||||
if (!this->controle_device->generate_key_derivation(pub_x, sec_x, derivation_x))
|
||||
return false;
|
||||
log_hexbuffer("generate_key_derivation: [[OUT]] derivation", derivation_x.data, 32);
|
||||
#endif
|
||||
|
||||
|
@ -1207,7 +1210,8 @@ namespace hw {
|
|||
log_hexbuffer("derive_public_key: [[IN]] derivation ", derivation_x.data, 32);
|
||||
log_message ("derive_public_key: [[IN]] output_index", std::to_string(output_index_x));
|
||||
log_hexbuffer("derive_public_key: [[IN]] pub ", pub_x.data, 32);
|
||||
this->controle_device->derive_public_key(derivation_x, output_index_x, pub_x, derived_pub_x);
|
||||
if (!this->controle_device->derive_public_key(derivation_x, output_index_x, pub_x, derived_pub_x))
|
||||
return false;
|
||||
log_hexbuffer("derive_public_key: [[OUT]] derived_pub ", derived_pub_x.data, 32);
|
||||
#endif
|
||||
|
||||
|
|
|
@ -12095,7 +12095,8 @@ bool wallet2::check_reserve_proof(const cryptonote::account_public_address &addr
|
|||
crypto::key_derivation derivation;
|
||||
THROW_WALLET_EXCEPTION_IF(!crypto::generate_key_derivation(proof.shared_secret, rct::rct2sk(rct::I), derivation), error::wallet_internal_error, "Failed to generate key derivation");
|
||||
crypto::public_key subaddr_spendkey;
|
||||
crypto::derive_subaddress_public_key(output_public_key, derivation, proof.index_in_tx, subaddr_spendkey);
|
||||
THROW_WALLET_EXCEPTION_IF(!crypto::derive_subaddress_public_key(output_public_key, derivation, proof.index_in_tx, subaddr_spendkey),
|
||||
error::wallet_internal_error, "Failed to derive subaddress public key");
|
||||
THROW_WALLET_EXCEPTION_IF(subaddr_spendkeys.count(subaddr_spendkey) == 0, error::wallet_internal_error,
|
||||
"The address doesn't seem to have received the fund");
|
||||
|
||||
|
|
Loading…
Reference in a new issue