summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorKévin Le Gouguec <kevin.legouguec@gmail.com>2019-02-01 14:00:05 +0100
committerKévin Le Gouguec <kevin.legouguec@gmail.com>2019-02-01 14:00:05 +0100
commitae461f64bd249f959411b8b7cf56e549bb2ecb5c (patch)
tree40ab7a84254410c8b25087627ce2f7153bb82a4c /src
parentefc65320b38cb51b2786c8f08df1a37de75e97a2 (diff)
downloadlilliput-ae-implem-ae461f64bd249f959411b8b7cf56e549bb2ecb5c.tar.xz
Implémentation de M₁
Diffstat (limited to 'src')
-rw-r--r--src/add_developedtweakey/tweakey.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/src/add_developedtweakey/tweakey.c b/src/add_developedtweakey/tweakey.c
index 54b3036..cbda1cf 100644
--- a/src/add_developedtweakey/tweakey.c
+++ b/src/add_developedtweakey/tweakey.c
@@ -43,6 +43,11 @@ void tweakey_state_extract(
}
+static uint8_t _M1(uint8_t x)
+{
+ return x<<3 ^ x>>3;
+}
+
static void _multiply_M(const uint8_t X[LANE_BYTES], uint8_t Y[LANE_BYTES])
{
Y[7] = X[6];
@@ -57,9 +62,14 @@ static void _multiply_M(const uint8_t X[LANE_BYTES], uint8_t Y[LANE_BYTES])
static void _multiply_M2(const uint8_t X[LANE_BYTES], uint8_t Y[LANE_BYTES])
{
- uint8_t M_X[LANE_BYTES];
- _multiply_M(X, M_X);
- _multiply_M(M_X, Y);
+ Y[7] = X[5];
+ Y[6] = X[5]<<3 ^ X[4];
+ Y[5] = X[5]<<6 ^ _M1(X[4]) ^ X[3];
+ Y[4] = X[4]>>6 ^ X[3]>>3 ^ X[2];
+ Y[3] = X[6]<<2 ^ X[1];
+ Y[2] = X[5]<<2 ^ X[0];
+ Y[1] = X[7];
+ Y[0] = X[6];
}
static void _multiply_M3(const uint8_t X[LANE_BYTES], uint8_t Y[LANE_BYTES])