Skip to content
Merged
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
8 changes: 6 additions & 2 deletions src/ecdsa/ellipticcurve.py
Original file line number Diff line number Diff line change
Expand Up @@ -619,8 +619,12 @@ def mul_add(self, self_mul, other, other_mul):
X1, Y1 = self.__x, self.__y
other = other.scale()
X2, Y2 = other.__x, other.__y
both = (self + other).scale()
X4, Y4 = both.__x, both.__y
both = self + other
if both is INFINITY:
X4, Y4 = 0, 0
else:
both.scale()
X4, Y4 = both.__x, both.__y
_double = self._double
_add = self._add
while i > 1:
Expand Down
8 changes: 8 additions & 0 deletions src/ecdsa/test_keys.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
sigdecode_der,
sigdecode_strings,
)
from .curves import NIST256p


class TestVerifyingKeyFromString(unittest.TestCase):
Expand Down Expand Up @@ -408,3 +409,10 @@ def test_SigningKey_sign_digest(convert):
sig = sk.sign_digest(convert(data_hash))

vk.verify(sig, data)


def test_SigningKey_with_unlikely_value():
sk = SigningKey.from_secret_exponent(NIST256p.order - 1, curve=NIST256p)
vk = sk.verifying_key
sig = sk.sign(b"hello")
assert vk.verify(sig, b"hello")