From 950bd7432cd486d29503444b0557d7a1452efd07 Mon Sep 17 00:00:00 2001 From: Kévin Le Gouguec Date: Mon, 3 Dec 2018 15:49:53 +0100 Subject: Adaptation des patchs de génération de traces MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/debug.h | 2 ++ traces/traces-tbc.patch | 35 ++++++++++++++++++++--------------- 2 files changed, 22 insertions(+), 15 deletions(-) diff --git a/src/debug.h b/src/debug.h index 1dcf4ea..c173f58 100644 --- a/src/debug.h +++ b/src/debug.h @@ -53,6 +53,8 @@ static inline void debug_dump_buffer(const char *header, size_t len, const uint8 } fprintf(DUMP, "\n"); } + + fprintf(DUMP, "\n"); } static inline void debug_open_dump(const char *suite, const char *vector_name) diff --git a/traces/traces-tbc.patch b/traces/traces-tbc.patch index b24335c..9a95d4b 100644 --- a/traces/traces-tbc.patch +++ b/traces/traces-tbc.patch @@ -114,7 +114,7 @@ index 4190359..822f374 100644 memcpy(ciphertext, X, BLOCK_BYTES); diff --git a/SOUMISSION_NIST/REFERENCE_IMPLEMENTATION/src/tweakey.c b/SOUMISSION_NIST/REFERENCE_IMPLEMENTATION/src/tweakey.c -index 761ec53..39251a7 100644 +index 648bd54..c4b6d99 100644 --- a/SOUMISSION_NIST/REFERENCE_IMPLEMENTATION/src/tweakey.c +++ b/SOUMISSION_NIST/REFERENCE_IMPLEMENTATION/src/tweakey.c @@ -1,3 +1,5 @@ @@ -123,24 +123,24 @@ index 761ec53..39251a7 100644 #include #include -@@ -32,10 +34,16 @@ void tweakey_state_extract( - - for (const uint8_t *lane=TK; lane RTK", ROUND_TWEAKEY_BYTES, round_tweakey, 12); } round_tweakey[0] ^= round_constant; -@@ -44,6 +52,8 @@ void tweakey_state_extract( +@@ -46,6 +54,8 @@ void tweakey_state_extract( static void _permute_state(uint8_t TK[TWEAKEY_BYTES]) { @@ -149,8 +149,8 @@ index 761ec53..39251a7 100644 uint8_t TK_old[TWEAKEY_BYTES]; memcpy(TK_old, TK, TWEAKEY_BYTES); -@@ -54,12 +64,19 @@ static void _permute_state(uint8_t TK[TWEAKEY_BYTES]) - TK[j+h[k]] = TK_old[j+k]; +@@ -59,10 +69,15 @@ static void _permute_state(uint8_t TK[TWEAKEY_BYTES]) + TKj[h[k]] = TKj_old[k]; } } + @@ -162,15 +162,20 @@ index 761ec53..39251a7 100644 { + fprintf(DUMP, " multiplying TK\n"); + - /* Lane 0 is multiplied by Id; lane 1 by P_0, lane 2 by P_1... */ + /* Each byte in lane 0 is multiplied by alpha_0 = 1, i.e. it + * remains unchanged. + * +@@ -73,6 +88,8 @@ static void _multiply_state(uint8_t TK[TWEAKEY_BYTES]) + * P_j = P[j-1]. + */ + debug_dump_buffer("TKi-1", TWEAKEY_BYTES, TK, 12); + for (size_t j=1; j