-
Notifications
You must be signed in to change notification settings - Fork 181
Fixes several errors on twisted Edwards curves. #545
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
Merged
+228
−36
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
ec07dd6
ed25519: Test for isEqual must fail on points with z=0.
armfazh e563bc8
ed25519: Fix isEqual to handle points with Z=0.
armfazh bcb7cfb
goldilocks: Test for IsEqual must fail with Z=0
armfazh 187c4c1
goldilocks; Handling points with z=0.
armfazh b95bf64
fourq: Test showing isEqual and IsOnCurve fail.
armfazh 91e017a
fourq: Handle the case of Z=0 for IsOnCurve and IsEqual.
armfazh 6115e82
fourq: Test showing point unmarshal fails.
armfazh 719f7d8
fourq: Correctly unmarshalling point.
armfazh d4b4a34
curve4q: Test showing DH does not fails on identity point.
armfazh e978fe3
curve4q: Shared must fail with low order points.
armfazh File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -18,6 +18,9 @@ func (Curve) Identity() *Point { | |
| func (Curve) IsOnCurve(P *Point) bool { | ||
| x2, y2, t, t2, z2 := &fp.Elt{}, &fp.Elt{}, &fp.Elt{}, &fp.Elt{}, &fp.Elt{} | ||
| rhs, lhs := &fp.Elt{}, &fp.Elt{} | ||
| // Check z != 0 | ||
| eq0 := !fp.IsZero(&P.z) | ||
|
|
||
| fp.Mul(t, &P.ta, &P.tb) // t = ta*tb | ||
| fp.Sqr(x2, &P.x) // x^2 | ||
| fp.Sqr(y2, &P.y) // y^2 | ||
|
|
@@ -27,13 +30,14 @@ func (Curve) IsOnCurve(P *Point) bool { | |
| fp.Mul(rhs, t2, ¶mD) // dt^2 | ||
| fp.Add(rhs, rhs, z2) // z^2 + dt^2 | ||
| fp.Sub(lhs, lhs, rhs) // x^2 + y^2 - (z^2 + dt^2) | ||
| eq0 := fp.IsZero(lhs) | ||
| eq1 := fp.IsZero(lhs) | ||
|
|
||
| fp.Mul(lhs, &P.x, &P.y) // xy | ||
| fp.Mul(rhs, t, &P.z) // tz | ||
| fp.Sub(lhs, lhs, rhs) // xy - tz | ||
| eq1 := fp.IsZero(lhs) | ||
| return eq0 && eq1 | ||
| eq2 := fp.IsZero(lhs) | ||
|
|
||
| return eq0 && eq1 && eq2 | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. About commit Reviewer note: this is fine not to be constant-time, it is only used in tests or in |
||
| } | ||
|
|
||
| // Generator returns the generator point. | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.