Skip to content

Commit 069cb66

Browse files
committed
crypto/bn256: fix go vet false positive
Also add the package to the license tool ignore list.
1 parent e1e87d8 commit 069cb66

File tree

5 files changed

+25
-22
lines changed

5 files changed

+25
-22
lines changed

build/update-license.go

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,14 @@ var (
4747
// boring stuff
4848
"vendor/", "tests/files/", "build/",
4949
// don't relicense vendored sources
50-
"crypto/sha3/", "crypto/ecies/", "log/",
51-
"crypto/secp256k1/curve.go",
50+
"cmd/internal/browser",
5251
"consensus/ethash/xor.go",
52+
"crypto/bn256/",
53+
"crypto/ecies/",
54+
"crypto/secp256k1/curve.go",
55+
"crypto/sha3/",
5356
"internal/jsre/deps",
54-
"cmd/internal/browser",
57+
"log/",
5558
// don't license generated files
5659
"contracts/chequebook/contract/",
5760
"contracts/ens/contract/",

crypto/bn256/curve.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -186,14 +186,14 @@ func (c *curvePoint) Double(a *curvePoint, pool *bnPool) {
186186
A.Mod(A, P)
187187
B := pool.Get().Mul(a.y, a.y)
188188
B.Mod(B, P)
189-
C := pool.Get().Mul(B, B)
190-
C.Mod(C, P)
189+
C_ := pool.Get().Mul(B, B)
190+
C_.Mod(C_, P)
191191

192192
t := pool.Get().Add(a.x, B)
193193
t2 := pool.Get().Mul(t, t)
194194
t2.Mod(t2, P)
195195
t.Sub(t2, A)
196-
t2.Sub(t, C)
196+
t2.Sub(t, C_)
197197
d := pool.Get().Add(t2, t2)
198198
t.Add(A, A)
199199
e := pool.Get().Add(t, A)
@@ -203,7 +203,7 @@ func (c *curvePoint) Double(a *curvePoint, pool *bnPool) {
203203
t.Add(d, d)
204204
c.x.Sub(f, t)
205205

206-
t.Add(C, C)
206+
t.Add(C_, C_)
207207
t2.Add(t, t)
208208
t.Add(t2, t2)
209209
c.y.Sub(d, c.x)
@@ -217,7 +217,7 @@ func (c *curvePoint) Double(a *curvePoint, pool *bnPool) {
217217

218218
pool.Put(A)
219219
pool.Put(B)
220-
pool.Put(C)
220+
pool.Put(C_)
221221
pool.Put(t)
222222
pool.Put(t2)
223223
pool.Put(d)

crypto/bn256/gfp6.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -266,13 +266,13 @@ func (e *gfP6) Invert(a *gfP6, pool *bnPool) *gfP6 {
266266
t1.Mul(a.y, a.z, pool)
267267
B.Sub(B, t1)
268268

269-
C := newGFp2(pool)
270-
C.Square(a.y, pool)
269+
C_ := newGFp2(pool)
270+
C_.Square(a.y, pool)
271271
t1.Mul(a.x, a.z, pool)
272-
C.Sub(C, t1)
272+
C_.Sub(C_, t1)
273273

274274
F := newGFp2(pool)
275-
F.Mul(C, a.y, pool)
275+
F.Mul(C_, a.y, pool)
276276
F.MulXi(F, pool)
277277
t1.Mul(A, a.z, pool)
278278
F.Add(F, t1)
@@ -282,14 +282,14 @@ func (e *gfP6) Invert(a *gfP6, pool *bnPool) *gfP6 {
282282

283283
F.Invert(F, pool)
284284

285-
e.x.Mul(C, F, pool)
285+
e.x.Mul(C_, F, pool)
286286
e.y.Mul(B, F, pool)
287287
e.z.Mul(A, F, pool)
288288

289289
t1.Put(pool)
290290
A.Put(pool)
291291
B.Put(pool)
292-
C.Put(pool)
292+
C_.Put(pool)
293293
F.Put(pool)
294294

295295
return e

crypto/bn256/optate.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -88,12 +88,12 @@ func lineFunctionDouble(r *twistPoint, q *curvePoint, pool *bnPool) (a, b, c *gf
8888

8989
A := newGFp2(pool).Square(r.x, pool)
9090
B := newGFp2(pool).Square(r.y, pool)
91-
C := newGFp2(pool).Square(B, pool)
91+
C_ := newGFp2(pool).Square(B, pool)
9292

9393
D := newGFp2(pool).Add(r.x, B)
9494
D.Square(D, pool)
9595
D.Sub(D, A)
96-
D.Sub(D, C)
96+
D.Sub(D, C_)
9797
D.Add(D, D)
9898

9999
E := newGFp2(pool).Add(A, A)
@@ -112,7 +112,7 @@ func lineFunctionDouble(r *twistPoint, q *curvePoint, pool *bnPool) (a, b, c *gf
112112

113113
rOut.y.Sub(D, rOut.x)
114114
rOut.y.Mul(rOut.y, E, pool)
115-
t := newGFp2(pool).Add(C, C)
115+
t := newGFp2(pool).Add(C_, C_)
116116
t.Add(t, t)
117117
t.Add(t, t)
118118
rOut.y.Sub(rOut.y, t)
@@ -142,7 +142,7 @@ func lineFunctionDouble(r *twistPoint, q *curvePoint, pool *bnPool) (a, b, c *gf
142142

143143
A.Put(pool)
144144
B.Put(pool)
145-
C.Put(pool)
145+
C_.Put(pool)
146146
D.Put(pool)
147147
E.Put(pool)
148148
G.Put(pool)

crypto/bn256/twist.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -165,12 +165,12 @@ func (c *twistPoint) Double(a *twistPoint, pool *bnPool) {
165165
// See http://hyperelliptic.org/EFD/g1p/auto-code/shortw/jacobian-0/doubling/dbl-2009-l.op3
166166
A := newGFp2(pool).Square(a.x, pool)
167167
B := newGFp2(pool).Square(a.y, pool)
168-
C := newGFp2(pool).Square(B, pool)
168+
C_ := newGFp2(pool).Square(B, pool)
169169

170170
t := newGFp2(pool).Add(a.x, B)
171171
t2 := newGFp2(pool).Square(t, pool)
172172
t.Sub(t2, A)
173-
t2.Sub(t, C)
173+
t2.Sub(t, C_)
174174
d := newGFp2(pool).Add(t2, t2)
175175
t.Add(A, A)
176176
e := newGFp2(pool).Add(t, A)
@@ -179,7 +179,7 @@ func (c *twistPoint) Double(a *twistPoint, pool *bnPool) {
179179
t.Add(d, d)
180180
c.x.Sub(f, t)
181181

182-
t.Add(C, C)
182+
t.Add(C_, C_)
183183
t2.Add(t, t)
184184
t.Add(t2, t2)
185185
c.y.Sub(d, c.x)
@@ -191,7 +191,7 @@ func (c *twistPoint) Double(a *twistPoint, pool *bnPool) {
191191

192192
A.Put(pool)
193193
B.Put(pool)
194-
C.Put(pool)
194+
C_.Put(pool)
195195
t.Put(pool)
196196
t2.Put(pool)
197197
d.Put(pool)

0 commit comments

Comments
 (0)