summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
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 98484bc..a602191 100644
--- a/src/add_developedtweakey/tweakey.c
+++ b/src/add_developedtweakey/tweakey.c
@@ -53,6 +53,11 @@ static uint8_t _M2(uint8_t x)
return x<<6 ^ (x & 0xf8) ^ x>>6;
}
+static uint8_t _M3(uint8_t x)
+{
+ return x & 0x1f;
+}
+
static void _multiply_M(const uint8_t X[LANE_BYTES], uint8_t Y[LANE_BYTES])
{
Y[7] = X[6];
@@ -103,9 +108,14 @@ static void _multiply_MR(const uint8_t X[LANE_BYTES], uint8_t Y[LANE_BYTES])
static void _multiply_MR2(const uint8_t X[LANE_BYTES], uint8_t Y[LANE_BYTES])
{
- uint8_t MR_X[LANE_BYTES];
- _multiply_MR(X, MR_X);
- _multiply_MR(MR_X, Y);
+ Y[0] = X[2];
+ Y[1] = X[3] ^ X[4]>>3;
+ Y[2] = X[4] ^ X[5]>>3 ^ _M3(X[6]);
+ Y[3] = X[5] ^ X[6]<<3;
+ Y[4] = X[3]<<2 ^ X[6] ^ X[7]<<3;
+ Y[5] = X[4]<<2 ^ X[7];
+ Y[6] = X[0];
+ Y[7] = X[1];
}
static void _multiply_MR3(const uint8_t X[LANE_BYTES], uint8_t Y[LANE_BYTES])