|
|
|
@ -1,13 +1,17 @@ |
|
|
|
|
#define CYBOZU_TEST_DISABLE_AUTO_RUN |
|
|
|
|
#include <cybozu/test.hpp> |
|
|
|
|
#include <cybozu/benchmark.hpp> |
|
|
|
|
#include <cybozu/option.hpp> |
|
|
|
|
#include <mcl/bn384.hpp> |
|
|
|
|
#include <mcl/bn.hpp> |
|
|
|
|
|
|
|
|
|
using namespace mcl::bn384; |
|
|
|
|
|
|
|
|
|
mcl::fp::Mode g_mode; |
|
|
|
|
|
|
|
|
|
void testCurve(const mcl::bn::CurveParam& cp) |
|
|
|
|
{ |
|
|
|
|
bn384init(cp); |
|
|
|
|
bn384init(cp, g_mode); |
|
|
|
|
G1 P; |
|
|
|
|
G2 Q; |
|
|
|
|
BN::mapToG1(P, 1); |
|
|
|
@ -35,3 +39,20 @@ CYBOZU_TEST_AUTO(pairing) |
|
|
|
|
// support 256-bit pairing
|
|
|
|
|
testCurve(mcl::bn::CurveFp254BNb); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
int main(int argc, char *argv[]) |
|
|
|
|
try |
|
|
|
|
{ |
|
|
|
|
cybozu::Option opt; |
|
|
|
|
std::string mode; |
|
|
|
|
opt.appendOpt(&mode, "auto", "m", ": mode(gmp/gmp_mont/llvm/llvm_mont/xbyak)"); |
|
|
|
|
if (!opt.parse(argc, argv)) { |
|
|
|
|
opt.usage(); |
|
|
|
|
return 1; |
|
|
|
|
} |
|
|
|
|
g_mode = mcl::fp::StrToMode(mode); |
|
|
|
|
return cybozu::test::autoRun.run(argc, argv); |
|
|
|
|
} catch (std::exception& e) { |
|
|
|
|
printf("ERR %s\n", e.what()); |
|
|
|
|
return 1; |
|
|
|
|
} |
|
|
|
|