ringct: guard against bad data exceptions in worker threads
If purported pubkeys aren't actually valid pubkeys, exceptions will fly. These will terminate if thrown in a worker thread. Guard against this.
This commit is contained in:
parent
45bb393577
commit
2f1732a7e5
|
@ -335,6 +335,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;
|
||||||
|
@ -348,6 +350,9 @@ namespace rct {
|
||||||
if (!VerASNL(as.Ci, CiH, as.asig))
|
if (!VerASNL(as.Ci, CiH, as.asig))
|
||||||
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)
|
||||||
|
@ -513,6 +518,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;
|
||||||
|
@ -528,6 +535,8 @@ namespace rct {
|
||||||
}
|
}
|
||||||
//DP(C);
|
//DP(C);
|
||||||
return MLSAG_Ver(message, M, mg, rows);
|
return MLSAG_Ver(message, M, mg, rows);
|
||||||
|
}
|
||||||
|
catch (...) { return false; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -790,6 +799,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");
|
||||||
|
@ -860,6 +871,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
|
||||||
|
|
Loading…
Reference in New Issue