diff --git a/Makefile b/Makefile index 7c4a0a8..e99ff19 100644 --- a/Makefile +++ b/Makefile @@ -367,7 +367,7 @@ ecdsa-wasm: bin/emu: $(CXX) -g -o $@ src/fp.cpp src/bn_c256.cpp test/bn_c256_test.cpp -DMCL_DONT_USE_XBYAK -DMCL_DONT_USE_OPENSSL -DMCL_USE_VINT -DMCL_SIZEOF_UNIT=8 -DMCL_VINT_64BIT_PORTABLE -DMCL_VINT_FIXED_BUFFER -DMCL_MAX_BIT_SIZE=256 -I./include bin/pairing_c_min.exe: sample/pairing_c.c include/mcl/vint.hpp src/fp.cpp include/mcl/bn.hpp - $(CXX) -o $@ sample/pairing_c.c src/fp.cpp src/bn_c256.cpp -O3 -g -I./include -fno-threadsafe-statics -DMCL_DONT_USE_XBYAK -DMCL_DONT_USE_OPENSSL -DMCL_USE_VINT -DMCL_SIZEOF_UNIT=8 -DMCL_VINT_FIXED_BUFFER -DMCL_MAX_BIT_SIZE=256 -DMCL_VINT_64BIT_PORTABLE -DCYBOZU_DONT_USE_STRING -DCYBOZU_DONT_USE_EXCEPTION -DNDEBUG # -DMCL_DONT_USE_CSPRNG + $(CXX) -std=c++03 -O3 -g -fno-threadsafe-statics -fno-exceptions -fno-rtti -o $@ sample/pairing_c.c src/fp.cpp src/bn_c384_256.cpp -I./include -DMCL_DONT_USE_XBYAK -DMCL_DONT_USE_OPENSSL -DMCL_USE_VINT -DMCL_SIZEOF_UNIT=8 -DMCL_VINT_FIXED_BUFFER -DMCL_MAX_BIT_SIZE=384 -DMCL_VINT_64BIT_PORTABLE -DCYBOZU_DONT_USE_STRING -DCYBOZU_DONT_USE_EXCEPTION -DNDEBUG # -DMCL_DONT_USE_CSPRNG make_tbl: $(MAKE) ../bls/src/qcoeff-bn254.hpp diff --git a/sample/pairing_c.c b/sample/pairing_c.c index a669ec7..b174dbe 100644 --- a/sample/pairing_c.c +++ b/sample/pairing_c.c @@ -7,7 +7,7 @@ int g_err = 0; int main() { - char buf[1024]; + char buf[1600]; const char *aStr = "123"; const char *bStr = "456"; int ret = mclBn_init(MCL_BLS12_381, MCLBN_COMPILED_TIME_VAR); @@ -27,16 +27,16 @@ int main() ASSERT(!mclBnG1_hashAndMapTo(&P, "this", 4)); ASSERT(!mclBnG2_hashAndMapTo(&Q, "that", 4)); - mclBnG1_getStr(buf, sizeof(buf), &P, 16); + ASSERT(mclBnG1_getStr(buf, sizeof(buf), &P, 16)); printf("P = %s\n", buf); - mclBnG2_getStr(buf, sizeof(buf), &Q, 16); + ASSERT(mclBnG2_getStr(buf, sizeof(buf), &Q, 16)); printf("Q = %s\n", buf); mclBnG1_mul(&aP, &P, &a); mclBnG2_mul(&bQ, &Q, &b); mclBn_pairing(&e, &P, &Q); - mclBnGT_getStr(buf, sizeof(buf), &e, 16); + ASSERT(mclBnGT_getStr(buf, sizeof(buf), &e, 16)); printf("e = %s\n", buf); mclBnGT_pow(&e1, &e, &a); mclBn_pairing(&e2, &aP, &Q);