commit dded798f1a038c8482fcc5d41824a9161d0a60c2 parent 950bd7432cd486d29503444b0557d7a1452efd07 Author: Kévin Le Gouguec <kevin.legouguec@airbus.com> Date: Tue, 4 Dec 2018 08:15:59 +0100 [WIP] screw with folders organization Diffstat:
26 files changed, 97 insertions(+), 32 deletions(-)
diff --git a/Makefile b/Makefile @@ -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/Makefile b/crypto_aead/lilliputaei128v1/ref/Makefile @@ -1,23 +0,0 @@ -tests = test-tweakey test-tbc-encrypt test-tbc-decrypt \ -test-ae-roundtrip test-ae-encrypt test-ae-decrypt - -traces = traces-ae-128-i traces-tbc-256-i - -include src/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 -results/test-ae-roundtrip: results/src/lilliput-ae-i.o results/src/cipher.o results/src/tweakey.o results/src/constants.o | results -results/test-tbc-decrypt: results/src/cipher.o results/src/tweakey.o results/src/constants.o | results -results/test-tbc-encrypt: results/src/cipher.o results/src/tweakey.o results/src/constants.o | results -results/test-tweakey: results/src/tweakey.o results/src/constants.o | results - -results/traces-ae-128-i: results/src/lilliput-ae-i.o results/src/cipher.o results/src/tweakey.o results/src/constants.o | results/src -results/traces-tbc-128-i: results/src/cipher.o results/src/tweakey.o results/src/constants.o | results/src - -results/test-ae-decrypt.o: src/lilliput-ae.h -results/test-ae-encrypt.o: src/lilliput-ae.h -results/test-ae-roundtrip.o: src/lilliput-ae.h -results/test-tbc-decrypt.o: src/cipher.h -results/test-tbc-encrypt.o: src/cipher.h -results/test-tweakey.o: src/tweakey.h diff --git 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 diff --git 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 diff --git 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 diff --git a/test/common.mk 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/test/i-128/Makefile b/test/i-128/Makefile @@ -0,0 +1,21 @@ +mode = i +keylen = 128 + +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 +results/test-ae-roundtrip: results/src/lilliput-ae-i.o results/src/cipher.o results/src/tweakey.o results/src/constants.o | results +results/test-tbc-decrypt: results/src/cipher.o results/src/tweakey.o results/src/constants.o | results +results/test-tbc-encrypt: results/src/cipher.o results/src/tweakey.o results/src/constants.o | results +results/test-tweakey: results/src/tweakey.o results/src/constants.o | results + +results/traces-ae-128-i: results/src/lilliput-ae-i.o results/src/cipher.o results/src/tweakey.o results/src/constants.o | results/src +results/traces-tbc-128-i: results/src/cipher.o results/src/tweakey.o results/src/constants.o | results/src + +results/test-ae-decrypt.o: src/lilliput-ae.h +results/test-ae-encrypt.o: src/lilliput-ae.h +results/test-ae-roundtrip.o: src/lilliput-ae.h +results/test-tbc-decrypt.o: src/cipher.h +results/test-tbc-encrypt.o: src/cipher.h +results/test-tweakey.o: src/tweakey.h diff --git 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 diff --git 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 diff --git 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 diff --git 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 diff --git 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 diff --git 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 diff --git 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 diff --git 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