From f2f735af0c44d280c6642935d33dc43793f5a637 Mon Sep 17 00:00:00 2001 From: Kévin Le Gouguec Date: Tue, 20 Nov 2018 11:10:15 +0100 Subject: Ajout des vecteurs Tweakey de Léo MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- crypto_aead/lilliputaei128v1/ref/test-tweakey.c | 108 ------------------------ 1 file changed, 108 deletions(-) delete mode 100644 crypto_aead/lilliputaei128v1/ref/test-tweakey.c (limited to 'crypto_aead/lilliputaei128v1/ref/test-tweakey.c') diff --git a/crypto_aead/lilliputaei128v1/ref/test-tweakey.c b/crypto_aead/lilliputaei128v1/ref/test-tweakey.c deleted file mode 100644 index 998d699..0000000 --- a/crypto_aead/lilliputaei128v1/ref/test-tweakey.c +++ /dev/null @@ -1,108 +0,0 @@ -#include -#include - -#include "tweakey.h" - - -#define ARRAY_NB(A) (sizeof(A)/sizeof(A[0])) -#define ARRAY_END(A) (A+ARRAY_NB(A)) - - -struct vector_input -{ - char * name; - uint8_t key[KEY_BYTES]; - uint8_t tweak[TWEAK_BYTES]; -}; - -typedef struct vector_input vector_input; - - -/* [0]: LSB */ - - -vector_input VECTORS[] = { - { - .name = "full", - .tweak = { - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff - }, - .key = { - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff - } - }, - { - .name = "null", - .tweak = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - }, - .key = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - } - }, - { - .name = "order", - .tweak = { - 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, - 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, - 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17 - }, - .key = { - 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, - 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f - } - }, - { - .name = "random", - .tweak = { - 0xcf, 0x4c, 0xd4, 0x0b, 0x5e, 0x04, 0x2d, 0x26, - 0xa5, 0x19, 0x5b, 0x52, 0x73, 0xff, 0x12, 0xd2, - 0x39, 0x33, 0x28, 0x90, 0xc5, 0x0e, 0x33, 0x25 - }, - .key = { - 0xa2, 0x28, 0x13, 0x19, 0x00, 0xd1, 0xf1, 0xf3, - 0xa9, 0xca, 0x44, 0x73, 0x56, 0x16, 0xae, 0xb4, - } - } -}; - - -FILE* open_dump_file(const char * name) -{ - char filename[128]; - snprintf(filename, sizeof(filename), "results/tweakey_%s.txt", name); - return fopen(filename, "w"); -} - - -int main() -{ - for (vector_input* input=VECTORS; inputname); - FILE* dump = open_dump_file(input->name); - - fprintf(dump, "Building Tweakey :\n"); - - tweakey_state tk; - tweakey_state_init(&tk, input->key, input->tweak, dump); - - fprintf(dump, "Tweakey Schedule\n"); - - uint8_t rtk[ROUND_TWEAKEY_BYTES]; - for (uint8_t i=0; i<32; i++) - { - tweakey_state_extract(&tk, rtk, i); - tweakey_state_update(&tk); - } - tweakey_state_extract(&tk, rtk, 32); - - fclose(dump); - } -} -- cgit v1.2.3