Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/ecdsa/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
BRAINPOOLP320r1,
BRAINPOOLP384r1,
BRAINPOOLP512r1,
Wei25519,
)
from .ecdh import (
ECDH,
Expand Down Expand Up @@ -72,5 +73,6 @@
BRAINPOOLP320r1,
BRAINPOOLP384r1,
BRAINPOOLP512r1,
Wei25519,
]
del _hush_pyflakes
9 changes: 9 additions & 0 deletions src/ecdsa/curves.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
"BRAINPOOLP320r1",
"BRAINPOOLP384r1",
"BRAINPOOLP512r1",
"Wei25519"
]


Expand Down Expand Up @@ -166,6 +167,13 @@ def __repr__(self):
"brainpoolP512r1",
)

# TODO: Correct the oid and openssl_name
# TODO: Compose Unit-tests
Wei25519 = Curve("Wei25519",
ecdsa.curve_wei_25519,
ecdsa.generator_wei_25519,
(1, 3, 101, 110),
"wei25519")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if a curve isn't supported in OpenSSL we shouldn't add its openssl_name, it's just that we didn't have curves like that before, so the test suite can't handle it correctly—i.e. empty openssl_name should be supported in test suite, the fact it's not is a bug


curves = [
NIST192p,
Expand All @@ -181,6 +189,7 @@ def __repr__(self):
BRAINPOOLP320r1,
BRAINPOOLP384r1,
BRAINPOOLP512r1,
Wei25519,
]


Expand Down
13 changes: 13 additions & 0 deletions src/ecdsa/ecdsa.py
Original file line number Diff line number Diff line change
Expand Up @@ -467,3 +467,16 @@ def point_is_valid(generator, x, y):
generator_brainpoolp512r1 = ellipticcurve.PointJacobi(
curve_brainpoolp512r1, _Gx, _Gy, 1, _q, generator=True
)

# Weierstass Curve 25519
_a = 0x2aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa984914a144
_b = 0x7b425ed097b425ed097b425ed097b425ed097b425ed097b4260b5e9c7710c864
_p = 0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffed
_Gx = 0x2aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaad245a
_Gy = 0x20ae19a1b8a086b4e01edd2c7748d14c923d4d7e6d7c61b229e9c5a27eced3d9
_r = 0x1000000000000000000000000000000014def9dea2f79cd65812631a5cf5d3ed
_h = 8

curve_wei_25519 = ellipticcurve.CurveFp(_p, _a, _b, _h)
generator_wei_25519 = ellipticcurve.PointJacobi(
curve_wei_25519, _Gx, _Gy, 1, _r, generator=True)