aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMITSUNARI Shigeo <herumi@nifty.com>2018-04-04 13:34:00 +0800
committerMITSUNARI Shigeo <herumi@nifty.com>2018-04-04 13:34:00 +0800
commite07a7eba6202202405a17e4774821d0a24918aed (patch)
tree9b20e4f5b98e6f92e2f45a95f5baf690943f59d8 /src
parentaaab06e142ce93cf5348a502ad65257e228952b5 (diff)
downloadtangerine-mcl-e07a7eba6202202405a17e4774821d0a24918aed.tar.gz
tangerine-mcl-e07a7eba6202202405a17e4774821d0a24918aed.tar.zst
tangerine-mcl-e07a7eba6202202405a17e4774821d0a24918aed.zip
add mclBn_verifyOrderG1/G2
Diffstat (limited to 'src')
-rw-r--r--src/bn_c_impl.hpp13
-rw-r--r--src/she_c_impl.hpp22
2 files changed, 27 insertions, 8 deletions
diff --git a/src/bn_c_impl.hpp b/src/bn_c_impl.hpp
index 337f0ef..9c3ee2a 100644
--- a/src/bn_c_impl.hpp
+++ b/src/bn_c_impl.hpp
@@ -607,3 +607,16 @@ int mclBn_G2EvaluatePolynomial(mclBnG2 *out, const mclBnG2 *cVec, mclSize cSize,
if (g_fp) fprintf(g_fp, "mclBn_G2EvaluatePolynomial %s\n", e.what());
return -1;
}
+
+void mclBn_verifyOrderG1(int doVerify)
+{
+ if (BN::param.isBLS12) {
+ G1::setOrder(doVerify ? BN::param.r : 0);
+ }
+}
+
+void mclBn_verifyOrderG2(int doVerify)
+{
+ G2::setOrder(doVerify ? BN::param.r : 0);
+}
+
diff --git a/src/she_c_impl.hpp b/src/she_c_impl.hpp
index b4b5e8d..9c2c9dc 100644
--- a/src/she_c_impl.hpp
+++ b/src/she_c_impl.hpp
@@ -61,17 +61,23 @@ int sheInit(int curve, int maxUnitSize)
mcl::CurveParam cp;
switch (curve) {
- case mclBn_CurveFp254BNb:
- cp = mcl::bn::CurveFp254BNb;
+ case MCL_BN254BNb:
+ cp = mcl::BN254BNb;
break;
- case mclBn_CurveFp382_1:
- cp = mcl::bn::CurveFp382_1;
+ case MCL_BN382_1:
+ cp = mcl::BN382_1;
break;
- case mclBn_CurveFp382_2:
- cp = mcl::bn::CurveFp382_2;
+ case MCL_BN382_2:
+ cp = mcl::BN382_2;
break;
- case mclBn_CurveFp462:
- cp = mcl::bn::CurveFp462;
+ case MCL_BN462:
+ cp = mcl::BN462;
+ break;
+ case MCL_BN_SNARK1:
+ cp = mcl::BN_SNARK1;
+ break;
+ case MCL_BLS12_381:
+ cp = mcl::BLS12_381;
break;
default:
fprintf(stderr, "err bad curve %d\n", curve);