|
|
@ -705,7 +705,6 @@ struct BNT { |
|
|
|
} |
|
|
|
} |
|
|
|
static void addLineWithoutP(Fp6& l, G2& R, const G2& Q) |
|
|
|
static void addLineWithoutP(Fp6& l, G2& R, const G2& Q) |
|
|
|
{ |
|
|
|
{ |
|
|
|
#if 1 |
|
|
|
|
|
|
|
Fp2 t1, t2, t3, t4; |
|
|
|
Fp2 t1, t2, t3, t4; |
|
|
|
Fp2Dbl T1, T2; |
|
|
|
Fp2Dbl T1, T2; |
|
|
|
Fp2::mul(t1, R.z, Q.x); |
|
|
|
Fp2::mul(t1, R.z, Q.x); |
|
|
@ -734,33 +733,6 @@ struct BNT { |
|
|
|
Fp2Dbl::mod(t2, T1); |
|
|
|
Fp2Dbl::mod(t2, T1); |
|
|
|
Fp2::mul_xi(l.a, t2); |
|
|
|
Fp2::mul_xi(l.a, t2); |
|
|
|
l.b = t1; |
|
|
|
l.b = t1; |
|
|
|
#else |
|
|
|
|
|
|
|
Fp2 t1, t2, t3, t4, T1, T2; |
|
|
|
|
|
|
|
Fp2::mul(t1, R.z, Q.x); |
|
|
|
|
|
|
|
Fp2::mul(t2, R.z, Q.y); |
|
|
|
|
|
|
|
Fp2::sub(t1, R.x, t1); |
|
|
|
|
|
|
|
Fp2::sub(t2, R.y, t2); |
|
|
|
|
|
|
|
Fp2::sqr(t3, t1); |
|
|
|
|
|
|
|
Fp2::mul(R.x, t3, R.x); |
|
|
|
|
|
|
|
Fp2::sqr(t4, t2); |
|
|
|
|
|
|
|
t3 *= t1; |
|
|
|
|
|
|
|
t4 *= R.z; |
|
|
|
|
|
|
|
t4 += t3; |
|
|
|
|
|
|
|
t4 -= R.x; |
|
|
|
|
|
|
|
t4 -= R.x; |
|
|
|
|
|
|
|
R.x -= t4; |
|
|
|
|
|
|
|
mulOpt1(T1, t2, R.x); |
|
|
|
|
|
|
|
mulOpt1(T2, t3, R.y); |
|
|
|
|
|
|
|
Fp2::sub(R.y, T1, T2); |
|
|
|
|
|
|
|
Fp2::mul(R.x, t1, t4); |
|
|
|
|
|
|
|
Fp2::mul(R.z, t3, R.z); |
|
|
|
|
|
|
|
Fp2::neg(l.c, t2); |
|
|
|
|
|
|
|
mulOpt1(T1, t2, Q.x); |
|
|
|
|
|
|
|
mulOpt1(T2, t1, Q.y); |
|
|
|
|
|
|
|
Fp2::sub(t2, T1, T2); |
|
|
|
|
|
|
|
Fp2::mul_xi(l.a, t2); |
|
|
|
|
|
|
|
l.b = t1; |
|
|
|
|
|
|
|
#endif |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
static void dblLine(Fp6& l, G2& Q, const G1& P) |
|
|
|
static void dblLine(Fp6& l, G2& Q, const G1& P) |
|
|
|
{ |
|
|
|
{ |
|
|
@ -890,72 +862,6 @@ struct BNT { |
|
|
|
#if 0 |
|
|
|
#if 0 |
|
|
|
static void mul_024(Fp12& z, const Fp12&x, const Fp6& y) |
|
|
|
static void mul_024(Fp12& z, const Fp12&x, const Fp6& y) |
|
|
|
{ |
|
|
|
{ |
|
|
|
#if 1 |
|
|
|
|
|
|
|
const Fp2 x0 = x.a.a; |
|
|
|
|
|
|
|
const Fp2 x1 = x.a.b; |
|
|
|
|
|
|
|
const Fp2 x2 = x.a.c; |
|
|
|
|
|
|
|
const Fp2 x3 = x.b.a; |
|
|
|
|
|
|
|
const Fp2 x4 = x.b.b; |
|
|
|
|
|
|
|
const Fp2 x5 = x.b.c; |
|
|
|
|
|
|
|
const Fp2& y0 = y.a; |
|
|
|
|
|
|
|
const Fp2& y2 = y.c; |
|
|
|
|
|
|
|
const Fp2& y4 = y.b; |
|
|
|
|
|
|
|
Fp2 y2_add_y4; |
|
|
|
|
|
|
|
Fp2::add(y2_add_y4, y2, y4); |
|
|
|
|
|
|
|
Fp2Dbl X0Y4, X1Y4, X2Y4, X3Y2, X4Y2, X5Y2; |
|
|
|
|
|
|
|
Fp2Dbl::mulPre(X0Y4, x0, y4); |
|
|
|
|
|
|
|
Fp2Dbl::mulPre(X1Y4, x1, y4); |
|
|
|
|
|
|
|
Fp2Dbl::mulPre(X2Y4, x2, y4); |
|
|
|
|
|
|
|
Fp2Dbl::mulPre(X3Y2, x3, y2); |
|
|
|
|
|
|
|
Fp2Dbl::mulPre(X4Y2, x4, y2); |
|
|
|
|
|
|
|
Fp2Dbl::mulPre(X5Y2, x5, y2); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Fp2 x1_add_x4; |
|
|
|
|
|
|
|
Fp2 x2_add_x5; |
|
|
|
|
|
|
|
Fp2 x0_add_x3; |
|
|
|
|
|
|
|
Fp2::add(x1_add_x4, x1, x4); |
|
|
|
|
|
|
|
Fp2::add(x2_add_x5, x2, x5); |
|
|
|
|
|
|
|
Fp2::add(x0_add_x3, x0, x3); |
|
|
|
|
|
|
|
Fp2Dbl T1, T2; |
|
|
|
|
|
|
|
Fp2Dbl::mulPre(T1, x1_add_x4, y2_add_y4); |
|
|
|
|
|
|
|
T1 -= X1Y4; |
|
|
|
|
|
|
|
T1 -= X4Y2; |
|
|
|
|
|
|
|
Fp2Dbl::mul_xi(T1, T1); |
|
|
|
|
|
|
|
Fp2Dbl::mulPre(T2, x0, y0); |
|
|
|
|
|
|
|
T1 += T2; |
|
|
|
|
|
|
|
Fp2Dbl::mod(z.a.a, T1); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Fp2Dbl::mulPre(T1, x2_add_x5, y2_add_y4); |
|
|
|
|
|
|
|
T1 -= X2Y4; |
|
|
|
|
|
|
|
T1 -= X5Y2; |
|
|
|
|
|
|
|
Fp2Dbl::mul_xi(T1, T1); |
|
|
|
|
|
|
|
Fp2Dbl::mulPre(T2, x1, y0); |
|
|
|
|
|
|
|
Fp2Dbl::add(T1, T1, T2); |
|
|
|
|
|
|
|
Fp2Dbl::mod(z.a.b, T1); |
|
|
|
|
|
|
|
Fp2Dbl::mulPre(T1, x0_add_x3, y2_add_y4); |
|
|
|
|
|
|
|
T1 -= X0Y4; |
|
|
|
|
|
|
|
T1 -= X3Y2; |
|
|
|
|
|
|
|
Fp2Dbl::mulPre(T2, x2, y0); |
|
|
|
|
|
|
|
T1 += T2; |
|
|
|
|
|
|
|
Fp2Dbl::mod(z.a.c, T1); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Fp2Dbl::add(T1, X2Y4, X4Y2); |
|
|
|
|
|
|
|
Fp2Dbl::mul_xi(T1, T1); |
|
|
|
|
|
|
|
Fp2Dbl::mulPre(T2, x3, y0); |
|
|
|
|
|
|
|
T1 += T2; |
|
|
|
|
|
|
|
Fp2Dbl::mod(z.b.a, T1); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Fp2Dbl::mul_xi(T1, X5Y2); |
|
|
|
|
|
|
|
Fp2Dbl::mulPre(T2, x4, y0); |
|
|
|
|
|
|
|
T2 += X0Y4; |
|
|
|
|
|
|
|
T1 += T2; |
|
|
|
|
|
|
|
Fp2Dbl::mod(z.b.b, T1); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Fp2Dbl::mulPre(T1, x5, y0); |
|
|
|
|
|
|
|
T1 += X3Y2; |
|
|
|
|
|
|
|
T1 += X1Y4; |
|
|
|
|
|
|
|
Fp2Dbl::mod(z.b.c, T1); |
|
|
|
|
|
|
|
#else |
|
|
|
|
|
|
|
const Fp2 x0 = x.a.a; |
|
|
|
const Fp2 x0 = x.a.a; |
|
|
|
const Fp2 x1 = x.a.b; |
|
|
|
const Fp2 x1 = x.a.b; |
|
|
|
const Fp2 x2 = x.a.c; |
|
|
|
const Fp2 x2 = x.a.c; |
|
|
@ -1014,7 +920,6 @@ struct BNT { |
|
|
|
Fp2::mul(z.b.c, x5, y0); |
|
|
|
Fp2::mul(z.b.c, x5, y0); |
|
|
|
z.b.c += x3y2; |
|
|
|
z.b.c += x3y2; |
|
|
|
z.b.c += x1y4; |
|
|
|
z.b.c += x1y4; |
|
|
|
#endif |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
#endif |
|
|
|
#endif |
|
|
|
static void mul_024_024(Fp12& z, const Fp6& x, const Fp6& y) |
|
|
|
static void mul_024_024(Fp12& z, const Fp6& x, const Fp6& y) |
|
|
|