diff --git a/include/mcl/ec.hpp b/include/mcl/ec.hpp index 7ae672a..d8a0fc1 100644 --- a/include/mcl/ec.hpp +++ b/include/mcl/ec.hpp @@ -427,6 +427,7 @@ void addJacobi(E& R, const E& P, const E& Q) /* accept P == Q https://github.com/apache/incubator-milagro-crypto-c/blob/fa0a45a3/src/ecp.c.in#L767-L976 + (x, y, z) is zero <=> x = 0, y = 1, z = 0 */ template void addCTProj(E& R, const E& P, const E& Q) diff --git a/test/ec_test.cpp b/test/ec_test.cpp index 1aa241f..f544714 100644 --- a/test/ec_test.cpp +++ b/test/ec_test.cpp @@ -499,20 +499,19 @@ struct Test { Fp y(para.gy); Ec P(x, y), Q, R, Zero; Zero.clear(); + Zero.y = 1; mcl::ec::addCTProj(Q, P, P); Ec::add(R, P, P); CYBOZU_TEST_EQUAL(Q, R); mcl::ec::addCTProj(Q, Q, P); Ec::add(R, R, P); CYBOZU_TEST_EQUAL(Q, R); -/* mcl::ec::addCTProj(Q, Q, Zero); Ec::add(R, R, Zero); CYBOZU_TEST_EQUAL(Q, R); mcl::ec::addCTProj(Q, Zero, Q); Ec::add(R, Zero, R); CYBOZU_TEST_EQUAL(Q, R); -*/ mcl::ec::addCTProj(Q, Zero, Zero); Ec::add(R, Zero, Zero); CYBOZU_TEST_EQUAL(Q, R);