Skip to content

Commit

Permalink
Fixed negation of Ed25519 points
Browse files Browse the repository at this point in the history
  • Loading branch information
Legrandin committed Jun 19, 2024
1 parent d984da4 commit 97bf178
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
1 change: 1 addition & 0 deletions Changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ Under development
the GMP library will not be used even if detected.
* Remove support for Python 3.5
* GH#814: RSA keys for PSS can be imported.
* GH#810: fixed negation of Ed25519 points

3.20.0 (9 January 2024)
++++++++++++++++++++++++++
Expand Down
9 changes: 7 additions & 2 deletions lib/Crypto/SelfTest/PublicKey/test_ECC_Ed25519.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,13 @@ def test_pai(self):

def test_negate(self):
negG = -self.pointG
sum = self.pointG + negG
self.assertTrue(sum.is_point_at_infinity())
G100 = self.pointG * 100
sum_zero = G100 + negG * 100
self.assertTrue(sum_zero.is_point_at_infinity())

sum_99 = G100 + negG
expected = self.pointG * 99
self.assertEqual(sum_99, expected)

def test_addition(self):
self.assertEqual(self.pointG + self.pointG2, self.pointG3)
Expand Down
1 change: 1 addition & 0 deletions src/ed25519.c
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,7 @@ EXPORT_SYM int ed25519_neg(Point *p)
const uint32_t zero[10] = { 0 };

sub_25519(p->X, zero, p->X);
sub_25519(p->T, zero, p->T);
return 0;
}

Expand Down

0 comments on commit 97bf178

Please sign in to comment.