summaryrefslogtreecommitdiff
path: root/traces
diff options
context:
space:
mode:
authorKévin Le Gouguec <kevin.legouguec@airbus.com>2018-12-10 16:50:04 +0100
committerKévin Le Gouguec <kevin.legouguec@airbus.com>2018-12-10 16:50:04 +0100
commit7e8b275d599f475caf315493e79ea033fa0f17c2 (patch)
tree1de6493070cfdcd961a8eab9da880f3c164126ca /traces
parent7be6c07647afbc27bc7402efb23c1178affa2ec9 (diff)
downloadlilliput-ae-implem-7e8b275d599f475caf315493e79ea033fa0f17c2.tar.xz
Adaptation des traces au nouveau key schedule
Diffstat (limited to 'traces')
-rw-r--r--traces/traces-tbc.patch64
1 files changed, 21 insertions, 43 deletions
diff --git a/traces/traces-tbc.patch b/traces/traces-tbc.patch
index 9a95d4b..7c37df9 100644
--- a/traces/traces-tbc.patch
+++ b/traces/traces-tbc.patch
@@ -1,5 +1,5 @@
diff --git a/SOUMISSION_NIST/REFERENCE_IMPLEMENTATION/src/cipher.c b/SOUMISSION_NIST/REFERENCE_IMPLEMENTATION/src/cipher.c
-index 4190359..822f374 100644
+index bb2d46a..5e637b8 100644
--- a/SOUMISSION_NIST/REFERENCE_IMPLEMENTATION/src/cipher.c
+++ b/SOUMISSION_NIST/REFERENCE_IMPLEMENTATION/src/cipher.c
@@ -1,3 +1,5 @@
@@ -8,7 +8,7 @@ index 4190359..822f374 100644
#include <stdint.h>
#include <string.h>
-@@ -38,40 +40,61 @@ static void _compute_round_tweakeys(
+@@ -72,40 +74,61 @@ static void _compute_round_tweakeys(
uint8_t RTK[ROUNDS][ROUND_TWEAKEY_BYTES]
)
{
@@ -70,7 +70,7 @@ index 4190359..822f374 100644
X[15] ^= X[1];
X[15] ^= X[2];
X[15] ^= X[3];
-@@ -86,6 +109,8 @@ static void _linear_layer(uint8_t X[BLOCK_BYTES])
+@@ -120,6 +143,8 @@ static void _linear_layer(uint8_t X[BLOCK_BYTES])
X[11] ^= X[7];
X[10] ^= X[7];
X[9] ^= X[7];
@@ -79,7 +79,7 @@ index 4190359..822f374 100644
}
static void _permutation_layer(uint8_t X[BLOCK_BYTES], permutation p)
-@@ -95,6 +120,8 @@ static void _permutation_layer(uint8_t X[BLOCK_BYTES], permutation p)
+@@ -129,6 +154,8 @@ static void _permutation_layer(uint8_t X[BLOCK_BYTES], permutation p)
return;
}
@@ -88,7 +88,7 @@ index 4190359..822f374 100644
uint8_t X_old[BLOCK_BYTES];
memcpy(X_old, X, BLOCK_BYTES);
-@@ -104,6 +131,8 @@ static void _permutation_layer(uint8_t X[BLOCK_BYTES], permutation p)
+@@ -138,6 +165,8 @@ static void _permutation_layer(uint8_t X[BLOCK_BYTES], permutation p)
{
X[pi[j]] = X_old[j];
}
@@ -97,7 +97,7 @@ index 4190359..822f374 100644
}
static void _one_round_egfn(uint8_t X[BLOCK_BYTES], const uint8_t RTK[ROUND_TWEAKEY_BYTES], permutation p)
-@@ -127,11 +156,15 @@ void lilliput_tbc_encrypt(
+@@ -161,11 +190,15 @@ void lilliput_tbc_encrypt(
uint8_t RTK[ROUNDS][ROUND_TWEAKEY_BYTES];
_compute_round_tweakeys(key, tweak, RTK);
@@ -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 648bd54..c4b6d99 100644
+index c7d5aaa..a3be76b 100644
--- a/SOUMISSION_NIST/REFERENCE_IMPLEMENTATION/src/tweakey.c
+++ b/SOUMISSION_NIST/REFERENCE_IMPLEMENTATION/src/tweakey.c
@@ -1,3 +1,5 @@
@@ -123,7 +123,7 @@ index 648bd54..c4b6d99 100644
#include <stdint.h>
#include <string.h>
-@@ -34,10 +36,16 @@ void tweakey_state_extract(
+@@ -33,10 +35,16 @@ void tweakey_state_extract(
{
const uint8_t *TKj = TK + j*LANE_BYTES;
@@ -140,46 +140,24 @@ index 648bd54..c4b6d99 100644
}
round_tweakey[0] ^= round_constant;
-@@ -46,6 +54,8 @@ void tweakey_state_extract(
+@@ -114,6 +122,10 @@ static const matrix_multiplication ALPHAS[6] = {
+ _multiply_MR3
+ };
- static void _permute_state(uint8_t TK[TWEAKEY_BYTES])
- {
-+ fprintf(DUMP, " permuting TK\n");
++static char const * const ALPHAS_STR[6] = {
++ "M", "M²", "M³", "MR", "MR²", "MR³"
++};
+
- uint8_t TK_old[TWEAKEY_BYTES];
- memcpy(TK_old, TK, TWEAKEY_BYTES);
-@@ -59,10 +69,15 @@ static void _permute_state(uint8_t TK[TWEAKEY_BYTES])
- TKj[h[k]] = TKj_old[k];
- }
- }
-+
-+ debug_dump_buffer("TKi-1", TWEAKEY_BYTES, TK_old, 12);
-+ debug_dump_buffer("TKi", TWEAKEY_BYTES, TK, 12);
- }
-
- static void _multiply_state(uint8_t TK[TWEAKEY_BYTES])
+ void tweakey_state_update(uint8_t TK[TWEAKEY_BYTES])
{
-+ fprintf(DUMP, " multiplying TK\n");
-+
- /* 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].
- */
+@@ -127,5 +139,9 @@ void tweakey_state_update(uint8_t TK[TWEAKEY_BYTES])
+ memcpy(TKj_old, TKj, LANE_BYTES);
-+ debug_dump_buffer("TKi-1", TWEAKEY_BYTES, TK, 12);
+ ALPHAS[j-1](TKj_old, TKj);
+
- for (size_t j=1; j<LANES_NB; j++)
- {
- 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]];
- }
++ fprintf(DUMP, " multiplying lane %zu/%zu by %s\n", 1+j, (size_t)LANES_NB, ALPHAS_STR[j-1]);
++ debug_dump_buffer("TK_j^i-1", LANE_BYTES, TKj_old, 12);
++ debug_dump_buffer("TK_j^i", LANE_BYTES, TKj, 12);
}
-+
-+ debug_dump_buffer("TKi", TWEAKEY_BYTES, TK, 12);
}
-
- void tweakey_state_update(uint8_t TK[TWEAKEY_BYTES])