-
Notifications
You must be signed in to change notification settings - Fork 126
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Issue#1675 #1701
Issue#1675 #1701
Conversation
It appears that a modulus was not happening in ec_sub that was causing the odd issue noted in #1675. This commit adds that modulus and fixes it.
I haven't done a full audit of the EC stuff but here are some concerns I saw while poking into this bug:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The fix here looks quite plausible, although I am admittedly not an expert on elliptic curves. I do have one question about the implementation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will fix the reported bug, thank you!
I spent some time looking around in the NIST document with EC algorithms you shared. In that doc, the subtraction algorithm matches what was here previously. I think the missing link is that the doc notes elsewhere that the three coordinates are all field elements, so the mod is implicit.
If we have users who depend on the elliptic curve operations in here, I would recommend making a separate issue to review the full file and bring it closer in line with a reference implementation. The two things I'd focus on are:
- Making sure there are no other places where
BigNum
s are being used as normal numbers instead of the field elements they are supposed to represent. - Reviewing the names and conditions in this file compared to the reference. I noticed a few checks that are either missing or are in different places than I expected, so it might be worth confirming that this is fully correct.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not an export, but the changes seem reasonable to me.
Closes #1675
This seems to be the root cause bug, but I think there are some other improvements @marsella had in mind as well that we should go ahead and get in.