Skip to content

Commit

Permalink
jpp slim (no perl deps to preprocess); CI switched to preprocessed fi…
Browse files Browse the repository at this point in the history
…les - the ones to be deployed out there
  • Loading branch information
tfaoliveira-sb committed Oct 3, 2024
1 parent 4e59a8f commit 768c36a
Show file tree
Hide file tree
Showing 4 changed files with 57 additions and 5 deletions.
14 changes: 14 additions & 0 deletions .github/workflows/amd64-linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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/
Expand All @@ -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/
Expand All @@ -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
Expand Down
37 changes: 37 additions & 0 deletions scripts/releaser/jpp-slim
Original file line number Diff line number Diff line change
@@ -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;

4 changes: 2 additions & 2 deletions src/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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


Expand Down
7 changes: 4 additions & 3 deletions src/Makefile.common
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand All @@ -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)


# -----------------------------------------------------------------------------
Expand Down

0 comments on commit 768c36a

Please sign in to comment.