summaryrefslogtreecommitdiff
path: root/src/tweakey.c
diff options
context:
space:
mode:
authorKévin Le Gouguec <kevin.legouguec@airbus.com>2018-12-11 16:44:42 +0100
committerKévin Le Gouguec <kevin.legouguec@airbus.com>2018-12-11 17:20:37 +0100
commit064bcd06147dbd7ac2dac0ab0d0b75d60264acd8 (patch)
treecfa22c2ece94aee212bb2a4497754c426aa557d9 /src/tweakey.c
parent96c711433a6ac9529d2f205b75c4c5bcd49f9419 (diff)
downloadlilliput-ae-implem-064bcd06147dbd7ac2dac0ab0d0b75d60264acd8.tar.xz
Renommage des séquences induites par M₁ et M₂
Vu que la séquence générée par M₁ pour M² et M³ sera probablement différente de la séquence générée pour MR³.
Diffstat (limited to 'src/tweakey.c')
-rw-r--r--src/tweakey.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/src/tweakey.c b/src/tweakey.c
index 9f67ed6..3e42f4b 100644
--- a/src/tweakey.c
+++ b/src/tweakey.c
@@ -55,7 +55,7 @@ static void _multiply_M(const uint8_t X[LANE_BYTES], uint8_t Y[LANE_BYTES])
Y[0] = X[7];
}
-static const uint8_t M_1[256] = {
+static const uint8_t M_M1[256] = {
0x00, 0x08, 0x10, 0x18, 0x20, 0x28, 0x30, 0x38,
0x41, 0x49, 0x51, 0x59, 0x61, 0x69, 0x71, 0x79,
0x82, 0x8a, 0x92, 0x9a, 0xa2, 0xaa, 0xb2, 0xba,
@@ -90,7 +90,7 @@ static const uint8_t M_1[256] = {
0xdf, 0xd7, 0xcf, 0xc7, 0xff, 0xf7, 0xef, 0xe7
};
-static const uint8_t M_2[256] = {
+static const uint8_t M_M2[256] = {
0x00, 0x40, 0x80, 0xc0, 0x00, 0x40, 0x80, 0xc0,
0x08, 0x48, 0x88, 0xc8, 0x08, 0x48, 0x88, 0xc8,
0x10, 0x50, 0x90, 0xd0, 0x10, 0x50, 0x90, 0xd0,
@@ -122,15 +122,15 @@ static const uint8_t M_2[256] = {
0xe3, 0xa3, 0x63, 0x23, 0xe3, 0xa3, 0x63, 0x23,
0xeb, 0xab, 0x6b, 0x2b, 0xeb, 0xab, 0x6b, 0x2b,
0xf3, 0xb3, 0x73, 0x33, 0xf3, 0xb3, 0x73, 0x33,
- 0xfb, 0xbb, 0x7b, 0x3b, 0xfb, 0xbb, 0x7b, 0x3b,
+ 0xfb, 0xbb, 0x7b, 0x3b, 0xfb, 0xbb, 0x7b, 0x3b
};
static void _multiply_M2(const uint8_t X[LANE_BYTES], uint8_t Y[LANE_BYTES])
{
Y[7] = X[5];
Y[6] = X[4] ^ X[5]<<3;
- Y[5] = X[3] ^ M_1[X[4]] ^ X[5]<<6;
- Y[4] = X[2] ^ X[3]>>3 ^ X[4]>>6;
+ Y[5] = X[3] ^ M_M1[X[4]] ^ X[5]<<6;
+ Y[4] = X[2] ^ X[3]>>3 ^ X[4]>>6;
Y[3] = X[6]<<2 ^ X[1];
Y[2] = X[5]<<2 ^ X[0];
Y[1] = X[7];
@@ -139,12 +139,12 @@ static void _multiply_M2(const uint8_t X[LANE_BYTES], uint8_t Y[LANE_BYTES])
static void _multiply_M3(const uint8_t X[LANE_BYTES], uint8_t Y[LANE_BYTES])
{
- Y[7] = X[5]<<3 ^ X[4];
- Y[6] = X[5]<<6 ^ M_1[X[4]] ^ X[3];
- Y[5] = M_2[X[4]] ^ M_1[X[3]] ^ X[2];
- Y[4] = X[6]<<2 ^ X[3]>>6 ^ X[2]>>3 ^ X[1];
- Y[3] = X[5]<<2 ^ X[0];
- Y[2] = X[7] ^ X[5]<<5 ^ X[4]<<2;
+ Y[7] = X[5]<<3 ^ X[4];
+ Y[6] = X[5]<<6 ^ M_M1[X[4]] ^ X[3];
+ Y[5] = M_M2[X[4]] ^ M_M1[X[3]] ^ X[2];
+ Y[4] = X[6]<<2 ^ X[3]>>6 ^ X[2]>>3 ^ X[1];
+ Y[3] = X[5]<<2 ^ X[0];
+ Y[2] = X[7] ^ X[5]<<5 ^ X[4]<<2;
Y[1] = X[6];
Y[0] = X[5];
}