Skip to content

Commit

Permalink
rss.ts: Fix point comparison
Browse files Browse the repository at this point in the history
  • Loading branch information
matthiasgeihs committed Feb 28, 2023
1 parent 80ebccb commit b9ec235
Showing 1 changed file with 3 additions and 12 deletions.
15 changes: 3 additions & 12 deletions src/rss.ts
Original file line number Diff line number Diff line change
Expand Up @@ -298,18 +298,10 @@ export class RSSClient {
const temp1 = ecPoint(dkgNewPub).mul(getLagrangeCoeffs([1, target], 1));
const temp2 = mc[0].mul(getLagrangeCoeffs([1, target], target));
const _tssPubKey = temp1.add(temp2);
if (
_tssPubKey.getX().toString(16, 64) !== ecPoint(this.tssPubKey).getX().toString(16, 64) ||
_tssPubKey.getY().toString(16, 64) !== ecPoint(this.tssPubKey).getY().toString(16, 64)
)
throw new Error("master poly commits inconsistent with tssPubKey");
if (!_tssPubKey.eq(ecPoint(this.tssPubKey))) throw new Error("master poly commits inconsistent with tssPubKey");

// check server poly commits are consistent with master poly commits
if (
mc[0].add(mc[1]).getX().toString(16, 64) !== sc[0].getX().toString(16, 64) ||
mc[0].add(mc[1]).getY().toString(16, 64) !== sc[0].getY().toString(16, 64)
)
throw new Error("server poly commits inconsistent with master poly commits");
if (!mc[0].add(mc[1]).eq(sc[0])) throw new Error("server poly commits inconsistent with master poly commits");
return null;
});

Expand All @@ -322,8 +314,7 @@ export class RSSClient {
const { mc } = sums[i];
const gU = ecCurve.g.mul(userShare);
const _gU = mc[0].add(mc[1].mul(new BN(99))); // master poly evaluated at x = 99
if (gU.getX().toString(16, 64) !== _gU.getX().toString(16, 64) || gU.getY().toString(16, 64) !== _gU.getY().toString(16, 64))
throw new Error("decrypted user shares inconsistent with poly commits");
if (!gU.eq(_gU)) throw new Error("decrypted user shares inconsistent with poly commits");
userShares.push(userShare);
}

Expand Down

0 comments on commit b9ec235

Please sign in to comment.