Lines Matching refs:pool

7 func lineFunctionAdd(r, p *twistPoint, q *curvePoint, r2 *gfP2, pool *bnPool) (a, b, c *gfP2, rOut …
11 B := newGFp2(pool).Mul(p.x, r.t, pool)
13 D := newGFp2(pool).Add(p.y, r.z)
14 D.Square(D, pool)
17 D.Mul(D, r.t, pool)
19 H := newGFp2(pool).Sub(B, r.x)
20 I := newGFp2(pool).Square(H, pool)
22 E := newGFp2(pool).Add(I, I)
25 J := newGFp2(pool).Mul(H, E, pool)
27 L1 := newGFp2(pool).Sub(D, r.y)
30 V := newGFp2(pool).Mul(r.x, E, pool)
32 rOut = newTwistPoint(pool)
33 rOut.x.Square(L1, pool)
39 rOut.z.Square(rOut.z, pool)
43 t := newGFp2(pool).Sub(V, rOut.x)
44 t.Mul(t, L1, pool)
45 t2 := newGFp2(pool).Mul(r.y, J, pool)
49 rOut.t.Square(rOut.z, pool)
52 t.Square(t, pool)
56 t2.Mul(L1, p.x, pool)
58 a = newGFp2(pool)
61 c = newGFp2(pool)
65 b = newGFp2(pool)
71 B.Put(pool)
72 D.Put(pool)
73 H.Put(pool)
74 I.Put(pool)
75 E.Put(pool)
76 J.Put(pool)
77 L1.Put(pool)
78 V.Put(pool)
79 t.Put(pool)
80 t2.Put(pool)
85 func lineFunctionDouble(r *twistPoint, q *curvePoint, pool *bnPool) (a, b, c *gfP2, rOut *twistPoin…
89 A := newGFp2(pool).Square(r.x, pool)
90 B := newGFp2(pool).Square(r.y, pool)
91 C := newGFp2(pool).Square(B, pool)
93 D := newGFp2(pool).Add(r.x, B)
94 D.Square(D, pool)
99 E := newGFp2(pool).Add(A, A)
102 G := newGFp2(pool).Square(E, pool)
104 rOut = newTwistPoint(pool)
109 rOut.z.Square(rOut.z, pool)
114 rOut.y.Mul(rOut.y, E, pool)
115 t := newGFp2(pool).Add(C, C)
120 rOut.t.Square(rOut.z, pool)
122 t.Mul(E, r.t, pool)
124 b = newGFp2(pool)
129 a = newGFp2(pool)
131 a.Square(a, pool)
138 c = newGFp2(pool)
139 c.Mul(rOut.z, r.t, pool)
143 A.Put(pool)
144 B.Put(pool)
145 C.Put(pool)
146 D.Put(pool)
147 E.Put(pool)
148 G.Put(pool)
149 t.Put(pool)
154 func mulLine(ret *gfP12, a, b, c *gfP2, pool *bnPool) {
155 a2 := newGFp6(pool)
159 a2.Mul(a2, ret.x, pool)
160 t3 := newGFp6(pool).MulScalar(ret.y, c, pool)
162 t := newGFp2(pool)
164 t2 := newGFp6(pool)
172 ret.x.Mul(ret.x, t2, pool)
175 a2.MulTau(a2, pool)
178 a2.Put(pool)
179 t3.Put(pool)
180 t2.Put(pool)
181 t.Put(pool)
189 func miller(q *twistPoint, p *curvePoint, pool *bnPool) *gfP12 {
190 ret := newGFp12(pool)
193 aAffine := newTwistPoint(pool)
195 aAffine.MakeAffine(pool)
197 bAffine := newCurvePoint(pool)
199 bAffine.MakeAffine(pool)
201 minusA := newTwistPoint(pool)
202 minusA.Negative(aAffine, pool)
204 r := newTwistPoint(pool)
207 r2 := newGFp2(pool)
208 r2.Square(aAffine.y, pool)
211 a, b, c, newR := lineFunctionDouble(r, bAffine, pool)
213 ret.Square(ret, pool)
216 mulLine(ret, a, b, c, pool)
217 a.Put(pool)
218 b.Put(pool)
219 c.Put(pool)
220 r.Put(pool)
225 a, b, c, newR = lineFunctionAdd(r, aAffine, bAffine, r2, pool)
227 a, b, c, newR = lineFunctionAdd(r, minusA, bAffine, r2, pool)
232 mulLine(ret, a, b, c, pool)
233 a.Put(pool)
234 b.Put(pool)
235 c.Put(pool)
236 r.Put(pool)
255 q1 := newTwistPoint(pool)
257 q1.x.Mul(q1.x, xiToPMinus1Over3, pool)
259 q1.y.Mul(q1.y, xiToPMinus1Over2, pool)
269 minusQ2 := newTwistPoint(pool)
275 r2.Square(q1.y, pool)
276 a, b, c, newR := lineFunctionAdd(r, q1, bAffine, r2, pool)
277 mulLine(ret, a, b, c, pool)
278 a.Put(pool)
279 b.Put(pool)
280 c.Put(pool)
281 r.Put(pool)
284 r2.Square(minusQ2.y, pool)
285 a, b, c, newR = lineFunctionAdd(r, minusQ2, bAffine, r2, pool)
286 mulLine(ret, a, b, c, pool)
287 a.Put(pool)
288 b.Put(pool)
289 c.Put(pool)
290 r.Put(pool)
293 aAffine.Put(pool)
294 bAffine.Put(pool)
295 minusA.Put(pool)
296 r.Put(pool)
297 r2.Put(pool)
305 func finalExponentiation(in *gfP12, pool *bnPool) *gfP12 {
306 t1 := newGFp12(pool)
312 inv := newGFp12(pool)
313 inv.Invert(in, pool)
314 t1.Mul(t1, inv, pool)
316 t2 := newGFp12(pool).FrobeniusP2(t1, pool)
317 t1.Mul(t1, t2, pool)
319 fp := newGFp12(pool).Frobenius(t1, pool)
320 fp2 := newGFp12(pool).FrobeniusP2(t1, pool)
321 fp3 := newGFp12(pool).Frobenius(fp2, pool)
323 fu, fu2, fu3 := newGFp12(pool), newGFp12(pool), newGFp12(pool)
324 fu.Exp(t1, u, pool)
325 fu2.Exp(fu, u, pool)
326 fu3.Exp(fu2, u, pool)
328 y3 := newGFp12(pool).Frobenius(fu, pool)
329 fu2p := newGFp12(pool).Frobenius(fu2, pool)
330 fu3p := newGFp12(pool).Frobenius(fu3, pool)
331 y2 := newGFp12(pool).FrobeniusP2(fu2, pool)
333 y0 := newGFp12(pool)
334 y0.Mul(fp, fp2, pool)
335 y0.Mul(y0, fp3, pool)
337 y1, y4, y5 := newGFp12(pool), newGFp12(pool), newGFp12(pool)
341 y4.Mul(fu, fu2p, pool)
344 y6 := newGFp12(pool)
345 y6.Mul(fu3, fu3p, pool)
348 t0 := newGFp12(pool)
349 t0.Square(y6, pool)
350 t0.Mul(t0, y4, pool)
351 t0.Mul(t0, y5, pool)
352 t1.Mul(y3, y5, pool)
353 t1.Mul(t1, t0, pool)
354 t0.Mul(t0, y2, pool)
355 t1.Square(t1, pool)
356 t1.Mul(t1, t0, pool)
357 t1.Square(t1, pool)
358 t0.Mul(t1, y1, pool)
359 t1.Mul(t1, y0, pool)
360 t0.Square(t0, pool)
361 t0.Mul(t0, t1, pool)
363 inv.Put(pool)
364 t1.Put(pool)
365 t2.Put(pool)
366 fp.Put(pool)
367 fp2.Put(pool)
368 fp3.Put(pool)
369 fu.Put(pool)
370 fu2.Put(pool)
371 fu3.Put(pool)
372 fu2p.Put(pool)
373 fu3p.Put(pool)
374 y0.Put(pool)
375 y1.Put(pool)
376 y2.Put(pool)
377 y3.Put(pool)
378 y4.Put(pool)
379 y5.Put(pool)
380 y6.Put(pool)
385 func optimalAte(a *twistPoint, b *curvePoint, pool *bnPool) *gfP12 {
386 e := miller(a, b, pool)
387 ret := finalExponentiation(e, pool)
388 e.Put(pool)