fix isValidOrder for G2

dev
MITSUNARI Shigeo 8 years ago
parent d51a6698f4
commit c758169491
  1. 2
      include/mcl/ec.hpp
  2. 6
      test/bn384_test.cpp

@ -212,7 +212,7 @@ public:
bool isValidOrder() const
{
EcT Q;
EcT::mul(Q, *this, order_);
EcT::mulGeneric(Q, *this, order_);
return Q.isZero();
}
bool isValid() const

@ -50,6 +50,12 @@ CYBOZU_TEST_AUTO(pairing)
testCurve(mcl::bn::CurveFp382_1);
puts("CurveFp382_2");
testCurve(mcl::bn::CurveFp382_2);
// Q is not on EcT, but bad order
{
const char *s = "1 18d3d8c085a5a5e7553c3a4eb628e88b8465bf4de2612e35a0a4eb018fb0c82e9698896031e62fd7633ffd824a859474 1dc6edfcf33e29575d4791faed8e7203832217423bf7f7fbf1f6b36625b12e7132c15fbc15562ce93362a322fb83dd0d 65836963b1f7b6959030ddfa15ab38ce056097e91dedffd996c1808624fa7e2644a77be606290aa555cda8481cfb3cb 1b77b708d3d4f65aeedf54b58393463a42f0dc5856baadb5ce608036baeca398c5d9e6b169473a8838098fd72fd28b50";
G2 Q;
CYBOZU_TEST_EXCEPTION(Q.setStr(s, 16), std::exception);
}
}
int main(int argc, char *argv[])

Loading…
Cancel
Save