Skip to content

Commit

Permalink
recover MCL_USE_GMP=1
Browse files Browse the repository at this point in the history
  • Loading branch information
herumi committed Dec 12, 2023
1 parent 1c1d8fb commit 7afefaf
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 11 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,7 @@ $(EXE_DIR)/ecdsa_c_test.exe: $(OBJ_DIR)/ecdsa_c_test.o $(ECDSA_LIB) $(MCL_LIB) s
$(PRE)$(CXX) $< -o $@ $(ECDSA_LIB) $(MCL_LIB) $(LDFLAGS)

$(EXE_DIR)/paillier_test.exe: $(OBJ_DIR)/paillier_test.o $(MCL_LIB)
$(PRE)$(CXX) $< -o $@ $(LDFLAGS) -lgmp -lgmpxx
$(PRE)$(CXX) $< -o $@ $(MCL_LIB) $(LDFLAGS) -lgmp -lgmpxx

$(EXE_DIR)/bint_test.exe: $(OBJ_DIR)/bint_test.o $(MCL_LIB)
$(PRE)$(CXX) $< -o $@ $(MCL_LIB) $(LDFLAGS) -lgmp -lgmpxx
Expand Down
1 change: 1 addition & 0 deletions common.mk
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ ifeq ($(MCL_USE_GMP),1)
CFLAGS+=-I$(GMP_DIR)/include
LDFLAGS+=-L$(GMP_DIR)/lib
endif
CFLAGS+=-DMCL_USE_GMP=1
endif
ifeq ($(MCL_STATIC_CODE),1)
MCL_USE_XBYAK=0
Expand Down
1 change: 1 addition & 0 deletions include/mcl/gmp_util.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
typedef mcl::Vint mpz_class;
#else
#include <gmpxx.h>
#include <mcl/bint.hpp>
#ifdef _MSC_VER
#pragma warning(pop)
#include <cybozu/link_mpir.hpp>
Expand Down
1 change: 1 addition & 0 deletions include/mcl/invmod.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#include <mcl/bint.hpp>
#include <cybozu/bit_operation.hpp>
#include <mcl/invmod_fwd.hpp>
#include <mcl/util.hpp>

namespace mcl {

Expand Down
20 changes: 10 additions & 10 deletions test/low_func_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,21 +75,21 @@ CYBOZU_TEST_AUTO(limit)
{
std::cout << std::hex;
const char *tbl4[] = {
"0x0000000000000001000000000000000000000000000000000000000000000085", // min prime
"0x2523648240000001ba344d80000000086121000000000013a700000000000013",
"0x7523648240000001ba344d80000000086121000000000013a700000000000017",
"0x800000000000000000000000000000000000000000000000000000000000005f",
"0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f", // secp256k1
"0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff43", // max prime
"0000000000000001000000000000000000000000000000000000000000000085", // min prime
"2523648240000001ba344d80000000086121000000000013a700000000000013",
"7523648240000001ba344d80000000086121000000000013a700000000000017",
"800000000000000000000000000000000000000000000000000000000000005f",
"fffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f", // secp256k1
"ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff43", // max prime
// not primes
"0xffffffffffffffffffffffffffffffffffffffffffffffff0000000000000001",
"0xffffffffffffffffffffffffffffffffffffffffffffffffffffffff00000001",
"0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
"ffffffffffffffffffffffffffffffffffffffffffffffff0000000000000001",
"ffffffffffffffffffffffffffffffffffffffffffffffffffffffff00000001",
"ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
};
for (size_t i = 0; i < CYBOZU_NUM_OF_ARRAY(tbl4); i++) {
printf("p=%s\n", tbl4[i]);
mpz_class p;
p.setStr(tbl4[i], 16);
mcl::gmp::setStr(p, tbl4[i], 16);
testEdge<4 * (8 / sizeof(Unit))>(p);
}
}
Expand Down

0 comments on commit 7afefaf

Please sign in to comment.