aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRiccardo Spagni <ric@spagni.net>2017-05-30 21:23:04 +0200
committerRiccardo Spagni <ric@spagni.net>2017-05-30 21:23:05 +0200
commitcd13bcb4d2fae6b62fc4ea0ca8465c26d331f463 (patch)
treeaa718dc5b4e5ef88da50a856d2cd0b52cd024e33 /src
parentMerge pull request #2035 (diff)
parenttests: fix invalid key image test (diff)
downloadmonero-cd13bcb4d2fae6b62fc4ea0ca8465c26d331f463.tar.xz
Merge pull request #2036
89b2f306 tests: fix invalid key image test (moneromooo-monero) a374a522 wallet2: check key image validity domain in import_key_images (moneromooo-monero)
Diffstat (limited to 'src')
-rw-r--r--src/wallet/wallet2.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/wallet/wallet2.cpp b/src/wallet/wallet2.cpp
index bd6bcb017..bce2f4730 100644
--- a/src/wallet/wallet2.cpp
+++ b/src/wallet/wallet2.cpp
@@ -5277,6 +5277,10 @@ uint64_t wallet2::import_key_images(const std::vector<std::pair<crypto::key_imag
std::vector<const crypto::public_key*> pkeys;
pkeys.push_back(&pkey);
+ THROW_WALLET_EXCEPTION_IF(!(rct::scalarmultKey(rct::ki2rct(key_image), rct::curveOrder()) == rct::identity()),
+ error::wallet_internal_error, "Key image out of validity domain: input " + boost::lexical_cast<std::string>(n) + "/"
+ + boost::lexical_cast<std::string>(signed_key_images.size()) + ", key image " + epee::string_tools::pod_to_hex(key_image));
+
THROW_WALLET_EXCEPTION_IF(!crypto::check_ring_signature((const crypto::hash&)key_image, key_image, pkeys, &signature),
error::wallet_internal_error, "Signature check failed: input " + boost::lexical_cast<std::string>(n) + "/"
+ boost::lexical_cast<std::string>(signed_key_images.size()) + ", key image " + epee::string_tools::pod_to_hex(key_image)