mirror of
https://git.wownero.com/wownero/wownero.git
synced 2024-12-23 03:18:52 +00:00
ringct: handle exceptions verifying bulletproofs in worker threads
This commit is contained in:
parent
35d5aa36c9
commit
ff5626d785
@ -52,6 +52,13 @@ namespace rct {
|
|||||||
return proof;
|
return proof;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool verBulletproof(const Bulletproof &proof)
|
||||||
|
{
|
||||||
|
try { return bulletproof_VERIFY(proof); }
|
||||||
|
// we can get deep throws from ge_frombytes_vartime if input isn't valid
|
||||||
|
catch (...) { return false; }
|
||||||
|
}
|
||||||
|
|
||||||
//Borromean (c.f. gmax/andytoshi's paper)
|
//Borromean (c.f. gmax/andytoshi's paper)
|
||||||
boroSig genBorromean(const key64 x, const key64 P1, const key64 P2, const bits indices) {
|
boroSig genBorromean(const key64 x, const key64 P1, const key64 P2, const bits indices) {
|
||||||
key64 L[2], alpha;
|
key64 L[2], alpha;
|
||||||
@ -645,7 +652,7 @@ namespace rct {
|
|||||||
rv.p.rangeSigs[i] = proveRange(rv.outPk[i].mask, outSk[i].mask, amounts[i]);
|
rv.p.rangeSigs[i] = proveRange(rv.outPk[i].mask, outSk[i].mask, amounts[i]);
|
||||||
#ifdef DBG
|
#ifdef DBG
|
||||||
if (bulletproof)
|
if (bulletproof)
|
||||||
CHECK_AND_ASSERT_THROW_MES(bulletproof_VERIFY(rv.p.bulletproofs[i]), "bulletproof_VERIFY failed on newly created proof");
|
CHECK_AND_ASSERT_THROW_MES(verBulletproof(rv.p.bulletproofs[i]), "verBulletproof failed on newly created proof");
|
||||||
else
|
else
|
||||||
CHECK_AND_ASSERT_THROW_MES(verRange(rv.outPk[i].mask, rv.p.rangeSigs[i]), "verRange failed on newly created proof");
|
CHECK_AND_ASSERT_THROW_MES(verRange(rv.outPk[i].mask, rv.p.rangeSigs[i]), "verRange failed on newly created proof");
|
||||||
#endif
|
#endif
|
||||||
@ -725,7 +732,7 @@ namespace rct {
|
|||||||
rv.p.rangeSigs[i] = proveRange(rv.outPk[i].mask, outSk[i].mask, outamounts[i]);
|
rv.p.rangeSigs[i] = proveRange(rv.outPk[i].mask, outSk[i].mask, outamounts[i]);
|
||||||
#ifdef DBG
|
#ifdef DBG
|
||||||
if (bulletproof)
|
if (bulletproof)
|
||||||
CHECK_AND_ASSERT_THROW_MES(bulletproof_VERIFY(rv.p.bulletproofs[i]), "bulletproof_VERIFY failed on newly created proof");
|
CHECK_AND_ASSERT_THROW_MES(verBulletproof(rv.p.bulletproofs[i]), "verBulletproof failed on newly created proof");
|
||||||
else
|
else
|
||||||
CHECK_AND_ASSERT_THROW_MES(verRange(rv.outPk[i].mask, rv.p.rangeSigs[i]), "verRange failed on newly created proof");
|
CHECK_AND_ASSERT_THROW_MES(verRange(rv.outPk[i].mask, rv.p.rangeSigs[i]), "verRange failed on newly created proof");
|
||||||
#endif
|
#endif
|
||||||
@ -817,7 +824,7 @@ namespace rct {
|
|||||||
for (size_t i = 0; i < rv.outPk.size(); i++) {
|
for (size_t i = 0; i < rv.outPk.size(); i++) {
|
||||||
tpool.submit(&waiter, [&, i] {
|
tpool.submit(&waiter, [&, i] {
|
||||||
if (rv.p.rangeSigs.empty())
|
if (rv.p.rangeSigs.empty())
|
||||||
results[i] = bulletproof_VERIFY(rv.p.bulletproofs[i]);
|
results[i] = verBulletproof(rv.p.bulletproofs[i]);
|
||||||
else
|
else
|
||||||
results[i] = verRange(rv.outPk[i].mask, rv.p.rangeSigs[i]);
|
results[i] = verRange(rv.outPk[i].mask, rv.p.rangeSigs[i]);
|
||||||
});
|
});
|
||||||
@ -913,7 +920,7 @@ namespace rct {
|
|||||||
for (size_t i = 0; i < rv.outPk.size(); i++) {
|
for (size_t i = 0; i < rv.outPk.size(); i++) {
|
||||||
tpool.submit(&waiter, [&, i] {
|
tpool.submit(&waiter, [&, i] {
|
||||||
if (rv.p.rangeSigs.empty())
|
if (rv.p.rangeSigs.empty())
|
||||||
results[i] = bulletproof_VERIFY(rv.p.bulletproofs[i]);
|
results[i] = verBulletproof(rv.p.bulletproofs[i]);
|
||||||
else
|
else
|
||||||
results[i] = verRange(rv.outPk[i].mask, rv.p.rangeSigs[i]);
|
results[i] = verRange(rv.outPk[i].mask, rv.p.rangeSigs[i]);
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user