Skip to content

Commit

Permalink
Updates from security audit
Browse files Browse the repository at this point in the history
  • Loading branch information
SarangNoether committed Feb 12, 2021
1 parent 2d287f6 commit 0c6dfc9
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/ringct/bulletproofs_plus.cc
Expand Up @@ -224,9 +224,9 @@ namespace rct
// Output (1,x,x**2,...,x**{n-1})
static rct::keyV vector_of_scalar_powers(const rct::key &x, size_t n)
{
CHECK_AND_ASSERT_THROW_MES(n != 0, "Need n > 0");

rct::keyV res(n);
if (n == 0)
return res;
res[0] = rct::identity();
if (n == 1)
return res;
Expand All @@ -244,6 +244,7 @@ namespace rct
static rct::key sum_of_even_powers(const rct::key &x, size_t n)
{
CHECK_AND_ASSERT_THROW_MES((n & (n - 1)) == 0, "Need n to be a power of 2");
CHECK_AND_ASSERT_THROW_MES(n != 0, "Need n > 0");

rct::key x1 = copy(x);
sc_mul(x1.bytes, x1.bytes, x1.bytes);
Expand All @@ -264,6 +265,8 @@ namespace rct
// Output x**1 + x**2 + x**3 + ... + x**n
static rct::key sum_of_scalar_powers(const rct::key &x, size_t n)
{
CHECK_AND_ASSERT_THROW_MES(n != 0, "Need n > 0");

rct::key res = ONE;
if (n == 1)
return res;
Expand Down Expand Up @@ -764,6 +767,11 @@ namespace rct
rct::addKeys2(B, temp2, temp, rct::H);

rct::key e = transcript_update(transcript, A1, B);
if (e == rct::zero())
{
MINFO("e is 0, trying again");
goto try_again;
}
rct::key e_squared;
sc_mul(e_squared.bytes, e.bytes, e.bytes);

Expand Down

0 comments on commit 0c6dfc9

Please sign in to comment.