From 4bb8639db3c9927a985aa26589fd809dedf7ee92 Mon Sep 17 00:00:00 2001 From: MITSUNARI Shigeo Date: Sun, 10 Jun 2018 14:58:30 +0900 Subject: use precomputedMillerLoop2mixed --- src/bls_c.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/bls_c.cpp b/src/bls_c.cpp index 5f55785..108d123 100644 --- a/src/bls_c.cpp +++ b/src/bls_c.cpp @@ -17,9 +17,10 @@ */ static G2 g_Q; -static mcl::Array g_Qcoeff; // precomputed Q -static const G2& getQ() { return g_Q; } -static const mcl::Array& getQcoeff() { return g_Qcoeff; } +const size_t maxQcoeffN = 128; +static mcl::FixedArray g_Qcoeff; // precomputed Q +inline const G2& getQ() { return g_Q; } +inline const mcl::FixedArray& getQcoeff() { return g_Qcoeff; } int blsInitNotThreadSafe(int curve, int maxUnitSize) { @@ -28,7 +29,8 @@ int blsInitNotThreadSafe(int curve, int maxUnitSize) bool b; mapToG2(&b, g_Q, 1); if (!b) return -100; - if (!precomputeG2(g_Qcoeff, getQ())) return -101; + precomputeG2(&b, g_Qcoeff, getQ()); + if (!b) return -101; return 0; } @@ -83,10 +85,8 @@ static inline const mclBnG2 *cast(const G2* x) { return (const mclBnG2*)x; } */ bool isEqualTwoPairings(const G1& P1, const Fp6* Q1coeff, const G1& P2, const G2& Q2) { - mcl::Array Q2coeff; - if (!precomputeG2(Q2coeff, Q2)) return false; Fp12 e; - precomputedMillerLoop2(e, P1, Q1coeff, -P2, Q2coeff.data()); + precomputedMillerLoop2mixed(e, P2, Q2, -P1, Q1coeff); finalExp(e, e); return e.isOne(); } -- cgit v1.2.3