diff --git a/include/mcl/ecdsa.hpp b/include/mcl/ecdsa.hpp index cf3ed3f..6540c19 100644 --- a/include/mcl/ecdsa.hpp +++ b/include/mcl/ecdsa.hpp @@ -99,6 +99,8 @@ inline void init(bool *pb) p.P.set(pb, x, y); if (!*pb) return; p.Pbase.init(pb, p.P, ecParam.bitSize, local::winSize); + mcl::GLV1T::initForSecp256k1(Zn::getOp().mp); + Ec::setMulArrayGLV(mcl::GLV1T::mulArray); } #ifndef CYBOZU_DONT_USE_EXCEPTION diff --git a/include/mcl/she.hpp b/include/mcl/she.hpp index 282f2fe..84f3e55 100644 --- a/include/mcl/she.hpp +++ b/include/mcl/she.hpp @@ -26,6 +26,7 @@ #include #include #include +#include namespace mcl { namespace she { @@ -588,6 +589,10 @@ public: useDecG2ViaGT_ = false; isG1only_ = true; setTryNum(tryNum); + if (std::string(para.name) == mcl::ecparam::secp256k1.name) { + mcl::GLV1T::initForSecp256k1(Fr::getOp().mp); + G1::setMulArrayGLV(mcl::GLV1T::mulArray); + } } /* set range for G1-DLP diff --git a/test/ecdsa_test.cpp b/test/ecdsa_test.cpp index f015514..80de88a 100644 --- a/test/ecdsa_test.cpp +++ b/test/ecdsa_test.cpp @@ -18,8 +18,6 @@ using namespace mcl::ecdsa; CYBOZU_TEST_AUTO(ecdsa) { init(); - mcl::GLV1T::initForSecp256k1(Zn::getOp().mp); - Ec::setMulArrayGLV(mcl::GLV1T::mulArray); SecretKey sec; PublicKey pub; sec.setByCSPRNG(); diff --git a/test/she_test.cpp b/test/she_test.cpp index cb64478..0782eda 100644 --- a/test/she_test.cpp +++ b/test/she_test.cpp @@ -716,8 +716,9 @@ CYBOZU_TEST_AUTO(hashBench) CYBOZU_TEST_AUTO(liftedElGamal) { const size_t hashSize = 1024; - initG1only(mcl::ecparam::secp192k1, hashSize); - const size_t byteSize = 192 / 8; + const mcl::EcParam& param = mcl::ecparam::secp256k1; + initG1only(param, hashSize); + const size_t byteSize = (param.bitSize + 7) / 8; SecretKey sec; sec.setByCSPRNG(); PublicKey pub;