AntonKueltz / fastecdsa

Python library for fast elliptic curve crypto
https://pypi.python.org/pypi/fastecdsa
The Unlicense
264 stars 78 forks source link

[fastecdsa] ECC corner cases #58

Closed bbbrumley closed 4 years ago

bbbrumley commented 4 years ago

Co-authored-by: Luis Rivera-Zamarripa luis.riverazamarripa@tuni.fi Co-authored-by: Jesús-Javier Chi-Domínguez jesus.chidominguez@tuni.fi

Tagging @luinxz and @JJChiDguez for review.

This PR solves 2 defects:

  1. You cannot always reduce scalars modulo curve.q. Only if the input point has order curve.q.
  2. Point doubling did not handle the ord(Q) = 2 case correctly.

Edit: the golden subgroup values in the tests are from sagemath.

AntonKueltz commented 4 years ago

Thanks for identifying these issues and submitting the fixes, I’ll review these tomorrow and get them merged if I don’t see any issues.

AntonKueltz commented 4 years ago

Sorry for the massive delay on merging this and many thanks for the fix!

AntonKueltz commented 4 years ago

For reference, this (and some other fixes) have been released in v2.1.4 on pypi.