Skip to content

Commit 6ff0ae2

Browse files
committed
crypto/elliptic: fix typo in p521Point type name
Change-Id: I6cab3624c875d9a70441a560e84f91c9b2df17b9 Reviewed-on: https://go-review.googlesource.com/c/go/+/320070 Trust: Filippo Valsorda <filippo@golang.org> Trust: Katie Hockman <katie@golang.org> Run-TryBot: Filippo Valsorda <filippo@golang.org> Run-TryBot: Katie Hockman <katie@golang.org> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Katie Hockman <katie@golang.org>
1 parent 3075ffc commit 6ff0ae2

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

src/crypto/elliptic/p521.go

+9-9
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ func (curve p521Curve) IsOnCurve(x, y *big.Int) bool {
5252
return x3.Equal(y2) == 1
5353
}
5454

55-
type p512Point struct {
55+
type p521Point struct {
5656
x, y, z *fiat.P521Element
5757
}
5858

@@ -67,7 +67,7 @@ func fiatP521ToBigInt(x *fiat.P521Element) *big.Int {
6767
// affineFromJacobian brings a point in Jacobian coordinates back to affine
6868
// coordinates, with (0, 0) representing infinity by convention. It also goes
6969
// 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) {
7171
if p.z.IsZero() == 1 {
7272
return new(big.Int), new(big.Int)
7373
}
@@ -99,17 +99,17 @@ func bigIntToFiatP521(x *big.Int) *fiat.P521Element {
9999
// jacobianFromAffine converts (x, y) affine coordinates into (x, y, z) Jacobian
100100
// coordinates. It also converts from big.Int to fiat, which is necessarily a
101101
// 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 {
103103
// (0, 0) is by convention the point at infinity, which can't be represented
104104
// in affine coordinates, but is (0, 0, 0) in Jacobian.
105105
if x.Sign() == 0 && y.Sign() == 0 {
106-
return &p512Point{
106+
return &p521Point{
107107
x: new(fiat.P521Element),
108108
y: new(fiat.P521Element),
109109
z: new(fiat.P521Element),
110110
}
111111
}
112-
return &p512Point{
112+
return &p521Point{
113113
x: bigIntToFiatP521(x),
114114
y: bigIntToFiatP521(y),
115115
z: new(fiat.P521Element).One(),
@@ -123,7 +123,7 @@ func (curve p521Curve) Add(x1, y1, x2, y2 *big.Int) (*big.Int, *big.Int) {
123123
}
124124

125125
// 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 {
127127
// https://hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-3.html#addition-add-2007-bl
128128
z1IsZero := p1.z.IsZero()
129129
z2IsZero := p2.z.IsZero()
@@ -189,7 +189,7 @@ func (curve p521Curve) Double(x1, y1 *big.Int) (*big.Int, *big.Int) {
189189
}
190190

191191
// 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 {
193193
// https://hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-3.html#doubling-dbl-2001-b
194194
delta := new(fiat.P521Element).Square(p.z)
195195
gamma := new(fiat.P521Element).Square(p.y)
@@ -230,11 +230,11 @@ func (q *p512Point) doubleJacobian(p *p512Point) *p512Point {
230230

231231
func (curve p521Curve) ScalarMult(Bx, By *big.Int, scalar []byte) (*big.Int, *big.Int) {
232232
B := curve.jacobianFromAffine(Bx, By)
233-
p, t := &p512Point{
233+
p, t := &p521Point{
234234
x: new(fiat.P521Element),
235235
y: new(fiat.P521Element),
236236
z: new(fiat.P521Element),
237-
}, &p512Point{
237+
}, &p521Point{
238238
x: new(fiat.P521Element),
239239
y: new(fiat.P521Element),
240240
z: new(fiat.P521Element),

0 commit comments

Comments
 (0)