Skip to content

Commit

Permalink
sct: towards jasmin-ct (2)
Browse files Browse the repository at this point in the history
  • Loading branch information
tfaoliveira committed Jun 26, 2024
1 parent 70eb190 commit 3a6c9b4
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 11 deletions.
7 changes: 3 additions & 4 deletions src/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ SRC := .
FILTER ?= $(SRC)/crypto_%
JAZZ ?= $(filter $(FILTER), $(filter-out $(addprefix ./,$(EXCLUDE)), $(sort $(dir $(shell find $(SRC) -name '*.jazz')))))
SAFETY ?= $(addsuffix safety, $(JAZZ))
SCT ?= $(addsuffix sct, $(JAZZ))
SCT ?= $(addsuffix check_sct, $(JAZZ))

SOURCES ?= $(filter-out ./, $(sort $(dir $(shell find $(SRC) -name 'Makefile'))))
ASM := $(shell find $(SRC) -name '*.s')
Expand Down Expand Up @@ -74,9 +74,8 @@ $(SAFETY):
$(MAKE) -C $(@D) $(@F) || true

# --------------------------------------------------------------------

.PHONY: sct
sct: $(SCT)
.PHONY: check_sct
check_sct: $(SCT)

$(SCT):
$(MAKE) -C $(@D) $(@F) || true
Expand Down
24 changes: 19 additions & 5 deletions src/Makefile.checksct
Original file line number Diff line number Diff line change
Expand Up @@ -3,27 +3,41 @@
# functions
# - it is meant to be included by Makefile.common

# JASMIN_CT belongs here (and not Makefile.common): some options differ from jasminc
JASMIN_CT ?= jasmin-ct

ifneq ($(OP),)

# TODO: remove --infer
# TODO: remove --infer and annotate exported functions
SCT_FLAGS ?= --infer

CHECK_SCT_SLICE = ($(JASMIN_CT) $(JINCLUDE) -slice $* --sct $(SCT_FLAGS) $< > $@ 2>&1) $(CIT)
CHECK_SCT = ($(JASMIN_CT) $(JINCLUDE) --sct $(SCT_FLAGS) $< > $@ 2>&1) $(CIT)
CHECK_SCT_SLICE = (JASMINPATH="Jade=$(SRC)" $(JASMIN_CT) --slice $* --sct $(SCT_FLAGS) $< > $@ 2>&1) $(CIT)
CHECK_SCT_SLICE_STDOUT = (JASMINPATH="Jade=$(SRC)" $(JASMIN_CT) --slice $* --sct $(SCT_FLAGS) $< ) $(CIT)

CHECK_SCT = (JASMINPATH="Jade=$(SRC)" $(JASMIN_CT) --sct $(SCT_FLAGS) $< > $@ 2>&1) $(CIT)
CHECK_SCT_STDOUT = (JASMINPATH="Jade=$(SRC)" $(JASMIN_CT) --sct $(SCT_FLAGS) $< ) $(CIT)

SCT_TARGETS = $(addsuffix .sct, $(FUNCTIONS))
SCT_TARGETS = $(addsuffix .sct, $(FUNCTIONS))
SCT_TARGETS_STDOUT = $(addsuffix .stdout, $(SCT_TARGETS))

sct: $(SCT_TARGETS)
check_sct: $(SCT_TARGETS)

$(OP).sct : $(OP).jazz $(DEPS_DIR)/$(OP).sct.d | $(DEPS_DIR) $(CI_DIR)
$(DEPS)
$(CHECK_SCT)

$(OP).sct.stdout : $(OP).jazz | $(CI_DIR)
$(CHECK_SCT_STDOUT)

$(SCT_TARGETS):
%.sct : $(OP).jazz $(DEPS_DIR)/%.sct.d | $(DEPS_DIR) $(CI_DIR)
$(DEPS)
$(CHECK_SCT_SLICE)

$(SCT_TARGETS_STDOUT):
%.sct.stdout : $(OP).jazz | $(CI_DIR)
$(CHECK_SCT_SLICE_STDOUT)

DEPFILES := \
$(DEPFILES) \
$(addprefix $(DEPS_DIR)/, $(addsuffix .sct.d, $(FUNCTIONS) $(OP)))
Expand Down
2 changes: 0 additions & 2 deletions src/Makefile.common
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,6 @@ JASMIN ?= jasminc
JASMINC := $(JASMIN) $(JFLAGS) $(JINCLUDE)
COMPILE = ($(JASMINC) -o $@ $<) $(CIT)

JASMIN_CT ?= jasmin-ct

# --------------------------------------------------------------------
include $(SRC)/$(OPERATION)/EcFlags.mk

Expand Down

0 comments on commit 3a6c9b4

Please sign in to comment.