diff options
author | moneromooo-monero <moneromooo-monero@users.noreply.github.com> | 2017-12-12 10:58:27 +0000 |
---|---|---|
committer | moneromooo-monero <moneromooo-monero@users.noreply.github.com> | 2017-12-18 15:15:46 +0000 |
commit | 2305bf260d852135fab53a0a2e95dce8994d7afc (patch) | |
tree | fb4a65418e0920159cdd1255d3e5a1c0d303b36b /src/cryptonote_basic | |
parent | catch const exceptions (diff) | |
download | monero-2305bf260d852135fab53a0a2e95dce8994d7afc.tar.xz |
check return value for generate_key_derivation and derive_public_key
Diffstat (limited to 'src/cryptonote_basic')
-rw-r--r-- | src/cryptonote_basic/cryptonote_format_utils.cpp | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/cryptonote_basic/cryptonote_format_utils.cpp b/src/cryptonote_basic/cryptonote_format_utils.cpp index 8f7ab94db..21fa63842 100644 --- a/src/cryptonote_basic/cryptonote_format_utils.cpp +++ b/src/cryptonote_basic/cryptonote_format_utils.cpp @@ -630,17 +630,21 @@ namespace cryptonote bool is_out_to_acc(const account_keys& acc, const txout_to_key& out_key, const crypto::public_key& tx_pub_key, const std::vector<crypto::public_key>& additional_tx_pub_keys, size_t output_index) { crypto::key_derivation derivation; - generate_key_derivation(tx_pub_key, acc.m_view_secret_key, derivation); + bool r = generate_key_derivation(tx_pub_key, acc.m_view_secret_key, derivation); + CHECK_AND_ASSERT_MES(r, false, "Failed to generate key derivation"); crypto::public_key pk; - derive_public_key(derivation, output_index, acc.m_account_address.m_spend_public_key, pk); + r = derive_public_key(derivation, output_index, acc.m_account_address.m_spend_public_key, pk); + CHECK_AND_ASSERT_MES(r, false, "Failed to derive public key"); if (pk == out_key.key) return true; // try additional tx pubkeys if available if (!additional_tx_pub_keys.empty()) { CHECK_AND_ASSERT_MES(output_index < additional_tx_pub_keys.size(), false, "wrong number of additional tx pubkeys"); - generate_key_derivation(additional_tx_pub_keys[output_index], acc.m_view_secret_key, derivation); - derive_public_key(derivation, output_index, acc.m_account_address.m_spend_public_key, pk); + r = generate_key_derivation(additional_tx_pub_keys[output_index], acc.m_view_secret_key, derivation); + CHECK_AND_ASSERT_MES(r, false, "Failed to generate key derivation"); + r = derive_public_key(derivation, output_index, acc.m_account_address.m_spend_public_key, pk); + CHECK_AND_ASSERT_MES(r, false, "Failed to derive public key"); return pk == out_key.key; } return false; |