mirror of
https://github.com/monero-project/monero.git
synced 2024-12-25 13:09:24 +00:00
Merge pull request #1414
3b005275
ringct: add sc_check calls in MLSAG_Ver for ss and cc (moneromooo-monero)2f1732a7
ringct: guard against bad data exceptions in worker threads (moneromooo-monero)
This commit is contained in:
commit
e6b05ed95a
1 changed files with 19 additions and 0 deletions
|
@ -231,6 +231,11 @@ namespace rct {
|
||||||
}
|
}
|
||||||
CHECK_AND_ASSERT_MES(dsRows <= rows, false, "Bad dsRows value");
|
CHECK_AND_ASSERT_MES(dsRows <= rows, false, "Bad dsRows value");
|
||||||
|
|
||||||
|
for (size_t i = 0; i < rv.ss.size(); ++i)
|
||||||
|
for (size_t j = 0; j < rv.ss[i].size(); ++j)
|
||||||
|
CHECK_AND_ASSERT_MES(sc_check(rv.ss[i][j].bytes) == 0, false, "Bad ss slot");
|
||||||
|
CHECK_AND_ASSERT_MES(sc_check(rv.cc.bytes) == 0, false, "Bad cc");
|
||||||
|
|
||||||
size_t i = 0, j = 0, ii = 0;
|
size_t i = 0, j = 0, ii = 0;
|
||||||
key c, L, R, Hi;
|
key c, L, R, Hi;
|
||||||
key c_old = copy(rv.cc);
|
key c_old = copy(rv.cc);
|
||||||
|
@ -307,6 +312,8 @@ namespace rct {
|
||||||
// mask is a such that C = aG + bH, and b = amount
|
// mask is a such that C = aG + bH, and b = amount
|
||||||
//verRange verifies that \sum Ci = C and that each Ci is a commitment to 0 or 2^i
|
//verRange verifies that \sum Ci = C and that each Ci is a commitment to 0 or 2^i
|
||||||
bool verRange(const key & C, const rangeSig & as) {
|
bool verRange(const key & C, const rangeSig & as) {
|
||||||
|
try
|
||||||
|
{
|
||||||
PERF_TIMER(verRange);
|
PERF_TIMER(verRange);
|
||||||
key64 CiH;
|
key64 CiH;
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
@ -321,6 +328,9 @@ namespace rct {
|
||||||
return false;
|
return false;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
// we can get deep throws from ge_frombytes_vartime if input isn't valid
|
||||||
|
catch (...) { return false; }
|
||||||
|
}
|
||||||
|
|
||||||
key get_pre_mlsag_hash(const rctSig &rv)
|
key get_pre_mlsag_hash(const rctSig &rv)
|
||||||
{
|
{
|
||||||
|
@ -485,6 +495,8 @@ namespace rct {
|
||||||
//This does a simplified version, assuming only post Rct
|
//This does a simplified version, assuming only post Rct
|
||||||
//inputs
|
//inputs
|
||||||
bool verRctMGSimple(const key &message, const mgSig &mg, const ctkeyV & pubs, const key & C) {
|
bool verRctMGSimple(const key &message, const mgSig &mg, const ctkeyV & pubs, const key & C) {
|
||||||
|
try
|
||||||
|
{
|
||||||
PERF_TIMER(verRctMGSimple);
|
PERF_TIMER(verRctMGSimple);
|
||||||
//setup vars
|
//setup vars
|
||||||
size_t rows = 1;
|
size_t rows = 1;
|
||||||
|
@ -501,6 +513,8 @@ namespace rct {
|
||||||
//DP(C);
|
//DP(C);
|
||||||
return MLSAG_Ver(message, M, mg, rows);
|
return MLSAG_Ver(message, M, mg, rows);
|
||||||
}
|
}
|
||||||
|
catch (...) { return false; }
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//These functions get keys from blockchain
|
//These functions get keys from blockchain
|
||||||
|
@ -762,6 +776,8 @@ namespace rct {
|
||||||
//ver RingCT simple
|
//ver RingCT simple
|
||||||
//assumes only post-rct style inputs (at least for max anonymity)
|
//assumes only post-rct style inputs (at least for max anonymity)
|
||||||
bool verRctSimple(const rctSig & rv) {
|
bool verRctSimple(const rctSig & rv) {
|
||||||
|
try
|
||||||
|
{
|
||||||
PERF_TIMER(verRctSimple);
|
PERF_TIMER(verRctSimple);
|
||||||
|
|
||||||
CHECK_AND_ASSERT_MES(rv.type == RCTTypeSimple, false, "verRctSimple called on non simple rctSig");
|
CHECK_AND_ASSERT_MES(rv.type == RCTTypeSimple, false, "verRctSimple called on non simple rctSig");
|
||||||
|
@ -833,6 +849,9 @@ namespace rct {
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
// we can get deep throws from ge_frombytes_vartime if input isn't valid
|
||||||
|
catch (...) { return false; }
|
||||||
|
}
|
||||||
|
|
||||||
//RingCT protocol
|
//RingCT protocol
|
||||||
//genRct:
|
//genRct:
|
||||||
|
|
Loading…
Reference in a new issue