diff --git a/.github/workflows/amd64-linux.yml b/.github/workflows/amd64-linux.yml index f1b2742..fd9fff0 100644 --- a/.github/workflows/amd64-linux.yml +++ b/.github/workflows/amd64-linux.yml @@ -15,6 +15,8 @@ jobs: steps: - name: checkout uses: actions/checkout@v4 + - name: preprocess + run: make -j$JOBS -C src/ CI=1 preprocess-inplace - name: check safety run: make -j$JOBS -C src/ CI=1 check-safety @@ -28,6 +30,8 @@ jobs: steps: - name: checkout uses: actions/checkout@v4 + - name: preprocess + run: make -j$JOBS -C src/ CI=1 preprocess-inplace - name: check speculative constant-time (v1) run: make -j$JOBS -C src/ CI=1 check-sct @@ -41,6 +45,8 @@ jobs: steps: - name: checkout uses: actions/checkout@v4 + - name: preprocess + run: make -j$JOBS -C src/ CI=1 preprocess-inplace - name: check extraction from Jasmin to EasyCrypt run: make -j$JOBS -C src/ CI=1 extract-to-easycrypt @@ -54,6 +60,8 @@ jobs: steps: - name: checkout uses: actions/checkout@v4 + - name: preprocess + run: make -j$JOBS -C src/ CI=1 preprocess-inplace - name: check compilation of libformosa25519.a run: make -j$JOBS -C src/ CI=1 libformosa25519.a @@ -68,6 +76,8 @@ jobs: steps: - name: checkout uses: actions/checkout@v4 + - name: preprocess + run: make -j$JOBS -C src/ CI=1 preprocess-inplace - name: run tests run: make -j$JOBS -C test/ @@ -80,6 +90,8 @@ jobs: uses: actions/checkout@v4 with: submodules: recursive + - name: preprocess + run: make -j$JOBS -C src/ CI=1 preprocess-inplace - name: run benchmarks run: make -j$JOBS -C bench/ @@ -90,6 +102,8 @@ jobs: steps: - name: checkout uses: actions/checkout@v4 + - name: preprocess + run: make -j$JOBS -C src/ CI=1 preprocess-inplace - name: run proof run: make -j$JOBS -C proof/ all-no-report diff --git a/scripts/releaser/jpp-slim b/scripts/releaser/jpp-slim new file mode 100755 index 0000000..c084ba7 --- /dev/null +++ b/scripts/releaser/jpp-slim @@ -0,0 +1,37 @@ +#!/usr/bin/env perl + +use strict; +use warnings; + +our $R = '^'.'[\s]*'.'(?:from[\s]+(\w+)[\s+])?'.'[\s]*'.'require'.'[\s]*'.'"'.'([\w./_-]+)'.'"'; + +sub jpp_slim_main() +{ my $f = rp($ARGV[0]); + my %i = map { my ($a,$b) = split /:/; $b = rp($b); ($a, $b) } split /;/, $ARGV[1]; + pp($f, \%i, {}); +} + +sub rp { chomp(my $p = `realpath $_[0]`); $p } +sub ld { open my $f, '<', $_[0]; chomp(my @s = <$f>); @s } +sub pc { print "//$_\n" } +sub pn { print "$_\n" } + +sub ppl +{ my ($d, $l, $i, $v) = @_; + ($l =~ m/$R/) ? + do { pc $l; pp( rp((defined $1)?$i->{$1}."/".$2 : rp($d."/".$2)), $i, $v) } : + pn $l +} + +sub pp +{ my ($f, $i, $v) = @_; + return if defined $v->{$f}; + $v->{$f} = 1; + chomp(my $d = `dirname $f`); + map { ppl($d, $_, $i, $v) } (ld $f) +} + +unless (caller) { jpp_slim_main(); } + +1; + diff --git a/src/Makefile b/src/Makefile index 30831c1..b44d8bd 100644 --- a/src/Makefile +++ b/src/Makefile @@ -192,7 +192,7 @@ all: $(MAKE) extract-to-easycrypt $(MAKE) libformosa25519.a $(MAKE) libformosa25519.h - $(MAKE) reporter + $(MAKE) -j1 reporter $(MAKE) err all-with-preprocess-inplace: CI=1 @@ -204,7 +204,7 @@ all-with-preprocess-inplace: $(MAKE) extract-to-easycrypt $(MAKE) libformosa25519.a $(MAKE) libformosa25519.h - $(MAKE) reporter + $(MAKE) -j1 reporter $(MAKE) err diff --git a/src/Makefile.common b/src/Makefile.common index cb7f304..a1873f1 100644 --- a/src/Makefile.common +++ b/src/Makefile.common @@ -47,7 +47,7 @@ JASMIN ?= jasminc JEXT ?= jazz override JFLAGS += -stack-zero loopSCT -noinsertarraycopy -JINCLUDE ?= -I formosa25519:$(SRC) +JINCLUDE ?=-I formosa25519:$(SRC) JASMIN_COMPILE = ($(JASMIN) $(JFLAGS) $(JINCLUDE) -o $@ $<) $(CI_CMD) @@ -56,9 +56,10 @@ ASSEMBLY_FILES = $(SRCS:%.$(JEXT)=%.s) # preprocessing vars -JPP ?= $(PROJECT_DIR)/scripts/releaser/jpp +JPP ?= $(PROJECT_DIR)/scripts/releaser/jpp-slim +JPP_JINCLUDE := $(subst -I,,$(JINCLUDE)) PREPROCESSED_FILES := $(SRCS:%.$(JEXT)=%.jpp) -JASMIN_PREPROCESS = ($(JPP) $(JINCLUDE) -b $(PROJECT_PARENT_DIR)/ -out $@ -in $<) $(CI_CMD) +JASMIN_PREPROCESS = ($(JPP) $< $(JPP_JINCLUDE) > $@) $(CI_CMD) # -----------------------------------------------------------------------------