diff options
| author | Kévin Le Gouguec <kevin.legouguec@airbus.com> | 2018-12-04 08:15:59 +0100 |
|---|---|---|
| committer | Kévin Le Gouguec <kevin.legouguec@airbus.com> | 2018-12-04 10:40:58 +0100 |
| commit | dded798f1a038c8482fcc5d41824a9161d0a60c2 (patch) | |
| tree | a52436ee5e61d639aaceaeae2efb587a6e68f57b | |
| parent | 950bd7432cd486d29503444b0557d7a1452efd07 (diff) | |
| download | lilliput-ae-implem-dded798f1a038c8482fcc5d41824a9161d0a60c2.tar.xz | |
[WIP] screw with folders organization
| -rw-r--r-- | Makefile | 19 | ||||
| -rw-r--r-- | src/i-128/_parameters.h (renamed from crypto_aead/lilliputaei128v1/ref/_parameters.h) | 0 | ||||
| -rw-r--r-- | src/i-192/_parameters.h (renamed from crypto_aead/lilliputaei192v1/ref/_parameters.h) | 0 | ||||
| -rw-r--r-- | src/i-256/_parameters.h (renamed from crypto_aead/lilliputaei256v1/ref/_parameters.h) | 0 | ||||
| -rw-r--r-- | src/ii-128/_parameters.h (renamed from crypto_aead/lilliputaeii128v1/ref/_parameters.h) | 0 | ||||
| -rw-r--r-- | src/ii-192/_parameters.h (renamed from crypto_aead/lilliputaeii192v1/ref/_parameters.h) | 0 | ||||
| -rw-r--r-- | src/ii-256/_parameters.h (renamed from crypto_aead/lilliputaeii256v1/ref/_parameters.h) | 0 | ||||
| -rw-r--r-- | test/common.mk | 66 | ||||
| -rw-r--r-- | test/i-128/Makefile (renamed from crypto_aead/lilliputaei128v1/ref/Makefile) | 8 | ||||
| -rw-r--r-- | test/i-128/test-ae-decrypt.c (renamed from crypto_aead/lilliputaei128v1/ref/test/test-ae-decrypt.c) | 0 | ||||
| -rw-r--r-- | test/i-128/test-ae-encrypt.c (renamed from crypto_aead/lilliputaei128v1/ref/test/test-ae-encrypt.c) | 0 | ||||
| -rw-r--r-- | test/i-128/test-ae-roundtrip.c (renamed from crypto_aead/lilliputaei128v1/ref/test/test-ae-roundtrip.c) | 0 | ||||
| -rw-r--r-- | test/i-128/test-tbc-decrypt.c (renamed from crypto_aead/lilliputaei128v1/ref/test/test-tbc-decrypt.c) | 0 | ||||
| -rw-r--r-- | test/i-128/test-tbc-encrypt.c (renamed from crypto_aead/lilliputaei128v1/ref/test/test-tbc-encrypt.c) | 0 | ||||
| -rw-r--r-- | test/i-128/test-tweakey.c (renamed from crypto_aead/lilliputaei128v1/ref/test/test-tweakey.c) | 0 | ||||
| -rw-r--r-- | test/i-192/Makefile (renamed from crypto_aead/lilliputaei192v1/ref/Makefile) | 0 | ||||
| -rw-r--r-- | test/i-192/test-ae-roundtrip.c (renamed from crypto_aead/lilliputaei192v1/ref/test/test-ae-roundtrip.c) | 0 | ||||
| -rw-r--r-- | test/i-256/Makefile (renamed from crypto_aead/lilliputaei256v1/ref/Makefile) | 0 | ||||
| -rw-r--r-- | test/i-256/test-ae-roundtrip.c (renamed from crypto_aead/lilliputaei256v1/ref/test/test-ae-roundtrip.c) | 0 | ||||
| -rw-r--r-- | test/ii-128/Makefile (renamed from crypto_aead/lilliputaeii128v1/ref/Makefile) | 0 | ||||
| -rw-r--r-- | test/ii-128/test-ae-roundtrip.c (renamed from crypto_aead/lilliputaeii128v1/ref/test/test-ae-roundtrip.c) | 0 | ||||
| -rw-r--r-- | test/ii-192/Makefile (renamed from crypto_aead/lilliputaeii192v1/ref/Makefile) | 0 | ||||
| -rw-r--r-- | test/ii-192/test-ae-roundtrip.c (renamed from crypto_aead/lilliputaeii192v1/ref/test/test-ae-roundtrip.c) | 0 | ||||
| -rw-r--r-- | test/ii-256/Makefile (renamed from crypto_aead/lilliputaeii256v1/ref/Makefile) | 0 | ||||
| -rw-r--r-- | test/ii-256/test-ae-roundtrip.c (renamed from crypto_aead/lilliputaeii256v1/ref/test/test-ae-roundtrip.c) | 0 |
25 files changed, 79 insertions, 14 deletions
@@ -1,24 +1,25 @@ -implementations = $(dir \ - $(shell find crypto_aead -name Makefile) \ -) +modes = i ii +keylengths = 128 192 256 -delegated = clean test +tests = $(foreach m,$(modes),$(foreach l,$(keylengths),test/$(m)-$(l))) -.PHONY: $(delegated) nist + +.PHONY: clean nist test traces results: mkdir $@ -$(delegated):: +clean:: + - rm -r results + +test: status=0; \ - for i in $(implementations); \ + for i in $(tests); \ do \ make -C $$i $@ || status=1; \ done; \ exit $$status -clean:: - - rm -r results traces: traces-ae traces-tbc diff --git a/crypto_aead/lilliputaei128v1/ref/_parameters.h b/src/i-128/_parameters.h index 08ce8c1..08ce8c1 100644 --- a/crypto_aead/lilliputaei128v1/ref/_parameters.h +++ b/src/i-128/_parameters.h diff --git a/crypto_aead/lilliputaei192v1/ref/_parameters.h b/src/i-192/_parameters.h index d1dc476..d1dc476 100644 --- a/crypto_aead/lilliputaei192v1/ref/_parameters.h +++ b/src/i-192/_parameters.h diff --git a/crypto_aead/lilliputaei256v1/ref/_parameters.h b/src/i-256/_parameters.h index d948ac5..d948ac5 100644 --- a/crypto_aead/lilliputaei256v1/ref/_parameters.h +++ b/src/i-256/_parameters.h diff --git a/crypto_aead/lilliputaeii128v1/ref/_parameters.h b/src/ii-128/_parameters.h index 147730d..147730d 100644 --- a/crypto_aead/lilliputaeii128v1/ref/_parameters.h +++ b/src/ii-128/_parameters.h diff --git a/crypto_aead/lilliputaeii192v1/ref/_parameters.h b/src/ii-192/_parameters.h index 8b76285..8b76285 100644 --- a/crypto_aead/lilliputaeii192v1/ref/_parameters.h +++ b/src/ii-192/_parameters.h diff --git a/crypto_aead/lilliputaeii256v1/ref/_parameters.h b/src/ii-256/_parameters.h index 8bd0430..8bd0430 100644 --- a/crypto_aead/lilliputaeii256v1/ref/_parameters.h +++ b/src/ii-256/_parameters.h diff --git a/test/common.mk b/test/common.mk new file mode 100644 index 0000000..6d4cb28 --- /dev/null +++ b/test/common.mk @@ -0,0 +1,66 @@ +# use "make VERBOSE=1" to have full commands printed out. +VERBOSE = 0 +ifeq ($(VERBOSE),1) +Q = +else +Q = @ +endif + + +test_dir = $(dir $(lastword $(MAKEFILE_LIST))) +root_dir = $(test_dir)/.. +results_dir = $(root_dir)/results +src_dir = $(root_dir)/src + + +nist_flags = -std=c99 -Wall -Wextra -Wshadow -fsanitize=address,undefined -O2 +CFLAGS += -I$(src_dir) -I$(variant_dir) $(nist_flags) -Werror +LDFLAGS += $(nist_flags) + + +.PHONY: test + + +$(results_dir): + @ mkdir -p $@ + +$(results_dir)/%.o: $(src_dir)/%.c + @ mkdir -p $(dir $@) + @ echo "CC $@" + $(Q) gcc -c $< $(CFLAGS) -o $@ + +$(results_dir)/test-%: $(results_dir)/test/test-%.o + @ echo "LD $@" + $(Q) gcc $^ $(LDFLAGS) -o $@ + +$(results_dir)/traces-%: $(results_dir)/test/traces-%.o + @ echo "LD $@" + $(Q) gcc $^ $(LDFLAGS) -o $@ + + +$(results_dir)/$(src_dir)/cipher.o: $(src_dir)/cipher.h \ +$(src_dir)/tweakey.h $(src_dir)/constants.h $(src_dir)/parameters.h \ +$(variant_dir)/_parameters.h + +$(results_dir)/$(src_dir)/constants.o: $(src_dir)/constants.h + +$(results_dir)/$(src_dir)/lilliput-ae-i.o: $(src_dir)/lilliput-ae.h \ +$(src_dir)/cipher.h $(src_dir)/parameters.h \ +$(variant_dir)/_parameters.h + +$(results_dir)/$(src_dir)/lilliput-ae-ii.o: $(src_dir)/lilliput-ae.h \ +$(src_dir)/cipher.h $(src_dir)/parameters.h \ +$(variant_dir)/_parameters.h + +$(results_dir)/$(src_dir)/tweakey.o: $(src_dir)/tweakey.h \ +$(src_dir)/constants.h $(src_dir)/parameters.h \ +$(variant_dir)/_parameters.h + +$(results_dir)/test-*.o: $(src_dir)/test-helpers.h \ +$(src_dir)/parameters.h $(variant_dir)/_parameters.h + + +# TODO: should add order-only prerequisites to remove mkdirs inside recipes +# TODO: add valgrind, although it does not seem to play well with ASAN +# TODO: should use gcc -M... to generate .o -> .h dependencies +# TODO: move debug.h and test-helpers.h here diff --git a/crypto_aead/lilliputaei128v1/ref/Makefile b/test/i-128/Makefile index e126a75..3eb0a50 100644 --- a/crypto_aead/lilliputaei128v1/ref/Makefile +++ b/test/i-128/Makefile @@ -1,9 +1,7 @@ -tests = test-tweakey test-tbc-encrypt test-tbc-decrypt \ -test-ae-roundtrip test-ae-encrypt test-ae-decrypt +mode = i +keylen = 128 -traces = traces-ae-128-i traces-tbc-256-i - -include src/common.mk +include ../common.mk results/test-ae-decrypt: results/src/lilliput-ae-i.o results/src/cipher.o results/src/tweakey.o results/src/constants.o | results results/test-ae-encrypt: results/src/lilliput-ae-i.o results/src/cipher.o results/src/tweakey.o results/src/constants.o | results diff --git a/crypto_aead/lilliputaei128v1/ref/test/test-ae-decrypt.c b/test/i-128/test-ae-decrypt.c index 8ae6308..8ae6308 100644 --- a/crypto_aead/lilliputaei128v1/ref/test/test-ae-decrypt.c +++ b/test/i-128/test-ae-decrypt.c diff --git a/crypto_aead/lilliputaei128v1/ref/test/test-ae-encrypt.c b/test/i-128/test-ae-encrypt.c index 9a7dce0..9a7dce0 100644 --- a/crypto_aead/lilliputaei128v1/ref/test/test-ae-encrypt.c +++ b/test/i-128/test-ae-encrypt.c diff --git a/crypto_aead/lilliputaei128v1/ref/test/test-ae-roundtrip.c b/test/i-128/test-ae-roundtrip.c index 80ac737..80ac737 100644 --- a/crypto_aead/lilliputaei128v1/ref/test/test-ae-roundtrip.c +++ b/test/i-128/test-ae-roundtrip.c diff --git a/crypto_aead/lilliputaei128v1/ref/test/test-tbc-decrypt.c b/test/i-128/test-tbc-decrypt.c index 9bd6996..9bd6996 100644 --- a/crypto_aead/lilliputaei128v1/ref/test/test-tbc-decrypt.c +++ b/test/i-128/test-tbc-decrypt.c diff --git a/crypto_aead/lilliputaei128v1/ref/test/test-tbc-encrypt.c b/test/i-128/test-tbc-encrypt.c index 60cc9cf..60cc9cf 100644 --- a/crypto_aead/lilliputaei128v1/ref/test/test-tbc-encrypt.c +++ b/test/i-128/test-tbc-encrypt.c diff --git a/crypto_aead/lilliputaei128v1/ref/test/test-tweakey.c b/test/i-128/test-tweakey.c index 2b0bad5..2b0bad5 100644 --- a/crypto_aead/lilliputaei128v1/ref/test/test-tweakey.c +++ b/test/i-128/test-tweakey.c diff --git a/crypto_aead/lilliputaei192v1/ref/Makefile b/test/i-192/Makefile index c01fde4..c01fde4 100644 --- a/crypto_aead/lilliputaei192v1/ref/Makefile +++ b/test/i-192/Makefile diff --git a/crypto_aead/lilliputaei192v1/ref/test/test-ae-roundtrip.c b/test/i-192/test-ae-roundtrip.c index 7298128..7298128 100644 --- a/crypto_aead/lilliputaei192v1/ref/test/test-ae-roundtrip.c +++ b/test/i-192/test-ae-roundtrip.c diff --git a/crypto_aead/lilliputaei256v1/ref/Makefile b/test/i-256/Makefile index 738ec7b..738ec7b 100644 --- a/crypto_aead/lilliputaei256v1/ref/Makefile +++ b/test/i-256/Makefile diff --git a/crypto_aead/lilliputaei256v1/ref/test/test-ae-roundtrip.c b/test/i-256/test-ae-roundtrip.c index cd2ea42..cd2ea42 100644 --- a/crypto_aead/lilliputaei256v1/ref/test/test-ae-roundtrip.c +++ b/test/i-256/test-ae-roundtrip.c diff --git a/crypto_aead/lilliputaeii128v1/ref/Makefile b/test/ii-128/Makefile index 02496ce..02496ce 100644 --- a/crypto_aead/lilliputaeii128v1/ref/Makefile +++ b/test/ii-128/Makefile diff --git a/crypto_aead/lilliputaeii128v1/ref/test/test-ae-roundtrip.c b/test/ii-128/test-ae-roundtrip.c index 80ac737..80ac737 100644 --- a/crypto_aead/lilliputaeii128v1/ref/test/test-ae-roundtrip.c +++ b/test/ii-128/test-ae-roundtrip.c diff --git a/crypto_aead/lilliputaeii192v1/ref/Makefile b/test/ii-192/Makefile index a421206..a421206 100644 --- a/crypto_aead/lilliputaeii192v1/ref/Makefile +++ b/test/ii-192/Makefile diff --git a/crypto_aead/lilliputaeii192v1/ref/test/test-ae-roundtrip.c b/test/ii-192/test-ae-roundtrip.c index 7298128..7298128 100644 --- a/crypto_aead/lilliputaeii192v1/ref/test/test-ae-roundtrip.c +++ b/test/ii-192/test-ae-roundtrip.c diff --git a/crypto_aead/lilliputaeii256v1/ref/Makefile b/test/ii-256/Makefile index 906e1f0..906e1f0 100644 --- a/crypto_aead/lilliputaeii256v1/ref/Makefile +++ b/test/ii-256/Makefile diff --git a/crypto_aead/lilliputaeii256v1/ref/test/test-ae-roundtrip.c b/test/ii-256/test-ae-roundtrip.c index cd2ea42..cd2ea42 100644 --- a/crypto_aead/lilliputaeii256v1/ref/test/test-ae-roundtrip.c +++ b/test/ii-256/test-ae-roundtrip.c |
