@@ -52,7 +52,7 @@ func (curve p521Curve) IsOnCurve(x, y *big.Int) bool {
52
52
return x3 .Equal (y2 ) == 1
53
53
}
54
54
55
- type p512Point struct {
55
+ type p521Point struct {
56
56
x , y , z * fiat.P521Element
57
57
}
58
58
@@ -67,7 +67,7 @@ func fiatP521ToBigInt(x *fiat.P521Element) *big.Int {
67
67
// affineFromJacobian brings a point in Jacobian coordinates back to affine
68
68
// coordinates, with (0, 0) representing infinity by convention. It also goes
69
69
// back to big.Int values to match the exposed API.
70
- func (curve p521Curve ) affineFromJacobian (p * p512Point ) (x , y * big.Int ) {
70
+ func (curve p521Curve ) affineFromJacobian (p * p521Point ) (x , y * big.Int ) {
71
71
if p .z .IsZero () == 1 {
72
72
return new (big.Int ), new (big.Int )
73
73
}
@@ -99,17 +99,17 @@ func bigIntToFiatP521(x *big.Int) *fiat.P521Element {
99
99
// jacobianFromAffine converts (x, y) affine coordinates into (x, y, z) Jacobian
100
100
// coordinates. It also converts from big.Int to fiat, which is necessarily a
101
101
// messy and variable-time operation, which we can't avoid due to the exposed API.
102
- func (curve p521Curve ) jacobianFromAffine (x , y * big.Int ) * p512Point {
102
+ func (curve p521Curve ) jacobianFromAffine (x , y * big.Int ) * p521Point {
103
103
// (0, 0) is by convention the point at infinity, which can't be represented
104
104
// in affine coordinates, but is (0, 0, 0) in Jacobian.
105
105
if x .Sign () == 0 && y .Sign () == 0 {
106
- return & p512Point {
106
+ return & p521Point {
107
107
x : new (fiat.P521Element ),
108
108
y : new (fiat.P521Element ),
109
109
z : new (fiat.P521Element ),
110
110
}
111
111
}
112
- return & p512Point {
112
+ return & p521Point {
113
113
x : bigIntToFiatP521 (x ),
114
114
y : bigIntToFiatP521 (y ),
115
115
z : new (fiat.P521Element ).One (),
@@ -123,7 +123,7 @@ func (curve p521Curve) Add(x1, y1, x2, y2 *big.Int) (*big.Int, *big.Int) {
123
123
}
124
124
125
125
// addJacobian sets q = p1 + p2, and returns q. The points may overlap.
126
- func (q * p512Point ) addJacobian (p1 , p2 * p512Point ) * p512Point {
126
+ func (q * p521Point ) addJacobian (p1 , p2 * p521Point ) * p521Point {
127
127
// https://hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-3.html#addition-add-2007-bl
128
128
z1IsZero := p1 .z .IsZero ()
129
129
z2IsZero := p2 .z .IsZero ()
@@ -189,7 +189,7 @@ func (curve p521Curve) Double(x1, y1 *big.Int) (*big.Int, *big.Int) {
189
189
}
190
190
191
191
// doubleJacobian sets q = p + p, and returns q. The points may overlap.
192
- func (q * p512Point ) doubleJacobian (p * p512Point ) * p512Point {
192
+ func (q * p521Point ) doubleJacobian (p * p521Point ) * p521Point {
193
193
// https://hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-3.html#doubling-dbl-2001-b
194
194
delta := new (fiat.P521Element ).Square (p .z )
195
195
gamma := new (fiat.P521Element ).Square (p .y )
@@ -230,11 +230,11 @@ func (q *p512Point) doubleJacobian(p *p512Point) *p512Point {
230
230
231
231
func (curve p521Curve ) ScalarMult (Bx , By * big.Int , scalar []byte ) (* big.Int , * big.Int ) {
232
232
B := curve .jacobianFromAffine (Bx , By )
233
- p , t := & p512Point {
233
+ p , t := & p521Point {
234
234
x : new (fiat.P521Element ),
235
235
y : new (fiat.P521Element ),
236
236
z : new (fiat.P521Element ),
237
- }, & p512Point {
237
+ }, & p521Point {
238
238
x : new (fiat.P521Element ),
239
239
y : new (fiat.P521Element ),
240
240
z : new (fiat.P521Element ),
0 commit comments