mirror of
https://git.wownero.com/wownero/wownero.git
synced 2024-08-15 01:03:23 +00:00
ringct: error out when hashToPoint* returns the point at infinity
Reported by QuarksLab.
This commit is contained in:
parent
d1591853bf
commit
7ed496cc78
2 changed files with 4 additions and 1 deletions
|
@ -130,7 +130,9 @@ static rct::key get_exponent(const rct::key &base, size_t idx)
|
||||||
{
|
{
|
||||||
static const std::string salt("bulletproof");
|
static const std::string salt("bulletproof");
|
||||||
std::string hashed = std::string((const char*)base.bytes, sizeof(base)) + salt + tools::get_varint_data(idx);
|
std::string hashed = std::string((const char*)base.bytes, sizeof(base)) + salt + tools::get_varint_data(idx);
|
||||||
return rct::hashToPoint(rct::hash2rct(crypto::cn_fast_hash(hashed.data(), hashed.size())));
|
const rct::key e = rct::hashToPoint(rct::hash2rct(crypto::cn_fast_hash(hashed.data(), hashed.size())));
|
||||||
|
CHECK_AND_ASSERT_THROW_MES(!(e == rct::identity()), "Exponent is point at infinity");
|
||||||
|
return e;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void init_exponents()
|
static void init_exponents()
|
||||||
|
|
|
@ -277,6 +277,7 @@ namespace rct {
|
||||||
for (j = 0; j < dsRows; j++) {
|
for (j = 0; j < dsRows; j++) {
|
||||||
addKeys2(L, rv.ss[i][j], c_old, pk[i][j]);
|
addKeys2(L, rv.ss[i][j], c_old, pk[i][j]);
|
||||||
hashToPoint(Hi, pk[i][j]);
|
hashToPoint(Hi, pk[i][j]);
|
||||||
|
CHECK_AND_ASSERT_MES(!(Hi == rct::identity()), false, "Data hashed to point at infinity");
|
||||||
addKeys3(R, rv.ss[i][j], Hi, c_old, Ip[j].k);
|
addKeys3(R, rv.ss[i][j], Hi, c_old, Ip[j].k);
|
||||||
toHash[3 * j + 1] = pk[i][j];
|
toHash[3 * j + 1] = pk[i][j];
|
||||||
toHash[3 * j + 2] = L;
|
toHash[3 * j + 2] = L;
|
||||||
|
|
Loading…
Reference in a new issue