Closed hwwhww closed 3 years ago
Can you look at giving me some guidance on whether we should be backporting this to older releases?
@pipermerriam IMHO no need to backport it to the older releases since we haven't found this edge case in our normal usage.
Are ya'll ready for a release with this in it?
@pipermerriam
I may have some minor updates in the queue that could be included in the next release together this week.
What was wrong?
Bounty hunter Nguyen Thoi Minh Quan found this issue:
Output:
How was it fixed?
Nguyen Thoi Minh Quan: https://github.com/ethereum/py_ecc/blob/dd38b1f1b092989095b75baec4987347086fd962/py_ecc/utils.py#L24 Assign a = a % n in the 1st line of the function prime_field_inv
My first quick scan is that this edge case would not happen via BLS API calls. Also, py-ecc is not a constant-time implementation. Anyway, good to be more careful. 👍
secp256k1
also has aninv
function.https://github.com/ethereum/py_ecc/blob/dd38b1f1b092989095b75baec4987347086fd962/py_ecc/secp256k1/secp256k1.py#L46-L56
However, unlike BLS, the
a == n
case is undefined here so I didn't change this function./cc @JustinDrake