dusk-network / dusk-zerocaf

Zerocaf: A library built for EC operations in Zero Knowledge.
https://dusk.network/
MIT License
53 stars 11 forks source link

Refactor Ristretto Point operations. #79

Closed CPerezz closed 5 years ago

CPerezz commented 5 years ago

Reviewing the Ristretto implementation, and working also on #78 and #76 at the same time, I realized that the implementation done for Ristretto Point ops was not correct because:

The operations are mapped to the underlying EdwardsPoint that the RistrettoPoint represents (A RistrettoPoint is a wrapper type over EdwardsPoint).

This is correct, if you're working with an a and d values that satisfy the Ristretto constraints/requirements (a-d) is Quadratic Residue. But in our case, since we chose the @ebfull tweet parameters which do not satisfy the Ristretto req. we also use another d value for our RistrettoPoint which is different from the one used on EdwardsPoint formulas.

This causes:

That second thing was not considered at the beginning and so we need to refactor it.

CPerezz commented 5 years ago

With e935456:

CPerezz commented 5 years ago

Tests implemented in 252f782 proved that Addp and Mul impl are working as expected.