summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKévin Le Gouguec <kevin.legouguec@airbus.com>2018-11-28 15:54:40 +0100
committerKévin Le Gouguec <kevin.legouguec@airbus.com>2018-11-28 15:54:40 +0100
commit23ed93cfd97ea7f5131805f90e9e7d34bfcaff66 (patch)
treec9fb46afae4065c1afb62cb222c65baafe182567
parenta3248db69b143ccbbe92560ff1409487cf8ac7cf (diff)
downloadlilliput-ae-implem-23ed93cfd97ea7f5131805f90e9e7d34bfcaff66.tar.xz
Mutualisation de l'entête d'utilitaires de tests
-rw-r--r--crypto_aead/lilliputaei128v1/ref/test/test-ae-decrypt.c2
-rw-r--r--crypto_aead/lilliputaei128v1/ref/test/test-ae-encrypt.c2
-rw-r--r--crypto_aead/lilliputaei128v1/ref/test/test-ae-roundtrip.c2
-rw-r--r--crypto_aead/lilliputaei128v1/ref/test/test-tbc-decrypt.c2
-rw-r--r--crypto_aead/lilliputaei128v1/ref/test/test-tbc-encrypt.c2
-rw-r--r--crypto_aead/lilliputaei128v1/ref/test/test-tweakey.c2
-rw-r--r--crypto_aead/lilliputaei128v1/ref/test/traces-ae-128-i.c2
-rw-r--r--crypto_aead/lilliputaei192v1/ref/test/helpers.h33
-rw-r--r--crypto_aead/lilliputaei192v1/ref/test/test-ae-roundtrip.c2
-rw-r--r--crypto_aead/lilliputaei192v1/ref/test/traces-ae-192-i.c2
-rw-r--r--crypto_aead/lilliputaeii128v1/ref/test/helpers.h33
-rw-r--r--crypto_aead/lilliputaeii128v1/ref/test/test-ae-roundtrip.c2
-rw-r--r--crypto_aead/lilliputaeii128v1/ref/test/traces-ae-128-ii.c2
-rw-r--r--crypto_aead/lilliputaeii192v1/ref/test/helpers.h33
-rw-r--r--crypto_aead/lilliputaeii192v1/ref/test/test-ae-roundtrip.c2
-rw-r--r--crypto_aead/lilliputaeii192v1/ref/test/traces-ae-192-ii.c2
-rw-r--r--src/common.mk4
-rw-r--r--src/test-helpers.h (renamed from crypto_aead/lilliputaei128v1/ref/test/helpers.h)6
18 files changed, 18 insertions, 117 deletions
diff --git a/crypto_aead/lilliputaei128v1/ref/test/test-ae-decrypt.c b/crypto_aead/lilliputaei128v1/ref/test/test-ae-decrypt.c
index c72857e..8ae6308 100644
--- a/crypto_aead/lilliputaei128v1/ref/test/test-ae-decrypt.c
+++ b/crypto_aead/lilliputaei128v1/ref/test/test-ae-decrypt.c
@@ -4,7 +4,7 @@
#include "lilliput-ae.h"
-#include "helpers.h"
+#include "test-helpers.h"
struct vector
diff --git a/crypto_aead/lilliputaei128v1/ref/test/test-ae-encrypt.c b/crypto_aead/lilliputaei128v1/ref/test/test-ae-encrypt.c
index 205a69c..9a7dce0 100644
--- a/crypto_aead/lilliputaei128v1/ref/test/test-ae-encrypt.c
+++ b/crypto_aead/lilliputaei128v1/ref/test/test-ae-encrypt.c
@@ -4,7 +4,7 @@
#include "lilliput-ae.h"
-#include "helpers.h"
+#include "test-helpers.h"
struct vector
diff --git a/crypto_aead/lilliputaei128v1/ref/test/test-ae-roundtrip.c b/crypto_aead/lilliputaei128v1/ref/test/test-ae-roundtrip.c
index c9b2a1c..80ac737 100644
--- a/crypto_aead/lilliputaei128v1/ref/test/test-ae-roundtrip.c
+++ b/crypto_aead/lilliputaei128v1/ref/test/test-ae-roundtrip.c
@@ -4,7 +4,7 @@
#include "lilliput-ae.h"
-#include "helpers.h"
+#include "test-helpers.h"
struct vector
diff --git a/crypto_aead/lilliputaei128v1/ref/test/test-tbc-decrypt.c b/crypto_aead/lilliputaei128v1/ref/test/test-tbc-decrypt.c
index 6bd78ef..9bd6996 100644
--- a/crypto_aead/lilliputaei128v1/ref/test/test-tbc-decrypt.c
+++ b/crypto_aead/lilliputaei128v1/ref/test/test-tbc-decrypt.c
@@ -4,7 +4,7 @@
#include "cipher.h"
-#include "helpers.h"
+#include "test-helpers.h"
struct vector
diff --git a/crypto_aead/lilliputaei128v1/ref/test/test-tbc-encrypt.c b/crypto_aead/lilliputaei128v1/ref/test/test-tbc-encrypt.c
index 2d116b9..60cc9cf 100644
--- a/crypto_aead/lilliputaei128v1/ref/test/test-tbc-encrypt.c
+++ b/crypto_aead/lilliputaei128v1/ref/test/test-tbc-encrypt.c
@@ -4,7 +4,7 @@
#include "cipher.h"
-#include "helpers.h"
+#include "test-helpers.h"
struct vector
diff --git a/crypto_aead/lilliputaei128v1/ref/test/test-tweakey.c b/crypto_aead/lilliputaei128v1/ref/test/test-tweakey.c
index 7d2e08a..a10981f 100644
--- a/crypto_aead/lilliputaei128v1/ref/test/test-tweakey.c
+++ b/crypto_aead/lilliputaei128v1/ref/test/test-tweakey.c
@@ -4,7 +4,7 @@
#include "tweakey.h"
-#include "helpers.h"
+#include "test-helpers.h"
struct vector
diff --git a/crypto_aead/lilliputaei128v1/ref/test/traces-ae-128-i.c b/crypto_aead/lilliputaei128v1/ref/test/traces-ae-128-i.c
index 2467084..223ab2e 100644
--- a/crypto_aead/lilliputaei128v1/ref/test/traces-ae-128-i.c
+++ b/crypto_aead/lilliputaei128v1/ref/test/traces-ae-128-i.c
@@ -4,7 +4,7 @@
#include "lilliput-ae.h"
#include "debug.h"
-#include "helpers.h"
+#include "test-helpers.h"
FILE *DUMP;
diff --git a/crypto_aead/lilliputaei192v1/ref/test/helpers.h b/crypto_aead/lilliputaei192v1/ref/test/helpers.h
deleted file mode 100644
index 0e1b3c2..0000000
--- a/crypto_aead/lilliputaei192v1/ref/test/helpers.h
+++ /dev/null
@@ -1,33 +0,0 @@
-#ifndef HELPERS_H
-#define HELPERS_H
-
-#include <stdint.h>
-#include <stdio.h>
-
-#include "parameters.h"
-
-
-#define ARRAY_NB(A) (sizeof(A)/sizeof(A[0]))
-#define ARRAY_END(A) (A+ARRAY_NB(A))
-
-#define REPORT_DIFFERENCE(VECTOR, ELEMENT) do { \
- fprintf(stderr, "%s: vector %s: %s differs from expected\n", \
- __FILE__, (VECTOR), (ELEMENT)); \
- } while (0)
-
-#define REPORT_INVALID(VECTOR) do { \
- fprintf(stderr, "%s: vector %s: ciphertext/tag invalid\n", \
- __FILE__, (VECTOR)); \
- } while (0)
-
-
-static inline FILE* open_dump_file(const char *folder, const char* vector, const char *name)
-{
- size_t filename_len = snprintf(NULL, 0, "%s/%s_%s.txt", folder, vector, name);
- char filename[filename_len+1];
- snprintf(filename, sizeof(filename), "%s/%s_%s.txt", folder, vector, name);
- return fopen(filename, "w");
-}
-
-
-#endif /* HELPERS_H */
diff --git a/crypto_aead/lilliputaei192v1/ref/test/test-ae-roundtrip.c b/crypto_aead/lilliputaei192v1/ref/test/test-ae-roundtrip.c
index ff8c639..7298128 100644
--- a/crypto_aead/lilliputaei192v1/ref/test/test-ae-roundtrip.c
+++ b/crypto_aead/lilliputaei192v1/ref/test/test-ae-roundtrip.c
@@ -4,7 +4,7 @@
#include "lilliput-ae.h"
-#include "helpers.h"
+#include "test-helpers.h"
struct vector
diff --git a/crypto_aead/lilliputaei192v1/ref/test/traces-ae-192-i.c b/crypto_aead/lilliputaei192v1/ref/test/traces-ae-192-i.c
index 3ee68c3..84d3355 100644
--- a/crypto_aead/lilliputaei192v1/ref/test/traces-ae-192-i.c
+++ b/crypto_aead/lilliputaei192v1/ref/test/traces-ae-192-i.c
@@ -4,7 +4,7 @@
#include "lilliput-ae.h"
#include "debug.h"
-#include "helpers.h"
+#include "test-helpers.h"
FILE *DUMP;
diff --git a/crypto_aead/lilliputaeii128v1/ref/test/helpers.h b/crypto_aead/lilliputaeii128v1/ref/test/helpers.h
deleted file mode 100644
index 0e1b3c2..0000000
--- a/crypto_aead/lilliputaeii128v1/ref/test/helpers.h
+++ /dev/null
@@ -1,33 +0,0 @@
-#ifndef HELPERS_H
-#define HELPERS_H
-
-#include <stdint.h>
-#include <stdio.h>
-
-#include "parameters.h"
-
-
-#define ARRAY_NB(A) (sizeof(A)/sizeof(A[0]))
-#define ARRAY_END(A) (A+ARRAY_NB(A))
-
-#define REPORT_DIFFERENCE(VECTOR, ELEMENT) do { \
- fprintf(stderr, "%s: vector %s: %s differs from expected\n", \
- __FILE__, (VECTOR), (ELEMENT)); \
- } while (0)
-
-#define REPORT_INVALID(VECTOR) do { \
- fprintf(stderr, "%s: vector %s: ciphertext/tag invalid\n", \
- __FILE__, (VECTOR)); \
- } while (0)
-
-
-static inline FILE* open_dump_file(const char *folder, const char* vector, const char *name)
-{
- size_t filename_len = snprintf(NULL, 0, "%s/%s_%s.txt", folder, vector, name);
- char filename[filename_len+1];
- snprintf(filename, sizeof(filename), "%s/%s_%s.txt", folder, vector, name);
- return fopen(filename, "w");
-}
-
-
-#endif /* HELPERS_H */
diff --git a/crypto_aead/lilliputaeii128v1/ref/test/test-ae-roundtrip.c b/crypto_aead/lilliputaeii128v1/ref/test/test-ae-roundtrip.c
index c9b2a1c..80ac737 100644
--- a/crypto_aead/lilliputaeii128v1/ref/test/test-ae-roundtrip.c
+++ b/crypto_aead/lilliputaeii128v1/ref/test/test-ae-roundtrip.c
@@ -4,7 +4,7 @@
#include "lilliput-ae.h"
-#include "helpers.h"
+#include "test-helpers.h"
struct vector
diff --git a/crypto_aead/lilliputaeii128v1/ref/test/traces-ae-128-ii.c b/crypto_aead/lilliputaeii128v1/ref/test/traces-ae-128-ii.c
index 141672b..853d3d5 100644
--- a/crypto_aead/lilliputaeii128v1/ref/test/traces-ae-128-ii.c
+++ b/crypto_aead/lilliputaeii128v1/ref/test/traces-ae-128-ii.c
@@ -4,7 +4,7 @@
#include "lilliput-ae.h"
#include "debug.h"
-#include "helpers.h"
+#include "test-helpers.h"
FILE *DUMP;
diff --git a/crypto_aead/lilliputaeii192v1/ref/test/helpers.h b/crypto_aead/lilliputaeii192v1/ref/test/helpers.h
deleted file mode 100644
index 0e1b3c2..0000000
--- a/crypto_aead/lilliputaeii192v1/ref/test/helpers.h
+++ /dev/null
@@ -1,33 +0,0 @@
-#ifndef HELPERS_H
-#define HELPERS_H
-
-#include <stdint.h>
-#include <stdio.h>
-
-#include "parameters.h"
-
-
-#define ARRAY_NB(A) (sizeof(A)/sizeof(A[0]))
-#define ARRAY_END(A) (A+ARRAY_NB(A))
-
-#define REPORT_DIFFERENCE(VECTOR, ELEMENT) do { \
- fprintf(stderr, "%s: vector %s: %s differs from expected\n", \
- __FILE__, (VECTOR), (ELEMENT)); \
- } while (0)
-
-#define REPORT_INVALID(VECTOR) do { \
- fprintf(stderr, "%s: vector %s: ciphertext/tag invalid\n", \
- __FILE__, (VECTOR)); \
- } while (0)
-
-
-static inline FILE* open_dump_file(const char *folder, const char* vector, const char *name)
-{
- size_t filename_len = snprintf(NULL, 0, "%s/%s_%s.txt", folder, vector, name);
- char filename[filename_len+1];
- snprintf(filename, sizeof(filename), "%s/%s_%s.txt", folder, vector, name);
- return fopen(filename, "w");
-}
-
-
-#endif /* HELPERS_H */
diff --git a/crypto_aead/lilliputaeii192v1/ref/test/test-ae-roundtrip.c b/crypto_aead/lilliputaeii192v1/ref/test/test-ae-roundtrip.c
index ff8c639..7298128 100644
--- a/crypto_aead/lilliputaeii192v1/ref/test/test-ae-roundtrip.c
+++ b/crypto_aead/lilliputaeii192v1/ref/test/test-ae-roundtrip.c
@@ -4,7 +4,7 @@
#include "lilliput-ae.h"
-#include "helpers.h"
+#include "test-helpers.h"
struct vector
diff --git a/crypto_aead/lilliputaeii192v1/ref/test/traces-ae-192-ii.c b/crypto_aead/lilliputaeii192v1/ref/test/traces-ae-192-ii.c
index f1befa2..ea48b4b 100644
--- a/crypto_aead/lilliputaeii192v1/ref/test/traces-ae-192-ii.c
+++ b/crypto_aead/lilliputaeii192v1/ref/test/traces-ae-192-ii.c
@@ -4,7 +4,7 @@
#include "lilliput-ae.h"
#include "debug.h"
-#include "helpers.h"
+#include "test-helpers.h"
FILE *DUMP;
diff --git a/src/common.mk b/src/common.mk
index 22bd3ca..54ab986 100644
--- a/src/common.mk
+++ b/src/common.mk
@@ -49,8 +49,8 @@ results/src/cipher.o: src/cipher.h src/tweakey.h src/constants.h src/parameters.
results/src/constants.o: src/constants.h
results/src/lilliput-ae-i.o: src/lilliput-ae.h src/cipher.h src/constants.h src/parameters.h _parameters.h
results/src/tweakey.o: src/tweakey.h src/constants.h src/parameters.h _parameters.h
-results/test-*.o: test/helpers.h src/parameters.h _parameters.h
-results/traces-%.o: test/helpers.h src/parameters.h _parameters.h
+results/test-*.o: src/test-helpers.h src/parameters.h _parameters.h
+results/traces-%.o: src/test-helpers.h src/parameters.h _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
diff --git a/crypto_aead/lilliputaei128v1/ref/test/helpers.h b/src/test-helpers.h
index 0e1b3c2..1991542 100644
--- a/crypto_aead/lilliputaei128v1/ref/test/helpers.h
+++ b/src/test-helpers.h
@@ -1,5 +1,5 @@
-#ifndef HELPERS_H
-#define HELPERS_H
+#ifndef TEST_HELPERS_H
+#define TEST_HELPERS_H
#include <stdint.h>
#include <stdio.h>
@@ -30,4 +30,4 @@ static inline FILE* open_dump_file(const char *folder, const char* vector, const
}
-#endif /* HELPERS_H */
+#endif /* TEST_HELPERS_H */