aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMITSUNARI Shigeo <herumi@nifty.com>2018-06-10 13:58:30 +0800
committerMITSUNARI Shigeo <herumi@nifty.com>2018-06-10 13:58:30 +0800
commit4bb8639db3c9927a985aa26589fd809dedf7ee92 (patch)
tree9dc9e08df466ce7dfc802952f2882148c5538a2a
parent33bf408a11bbc6ca48ff0d6d2b64f0d2728c08f9 (diff)
downloaddexon-bls-4bb8639db3c9927a985aa26589fd809dedf7ee92.tar
dexon-bls-4bb8639db3c9927a985aa26589fd809dedf7ee92.tar.gz
dexon-bls-4bb8639db3c9927a985aa26589fd809dedf7ee92.tar.bz2
dexon-bls-4bb8639db3c9927a985aa26589fd809dedf7ee92.tar.lz
dexon-bls-4bb8639db3c9927a985aa26589fd809dedf7ee92.tar.xz
dexon-bls-4bb8639db3c9927a985aa26589fd809dedf7ee92.tar.zst
dexon-bls-4bb8639db3c9927a985aa26589fd809dedf7ee92.zip
use precomputedMillerLoop2mixed
-rw-r--r--src/bls_c.cpp14
1 files 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<Fp6> g_Qcoeff; // precomputed Q
-static const G2& getQ() { return g_Q; }
-static const mcl::Array<Fp6>& getQcoeff() { return g_Qcoeff; }
+const size_t maxQcoeffN = 128;
+static mcl::FixedArray<Fp6, maxQcoeffN> g_Qcoeff; // precomputed Q
+inline const G2& getQ() { return g_Q; }
+inline const mcl::FixedArray<Fp6, maxQcoeffN>& 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<Fp6> 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();
}