From bd03e27a8be67357b441bbdae00ce10447bd55e7 Mon Sep 17 00:00:00 2001 From: Kévin Le Gouguec Date: Thu, 22 Nov 2018 13:34:22 +0100 Subject: Remaniement de la suite de test MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit La comparaison avec les sorties attendues est faite directement dans le code ; libre au développeur d'aller differ les répertoires en cas de problème. --- .../lilliputaei128v1/ref/test/test-tweakey.c | 40 +++++++++++++++++----- 1 file changed, 32 insertions(+), 8 deletions(-) (limited to 'crypto_aead/lilliputaei128v1/ref/test/test-tweakey.c') diff --git a/crypto_aead/lilliputaei128v1/ref/test/test-tweakey.c b/crypto_aead/lilliputaei128v1/ref/test/test-tweakey.c index 2d3ef0d..96abe77 100644 --- a/crypto_aead/lilliputaei128v1/ref/test/test-tweakey.c +++ b/crypto_aead/lilliputaei128v1/ref/test/test-tweakey.c @@ -1,23 +1,25 @@ #include #include +#include #include "tweakey.h" #include "helpers.h" -struct vector_input +struct vector { - char * name; + char *name; uint8_t key[KEY_BYTES]; uint8_t tweak[TWEAK_BYTES]; + uint8_t last_rtk[TWEAKEY_BYTES]; }; -typedef struct vector_input vector_input; +typedef struct vector vector; /* [0]: LSB */ -vector_input VECTORS[] = { +const vector VECTORS[] = { { .name = "full", .tweak = { @@ -28,6 +30,9 @@ vector_input VECTORS[] = { .key = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff + }, + .last_rtk = { + 0x42, 0x5d, 0x5d, 0x5d, 0x5d, 0x5d, 0x5d, 0x5d } }, { @@ -40,7 +45,11 @@ vector_input VECTORS[] = { .key = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + }, + .last_rtk = { + 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } + }, { .name = "order", @@ -52,6 +61,9 @@ vector_input VECTORS[] = { .key = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f + }, + .last_rtk = { + 0xac, 0x92, 0x86, 0x9b, 0xae, 0xba, 0x8f, 0xa7 } }, { @@ -64,6 +76,9 @@ vector_input VECTORS[] = { .key = { 0xc1, 0x96, 0xc6, 0x0a, 0x02, 0x73, 0x91, 0x68, 0x7f, 0xf4, 0x23, 0x4d, 0x3d, 0xd5, 0xf9, 0x9b + }, + .last_rtk = { + 0xe6, 0xe3, 0x5e, 0x39, 0xf1, 0xf2, 0xa6, 0xac } } }; @@ -77,15 +92,16 @@ int main(int argc, char const * const *argv) return 1; } - for (vector_input* input=VECTORS; inputname); - FILE* dump = open_dump_file(argv[1], "tweakey", input->name); + FILE *dump = open_dump_file(argv[1], "tweakey", v->name); fprintf(dump, "Building Tweakey :\n"); tweakey_state tk; - tweakey_state_init(&tk, input->key, input->tweak, dump); + tweakey_state_init(&tk, v->key, v->tweak, dump); fprintf(dump, "Tweakey Schedule\n"); @@ -99,6 +115,14 @@ int main(int argc, char const * const *argv) tweakey_state_extract(&tk, rtk, i); } + if (memcmp(rtk, v->last_rtk, sizeof(rtk)) != 0) + { + REPORT_DIFFERENCE(v->name, "last RTK"); + diff++; + } + fclose(dump); } + + return diff; } -- cgit v1.2.3