summaryrefslogtreecommitdiff
path: root/traces/traces-tbc.patch
diff options
context:
space:
mode:
authorKévin Le Gouguec <kevin.legouguec@airbus.com>2018-12-03 15:49:53 +0100
committerKévin Le Gouguec <kevin.legouguec@airbus.com>2018-12-04 08:17:43 +0100
commit950bd7432cd486d29503444b0557d7a1452efd07 (patch)
tree7dbed7ff198703f9d88cb12e218280a705b44e37 /traces/traces-tbc.patch
parent4a89a70f14703e9a45eb490b44ca7621a516da71 (diff)
downloadlilliput-ae-implem-950bd7432cd486d29503444b0557d7a1452efd07.tar.xz
Adaptation des patchs de génération de traces
Diffstat (limited to 'traces/traces-tbc.patch')
-rw-r--r--traces/traces-tbc.patch35
1 files changed, 20 insertions, 15 deletions
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 <stdint.h>
#include <string.h>
-@@ -32,10 +34,16 @@ void tweakey_state_extract(
-
- for (const uint8_t *lane=TK; lane<TK+TWEAKEY_BYTES; lane+=LANE_BYTES)
+@@ -34,10 +36,16 @@ void tweakey_state_extract(
{
-+ fprintf(DUMP, " XORing lane %zu/%zu\n", 1+(size_t)((lane-TK)/LANE_BYTES), (size_t)LANES_NB);
+ const uint8_t *TKj = TK + j*LANE_BYTES;
+
++ fprintf(DUMP, " XORing lane %zu/%zu\n", 1+j, (size_t)LANES_NB);
+ debug_dump_buffer("RTK", ROUND_TWEAKEY_BYTES, round_tweakey, 12);
-+ debug_dump_buffer("lane[j]", LANE_BYTES, lane, 12);
++ debug_dump_buffer("lane[j]", LANE_BYTES, TKj, 12);
+
- for (size_t j=0; j<LANE_BYTES; j++)
+ for (size_t k=0; k<LANE_BYTES; k++)
{
- round_tweakey[j] ^= lane[j];
+ round_tweakey[k] ^= TKj[k];
}
+
+ debug_dump_buffer("=> 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<LANES_NB; j++)
{
- const uint8_t *P_lane = P[j-1];
-@@ -70,6 +87,8 @@ static void _multiply_state(uint8_t TK[TWEAKEY_BYTES])
- TK[offset] = P_lane[TK[offset]];
+ uint8_t const *Pj = P[j-1];
+@@ -83,6 +100,8 @@ static void _multiply_state(uint8_t TK[TWEAKEY_BYTES])
+ TKj[k] = Pj[TKj[k]];
}
}
+