Merge remote-tracking branch 'origin/m1-mac'

update-fork
MITSUNARI Shigeo 4 years ago
commit b9e6a9c166
  1. 6
      Makefile
  2. 17
      common.mk
  3. 2
      include/mcl/op.hpp
  4. 1
      readme.md

@ -91,6 +91,10 @@ ifneq ($(CPU),)
ASM_SRC=$(ASM_SRC_PATH_NAME).s ASM_SRC=$(ASM_SRC_PATH_NAME).s
endif endif
ASM_OBJ=$(OBJ_DIR)/$(CPU).o ASM_OBJ=$(OBJ_DIR)/$(CPU).o
ifeq ($(OS),mac-m1)
ASM_SRC=src/base64.ll
ASM_OBJ=$(OBJ_DIR)/base64.o
endif
BN256_OBJ=$(OBJ_DIR)/bn_c256.o BN256_OBJ=$(OBJ_DIR)/bn_c256.o
BN384_OBJ=$(OBJ_DIR)/bn_c384.o BN384_OBJ=$(OBJ_DIR)/bn_c384.o
BN384_256_OBJ=$(OBJ_DIR)/bn_c384_256.o BN384_256_OBJ=$(OBJ_DIR)/bn_c384_256.o
@ -400,7 +404,7 @@ update_cybozulib:
cp -a $(addprefix ../cybozulib/,$(wildcard include/cybozu/*.hpp)) include/cybozu/ cp -a $(addprefix ../cybozulib/,$(wildcard include/cybozu/*.hpp)) include/cybozu/
clean: clean:
$(RM) $(LIB_DIR)/*.a $(LIB_DIR)/*.$(LIB_SUF) $(OBJ_DIR)/*.o $(OBJ_DIR)/*.obj $(OBJ_DIR)/*.d $(EXE_DIR)/*.exe $(GEN_EXE) $(ASM_OBJ) $(LIB_OBJ) $(BN256_OBJ) $(BN384_OBJ) $(BN512_OBJ) $(FUNC_LIST) src/*.ll lib/*.a src/static_code.asm src/dump_code $(RM) $(LIB_DIR)/*.a $(LIB_DIR)/*.$(LIB_SUF) $(OBJ_DIR)/*.o $(OBJ_DIR)/*.obj $(OBJ_DIR)/*.d $(EXE_DIR)/*.exe $(GEN_EXE) $(ASM_OBJ) $(LIB_OBJ) $(BN256_OBJ) $(BN384_OBJ) $(BN512_OBJ) $(FUNC_LIST) lib/*.a src/static_code.asm src/dump_code
ALL_SRC=$(SRC_SRC) $(TEST_SRC) $(SAMPLE_SRC) ALL_SRC=$(SRC_SRC) $(TEST_SRC) $(SAMPLE_SRC)
DEPEND_FILE=$(addprefix $(OBJ_DIR)/, $(addsuffix .d,$(basename $(ALL_SRC)))) DEPEND_FILE=$(addprefix $(OBJ_DIR)/, $(addsuffix .d,$(basename $(ALL_SRC))))

@ -1,5 +1,6 @@
GCC_VER=$(shell $(PRE)$(CC) -dumpversion) GCC_VER=$(shell $(PRE)$(CC) -dumpversion)
UNAME_S=$(shell uname -s) UNAME_S=$(shell uname -s)
ARCH?=$(shell uname -m)
NASM_ELF_OPT=-felf64 NASM_ELF_OPT=-felf64
ifeq ($(UNAME_S),Linux) ifeq ($(UNAME_S),Linux)
OS=Linux OS=Linux
@ -13,8 +14,11 @@ ifeq ($(findstring CYGWIN,$(UNAME_S)),CYGWIN)
OS=cygwin OS=cygwin
endif endif
ifeq ($(UNAME_S),Darwin) ifeq ($(UNAME_S),Darwin)
ifeq ($(ARCH),x86_64)
OS=mac OS=mac
ARCH=x86_64 else
OS=mac-m1
endif
LIB_SUF=dylib LIB_SUF=dylib
OPENSSL_DIR?=/usr/local/opt/openssl OPENSSL_DIR?=/usr/local/opt/openssl
CFLAGS+=-I$(OPENSSL_DIR)/include CFLAGS+=-I$(OPENSSL_DIR)/include
@ -39,7 +43,6 @@ ifeq ($(UNAME_S),FreeBSD)
LDFLAGS+=-L/usr/local/lib LDFLAGS+=-L/usr/local/lib
endif endif
ARCH?=$(shell uname -m)
ifneq ($(findstring $(ARCH),x86_64/amd64),) ifneq ($(findstring $(ARCH),x86_64/amd64),)
CPU=x86-64 CPU=x86-64
INTEL=1 INTEL=1
@ -63,11 +66,12 @@ ifneq ($(findstring $(ARCH),armv7l/armv6l),)
BIT=32 BIT=32
#LOW_ASM_SRC=src/asm/low_arm.s #LOW_ASM_SRC=src/asm/low_arm.s
endif endif
ifeq ($(ARCH),aarch64) #ifeq ($(ARCH),aarch64)
ifneq ($(findstring $(ARCH),aarch64/arm64),)
CPU=aarch64 CPU=aarch64
BIT=64 BIT=64
endif endif
ifeq ($(findstring $(OS),mac/mingw64/openbsd),) ifeq ($(findstring $(OS),mac/mac-m1/mingw64/openbsd),)
LDFLAGS+=-lrt LDFLAGS+=-lrt
endif endif
@ -111,12 +115,9 @@ CFLAGS+=$(CFLAGS_OPT_USER)
endif endif
CFLAGS+=$(CFLAGS_USER) CFLAGS+=$(CFLAGS_USER)
MCL_USE_GMP?=1 MCL_USE_GMP?=1
ifeq ($(OS),mac) ifneq ($(OS),mac/mac-m1,)
ifeq ($(shell sw_vers -productVersion),10.15)
# workaround because of GMP does not run well on Catalina
MCL_USE_GMP=0 MCL_USE_GMP=0
endif endif
endif
MCL_USE_OPENSSL?=0 MCL_USE_OPENSSL?=0
ifeq ($(MCL_USE_GMP),0) ifeq ($(MCL_USE_GMP),0)
CFLAGS+=-DMCL_USE_VINT CFLAGS+=-DMCL_USE_VINT

@ -26,7 +26,7 @@
namespace mcl { namespace mcl {
static const int version = 0x127; /* 0xABC = A.BC */ static const int version = 0x128; /* 0xABC = A.BC */
/* /*
specifies available string format mode for X::setIoMode() specifies available string format mode for X::setIoMode()

@ -328,6 +328,7 @@ If `MCL_USE_OLD_MAPTO_FOR_BLS12` is defined, then the old function is used, but
# History # History
- 2020/Nov/14 v1.28 support M1 mac
- 2020/Jun/07 v1.22 remove old hash-to-curve functions - 2020/Jun/07 v1.22 remove old hash-to-curve functions
- 2020/Jun/04 v1.21 mapToG1 and hashAndMapToG1 are compatible to irtf/eip-2537 - 2020/Jun/04 v1.21 mapToG1 and hashAndMapToG1 are compatible to irtf/eip-2537
- 2020/May/13 v1.09 support draft-irtf-cfrg-hash-to-curve-07 - 2020/May/13 v1.09 support draft-irtf-cfrg-hash-to-curve-07

Loading…
Cancel
Save