Takes 2 SIKE/SIDH implementations and runs them against each other until something goes wrong
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

60 lines
1.4 KiB

  1. objify = $(patsubst %.c,$(BUILD_DIR)/%.$2,$(patsubst %.s,$(BUILD_DIR)/%.$2,$1))
  2. BUILD_DIR=build
  3. BIN_DIR=bin
  4. MK_FILE_PATH = $(lastword $(MAKEFILE_LIST))
  5. PRJ_DIR = $(abspath $(dir $(MK_FILE_PATH)))
  6. GOPATH_LOCAL = $(PRJ_DIR)/$(BUILD_DIR)/
  7. CFLAGS=-Wall -Wextra -Wpedantic -O3 -funroll-loops
  8. LDFLAGS=
  9. AR=ar rcs
  10. RANLIB=ranlib
  11. GOPATH=$(BUILD_DIR)
  12. GO=go
  13. IMPORT_PATH:=github.com/henrydcase/sidh_torture/csidh
  14. CODE_SRC_C = \
  15. ref/csidh/rng.c \
  16. ref/csidh/mont.c \
  17. ref/csidh/csidh.c
  18. CODE_SRC_S = \
  19. ref/csidh/u512.s \
  20. ref/csidh/fp.s
  21. CODE_OBJ = \
  22. $(call objify,$(CODE_SRC_C),o) \
  23. $(call objify,$(CODE_SRC_S),o)
  24. $(BUILD_DIR)/%.o: %.c
  25. case $@ in */*) f=$@; mkdir -p $${f%/*} ;; esac
  26. $(CC) -c -o $@ $< $(CFLAGS)
  27. $(BUILD_DIR)/%.o: %.s
  28. case $@ in */*) f=$@; mkdir -p $${f%/*} ;; esac
  29. $(CC) -c -o $@ $< $(CFLAGS)
  30. all: libcsidh torturer vector-creator
  31. libcsidh: $(CODE_OBJ)
  32. mkdir -p $(PRJ_DIR)/$(BIN_DIR)
  33. $(AR) $(BIN_DIR)/libcsidh.a $^
  34. $(RANLIB) $(BIN_DIR)/libcsidh.a
  35. $(CC) -o $(BIN_DIR)/test_ref ref/test/main.c -L$(BIN_DIR) -lcsidh
  36. clean:
  37. rm -rf build
  38. rm -rf bin
  39. torturer: $(BUILD_DIR)/.ok
  40. GOPATH=$(GOPATH_LOCAL) $(GO) install $(IMPORT_PATH)/cmd/$@
  41. vector-creator: $(BUILD_DIR)/.ok
  42. GOPATH=$(GOPATH_LOCAL) $(GO) install $(IMPORT_PATH)/cmd/$@
  43. $(BUILD_DIR)/.ok:
  44. mkdir -p "$(dir $(BUILD_DIR)/src/$(IMPORT_PATH))"
  45. ln -s `pwd` "$(BUILD_DIR)/src/$(IMPORT_PATH)"
  46. mkdir -p bin
  47. ln -s `pwd`/bin $(BUILD_DIR)/bin
  48. touch $@