From 97d1aae2b73c4d715cbf410ab1917f626748a65e Mon Sep 17 00:00:00 2001 From: Tiago Oliveira Date: Fri, 26 Jul 2024 13:12:32 +0100 Subject: [PATCH] test: --- Makefile | 28 +++++++++++++++++++++++--- code/jasmin/mlkem_avx2/Makefile | 2 +- code/jasmin/mlkem_avx2/example/api.h | 2 +- code/jasmin/mlkem_avx2/test/test_kem.c | 2 +- code/jasmin/mlkem_ref/Makefile | 2 +- code/jasmin/mlkem_ref/test/test_kem.c | 2 +- 6 files changed, 30 insertions(+), 8 deletions(-) diff --git a/Makefile b/Makefile index 71fd1aad..b36e18c1 100644 --- a/Makefile +++ b/Makefile @@ -5,18 +5,40 @@ ECCONF := config/tests.config CHECKS ?= mlkem # -------------------------------------------------------------------- -.PHONY: default check checkec jasmin clean_eco +.PHONY: default check checkec jasmin clean_eco test bench default: check check: jasmin checkec jasmin: - make -C code/jasmin/mlkem_ref/extraction - make -C code/jasmin/mlkem_avx2/extraction + $(MAKE) -C code/jasmin/mlkem_ref/extraction + $(MAKE) -C code/jasmin/mlkem_avx2/extraction checkec: easycrypt runtest $(ECCONF) $(CHECKS) clean_eco: find proof -name '*.eco' -exec rm '{}' ';' + +test: + $(MAKE) -C code/jasmin/mlkem_ref/ -j$(nproc) compile-tests + $(MAKE) -C code/jasmin/mlkem_avx2/ -j$(nproc) compile-tests + @echo "\n\n### Testing the reference implementation" + $(MAKE) -C code/jasmin/mlkem_ref/ run-tests + @echo "\n\n### Testing the avx2 implementation" + $(MAKE) -C code/jasmin/mlkem_avx2/ run-tests + +bench: + $(MAKE) -C code/jasmin/mlkem_ref/ -j$(nproc) compile-speed + $(MAKE) -C code/jasmin/mlkem_avx2/ -j$(nproc) compile-speed + @echo "\n\n### Benchmarking the reference implementation" + $(MAKE) -C code/jasmin/mlkem_ref/ run-speed + @echo "\n\n### Benchmarking the avx2 implementation" + $(MAKE) -C code/jasmin/mlkem_avx2/ run-speed + +example: + $(MAKE) -C code/jasmin/mlkem_ref/example + $(MAKE) -C code/jasmin/mlkem_avx2/example + + diff --git a/code/jasmin/mlkem_avx2/Makefile b/code/jasmin/mlkem_avx2/Makefile index 32eb93b6..b1cd5c6c 100644 --- a/code/jasmin/mlkem_avx2/Makefile +++ b/code/jasmin/mlkem_avx2/Makefile @@ -157,7 +157,7 @@ run-tests-polyvec: compile-tests-polyvec for i in $(TESTS_POLYVEC); do ./$$i; done run-tests: compile-tests - for i in $(TESTS); do ./$$i; done + @for i in $(TESTS); do ./$$i; done # -- diff --git a/code/jasmin/mlkem_avx2/example/api.h b/code/jasmin/mlkem_avx2/example/api.h index f2d372b6..7e9a8b82 100644 --- a/code/jasmin/mlkem_avx2/example/api.h +++ b/code/jasmin/mlkem_avx2/example/api.h @@ -12,7 +12,7 @@ #define JADE_KEM_mlkem_mlkem768_amd64_avx2_ALGNAME "mlkem768" #define JADE_KEM_mlkem_mlkem768_amd64_avx2_ARCH "amd64" -#define JADE_KEM_mlkem_mlkem768_amd64_avx2_IMPL "ref" +#define JADE_KEM_mlkem_mlkem768_amd64_avx2_IMPL "avx2" int jade_kem_mlkem_mlkem768_amd64_avx2_keypair_derand( uint8_t *public_key, diff --git a/code/jasmin/mlkem_avx2/test/test_kem.c b/code/jasmin/mlkem_avx2/test/test_kem.c index 1e915ab1..44d7f526 100644 --- a/code/jasmin/mlkem_avx2/test/test_kem.c +++ b/code/jasmin/mlkem_avx2/test/test_kem.c @@ -132,7 +132,7 @@ int main(void) { printf("OK: kem_dec_success\n"); } if(test_ok_kem_dec_failure == 1) - { printf("OK: kem_dec_failure (corrupting byte)\n"); } + { printf("OK: kem_dec_failure (it is the corrupting byte test)\n"); } return 0; } diff --git a/code/jasmin/mlkem_ref/Makefile b/code/jasmin/mlkem_ref/Makefile index 1d0dde62..13b9392c 100644 --- a/code/jasmin/mlkem_ref/Makefile +++ b/code/jasmin/mlkem_ref/Makefile @@ -140,7 +140,7 @@ run-tests-polyvec: compile-tests-polyvec for i in $(TESTS_POLYVEC); do ./$$i; done run-tests: compile-tests - for i in $(TESTS); do ./$$i; done + @for i in $(TESTS); do ./$$i; done # -- diff --git a/code/jasmin/mlkem_ref/test/test_kem.c b/code/jasmin/mlkem_ref/test/test_kem.c index b1ca29cd..ecce661e 100644 --- a/code/jasmin/mlkem_ref/test/test_kem.c +++ b/code/jasmin/mlkem_ref/test/test_kem.c @@ -132,7 +132,7 @@ int main(void) { printf("OK: kem_dec_success\n"); } if(test_ok_kem_dec_failure == 1) - { printf("OK: kem_dec_failure (corrupting byte)\n"); } + { printf("OK: kem_dec_failure (it is the corrupting byte test)\n"); } return 0; }