From ad59c9eff7fe7a83e966a42376643fb85f309c8f Mon Sep 17 00:00:00 2001 From: MITSUNARI Shigeo Date: Sun, 25 Oct 2020 20:08:54 +0900 Subject: [PATCH] test addCTProj for Zero --- include/mcl/ec.hpp | 1 + test/ec_test.cpp | 3 +-- 2 files changed, 2 insertions(+), 2 deletions(-) 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);