diff options
author | moneromooo-monero <moneromooo-monero@users.noreply.github.com> | 2018-07-24 20:17:32 +0100 |
---|---|---|
committer | moneromooo-monero <moneromooo-monero@users.noreply.github.com> | 2018-09-11 13:38:09 +0000 |
commit | a1359ad43c9263c919f8c39b54224ac9fc992d74 (patch) | |
tree | 3ca8115f43472766631671e976946b13c272034d | |
parent | bulletproofs: reject x, y, z, or w[i] being zero (diff) | |
download | monero-a1359ad43c9263c919f8c39b54224ac9fc992d74.tar.xz |
Check inputs to addKeys are in range
Reported by QuarksLab.
Diffstat (limited to '')
-rw-r--r-- | src/ringct/rctSigs.cpp | 4 | ||||
-rw-r--r-- | src/wallet/wallet2.cpp | 2 |
2 files changed, 6 insertions, 0 deletions
diff --git a/src/ringct/rctSigs.cpp b/src/ringct/rctSigs.cpp index dbbf29fd1..ae58ad12c 100644 --- a/src/ringct/rctSigs.cpp +++ b/src/ringct/rctSigs.cpp @@ -1108,6 +1108,8 @@ namespace rct { DP("C"); DP(C); key Ctmp; + CHECK_AND_ASSERT_THROW_MES(sc_check(mask.bytes) == 0, "warning, bad ECDH mask"); + CHECK_AND_ASSERT_THROW_MES(sc_check(amount.bytes) == 0, "warning, bad ECDH amount"); addKeys2(Ctmp, mask, amount, H); DP("Ctmp"); DP(Ctmp); @@ -1136,6 +1138,8 @@ namespace rct { DP("C"); DP(C); key Ctmp; + CHECK_AND_ASSERT_THROW_MES(sc_check(mask.bytes) == 0, "warning, bad ECDH mask"); + CHECK_AND_ASSERT_THROW_MES(sc_check(amount.bytes) == 0, "warning, bad ECDH amount"); addKeys2(Ctmp, mask, amount, H); DP("Ctmp"); DP(Ctmp); diff --git a/src/wallet/wallet2.cpp b/src/wallet/wallet2.cpp index 6c0aec4a4..9b977350e 100644 --- a/src/wallet/wallet2.cpp +++ b/src/wallet/wallet2.cpp @@ -9422,6 +9422,8 @@ void wallet2::check_tx_key_helper(const crypto::hash &txid, const crypto::key_de hwdev.ecdhDecode(ecdh_info, rct::sk2rct(scalar1)); const rct::key C = tx.rct_signatures.outPk[n].mask; rct::key Ctmp; + THROW_WALLET_EXCEPTION_IF(sc_check(ecdh_info.mask.bytes) != 0, error::wallet_internal_error, "Bad ECDH input mask"); + THROW_WALLET_EXCEPTION_IF(sc_check(ecdh_info.amount.bytes) != 0, error::wallet_internal_error, "Bad ECDH input amount"); rct::addKeys2(Ctmp, ecdh_info.mask, ecdh_info.amount, rct::H); if (rct::equalKeys(C, Ctmp)) amount = rct::h2d(ecdh_info.amount); |