summaryrefslogtreecommitdiff
path: root/traces/traces-tbc.patch
diff options
context:
space:
mode:
Diffstat (limited to 'traces/traces-tbc.patch')
-rw-r--r--traces/traces-tbc.patch30
1 files changed, 18 insertions, 12 deletions
diff --git a/traces/traces-tbc.patch b/traces/traces-tbc.patch
index 9f8b9af..ca776a1 100644
--- a/traces/traces-tbc.patch
+++ b/traces/traces-tbc.patch
@@ -1,14 +1,17 @@
diff --git a/SOUMISSION_NIST/REFERENCE_IMPLEMENTATION/src/ref/cipher.c b/SOUMISSION_NIST/REFERENCE_IMPLEMENTATION/src/ref/cipher.c
-index e5ccd15..0749f8c 100644
+index 48144d4..3b5f36c 100644
--- a/SOUMISSION_NIST/REFERENCE_IMPLEMENTATION/src/ref/cipher.c
+++ b/SOUMISSION_NIST/REFERENCE_IMPLEMENTATION/src/ref/cipher.c
-@@ -1,3 +1,5 @@
+@@ -15,6 +15,8 @@ http://creativecommons.org/publicdomain/zero/1.0/
+ This file provides the implementation for Lilliput-TBC.
+ */
+
+#include "debug.h"
+
#include <stdint.h>
#include <string.h>
-@@ -52,40 +54,61 @@ static void _compute_round_tweakeys(
+@@ -69,40 +71,61 @@ static void _compute_round_tweakeys(
uint8_t RTK[ROUNDS][ROUND_TWEAKEY_BYTES]
)
{
@@ -70,7 +73,7 @@ index e5ccd15..0749f8c 100644
X[15] ^= X[1];
X[15] ^= X[2];
X[15] ^= X[3];
-@@ -100,6 +123,8 @@ static void _linear_layer(uint8_t X[BLOCK_BYTES])
+@@ -117,6 +140,8 @@ static void _linear_layer(uint8_t X[BLOCK_BYTES])
X[11] ^= X[7];
X[10] ^= X[7];
X[9] ^= X[7];
@@ -79,7 +82,7 @@ index e5ccd15..0749f8c 100644
}
static void _permutation_layer(uint8_t X[BLOCK_BYTES], permutation p)
-@@ -109,6 +134,8 @@ static void _permutation_layer(uint8_t X[BLOCK_BYTES], permutation p)
+@@ -126,6 +151,8 @@ static void _permutation_layer(uint8_t X[BLOCK_BYTES], permutation p)
return;
}
@@ -88,7 +91,7 @@ index e5ccd15..0749f8c 100644
uint8_t X_old[BLOCK_BYTES];
memcpy(X_old, X, BLOCK_BYTES);
-@@ -118,6 +145,8 @@ static void _permutation_layer(uint8_t X[BLOCK_BYTES], permutation p)
+@@ -135,6 +162,8 @@ static void _permutation_layer(uint8_t X[BLOCK_BYTES], permutation p)
{
X[pi[j]] = X_old[j];
}
@@ -97,7 +100,7 @@ index e5ccd15..0749f8c 100644
}
static void _one_round_egfn(uint8_t X[BLOCK_BYTES], const uint8_t RTK[ROUND_TWEAKEY_BYTES], permutation p)
-@@ -141,11 +170,15 @@ void lilliput_tbc_encrypt(
+@@ -158,11 +187,15 @@ void lilliput_tbc_encrypt(
uint8_t RTK[ROUNDS][ROUND_TWEAKEY_BYTES];
_compute_round_tweakeys(key, tweak, RTK);
@@ -114,16 +117,19 @@ index e5ccd15..0749f8c 100644
memcpy(ciphertext, X, BLOCK_BYTES);
diff --git a/SOUMISSION_NIST/REFERENCE_IMPLEMENTATION/src/ref/tweakey.c b/SOUMISSION_NIST/REFERENCE_IMPLEMENTATION/src/ref/tweakey.c
-index 54b3036..77d2d58 100644
+index 39e5980..4cdcf2a 100644
--- a/SOUMISSION_NIST/REFERENCE_IMPLEMENTATION/src/ref/tweakey.c
+++ b/SOUMISSION_NIST/REFERENCE_IMPLEMENTATION/src/ref/tweakey.c
-@@ -1,3 +1,5 @@
+@@ -17,6 +17,8 @@ where multiplications by matrices M and M_R to the power n is performed by
+ functions expressing the exponentiated matrices with shifts and XORs.
+ */
+
+#include "debug.h"
+
#include <stdint.h>
#include <string.h>
-@@ -33,10 +35,16 @@ void tweakey_state_extract(
+@@ -52,10 +54,16 @@ void tweakey_state_extract(
{
const uint8_t *TKj = TK + j*LANE_BYTES;
@@ -140,7 +146,7 @@ index 54b3036..77d2d58 100644
}
round_tweakey[0] ^= round_constant;
-@@ -110,6 +118,10 @@ static const matrix_multiplication ALPHAS[6] = {
+@@ -165,6 +173,10 @@ static const matrix_multiplication ALPHAS[6] = {
_multiply_MR3
};
@@ -151,7 +157,7 @@ index 54b3036..77d2d58 100644
void tweakey_state_update(uint8_t TK[TWEAKEY_BYTES])
{
-@@ -123,5 +135,9 @@ void tweakey_state_update(uint8_t TK[TWEAKEY_BYTES])
+@@ -178,5 +190,9 @@ void tweakey_state_update(uint8_t TK[TWEAKEY_BYTES])
memcpy(TKj_old, TKj, LANE_BYTES);
ALPHAS[j-1](TKj_old, TKj);