File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -43,7 +43,7 @@ func (c *twistPoint) Set(a *twistPoint) {
4343 c .t .Set (& a .t )
4444}
4545
46- // IsOnCurve returns true iff c is on the curve.
46+ // IsOnCurve returns true iff c is on the curve and is in the correct subgroup .
4747func (c * twistPoint ) IsOnCurve () bool {
4848 c .MakeAffine ()
4949 if c .IsInfinity () {
@@ -57,6 +57,8 @@ func (c *twistPoint) IsOnCurve() bool {
5757 if * y2 != * x3 {
5858 return false
5959 }
60+ // Subgroup check: multiply the point by the group order and
61+ // verify that it becomes the point at infinity.
6062 cneg := & twistPoint {}
6163 cneg .Mul (c , Order )
6264 return cneg .z .IsZero ()
Original file line number Diff line number Diff line change @@ -67,7 +67,7 @@ func (c *twistPoint) Set(a *twistPoint) {
6767 c .t .Set (a .t )
6868}
6969
70- // IsOnCurve returns true iff c is on the curve where c must be in affine form.
70+ // IsOnCurve returns true iff c is on the curve and is in the correct subgroup, where c must be in affine form.
7171func (c * twistPoint ) IsOnCurve () bool {
7272 pool := new (bnPool )
7373 yy := newGFp2 (pool ).Square (c .y , pool )
@@ -80,6 +80,8 @@ func (c *twistPoint) IsOnCurve() bool {
8080 if yy .x .Sign () != 0 || yy .y .Sign () != 0 {
8181 return false
8282 }
83+ // Subgroup check: multiply the point by the group order and
84+ // verify that it becomes the point at infinity.
8385 cneg := newTwistPoint (pool )
8486 cneg .Mul (c , Order , pool )
8587 return cneg .z .IsZero ()
You can’t perform that action at this time.
0 commit comments