Closed timfaner closed 4 years ago
If the point Q of G2 is fixed, then you can use mclBn_precomputeG2
and mclBn_precomputedMillerLoop
, but there is no way for the fixed point P of G1 now to compute a pairing e(P, Q).
cf. https://github.com/herumi/mcl/blob/master/test/bn_c_test.hpp#L421-L432
The current library already uses those functions if BLS_ETH
is not defined.
Could you tell me what is your intention of precompute on bls12-381?
?
I want to use bls12-381 to sign and verify bls signature under risc-v ISA, but bls12-381 seems a bit slower than bn254, so I'm wondering if precompute on bls12-381may speed up the verify process.
This library is already optimized as possible. I have no RISC-V environment, so I have some questions.
bls
with?cd mcl && make UPDATE_ASM=1
?uname -s
and uname -m
?-DMCL_USE_VINT -DMCL_VINT_FIXED_BUFFER -DMCL_DONT_USE_OPENSSL -DMCL_DONT_USE_XBYAK
Does your system have llvm commands such as opt, llc (llvm-opt or...)? If so, then you may be able to make a asm code for riscv like the following commands (I've not test it.).
make src/base64.ll
opt -O3 -o - src/base64.ll | llc -O3 -o src/asm/riscv.s -relocation-model=pic
gas -o riscv.o src/asm/riscv.s
g++ -O3 -c src/fp.cpp -O3 -DNDEBUG -fPIC -I ./include -DMCL_USE_VINT -DMCL_VINT_FIXED_BUFFER -DMCL_DONT_USE_OPENSSL -DMCL_DONT_USE_XBYAK -DMCL_USE_LLVM=1 -DCYBOZU_DONT_USE_STRING -DCYBOZU_DONT_USE_EXCEPTION -DMCL_MAX_BIT_SIZE=384
ar r lib/libmcl.a fp.o riscv.o
And make bls with lib/libmcl.a
.
Is there any way to imply precompute on bls12-381?