aboutsummaryrefslogtreecommitdiffstats
path: root/test/bls_c_test.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'test/bls_c_test.hpp')
-rw-r--r--test/bls_c_test.hpp44
1 files changed, 25 insertions, 19 deletions
diff --git a/test/bls_c_test.hpp b/test/bls_c_test.hpp
index 105be86..7864097 100644
--- a/test/bls_c_test.hpp
+++ b/test/bls_c_test.hpp
@@ -301,34 +301,40 @@ void blsBench()
blsGetPublicKey(&pub, &sec);
- CYBOZU_BENCH_C("sign", 1000, blsSign, &sig, &sec, msg, msgSize);
+ CYBOZU_BENCH_C("sign", 10000, blsSign, &sig, &sec, msg, msgSize);
CYBOZU_BENCH_C("verify", 1000, blsVerify, &sig, &pub, msg, msgSize);
}
CYBOZU_TEST_AUTO(all)
{
- const int tbl[] = {
- MCL_BN254,
+ const struct {
+ int curveType;
+ const char *p;
+ const char *r;
+ } tbl[] = {
+ {
+ MCL_BN254,
+ "16798108731015832284940804142231733909759579603404752749028378864165570215949",
+ "16798108731015832284940804142231733909889187121439069848933715426072753864723",
+ },
#if MCLBN_FP_UNIT_SIZE == 6 && MCLBN_FR_UNIT_SIZE == 6
- MCL_BN381_1,
+ {
+ MCL_BN381_1,
+ "5540996953667913971058039301942914304734176495422447785042938606876043190415948413757785063597439175372845535461389",
+ "5540996953667913971058039301942914304734176495422447785045292539108217242186829586959562222833658991069414454984723",
+ },
#endif
-#if MCLBN_FR_UNIT_SIZE == 6 && MCLBN_FP_UNIT_SIZE == 4
- MCL_BLS12_381,
+#if MCLBN_FP_UNIT_SIZE == 6 && MCLBN_FR_UNIT_SIZE == 4
+ {
+ MCL_BLS12_381,
+ "52435875175126190479447740508185965837690552500527637822603658699938581184513",
+ "4002409555221667393417789825735904156556882819939007885332058136124031650490837864442687629129015664037894272559787",
+ },
#endif
};
- const char *curveOrderTbl[] = {
- "16798108731015832284940804142231733909759579603404752749028378864165570215949",
- "5540996953667913971058039301942914304734176495422447785042938606876043190415948413757785063597439175372845535461389",
- "52435875175126190479447740508185965837690552500527637822603658699938581184513",
- };
- const char *fieldOrderTbl[] = {
- "16798108731015832284940804142231733909889187121439069848933715426072753864723",
- "5540996953667913971058039301942914304734176495422447785045292539108217242186829586959562222833658991069414454984723",
- "4002409555221667393417789825735904156556882819939007885332058136124031650490837864442687629129015664037894272559787",
- };
for (size_t i = 0; i < sizeof(tbl) / sizeof(tbl[0]); i++) {
printf("i=%d\n", (int)i);
- int ret = blsInit(tbl[i], MCLBN_COMPILED_TIME_VAR);
+ int ret = blsInit(tbl[i].curveType, MCLBN_COMPILED_TIME_VAR);
CYBOZU_TEST_EQUAL(ret, 0);
if (ret) {
printf("ERR %d\n", ret);
@@ -336,9 +342,9 @@ CYBOZU_TEST_AUTO(all)
}
bls_use_stackTest();
blsDataTest();
- blsOrderTest(curveOrderTbl[i], fieldOrderTbl[i]);
+ blsOrderTest(tbl[i].p, tbl[i].r);
blsSerializeTest();
- if (tbl[i] == MCL_BLS12_381) blsVerifyOrderTest();
+ if (tbl[i].curveType == MCL_BLS12_381) blsVerifyOrderTest();
blsAddSubTest();
blsBench();
}