summaryrefslogtreecommitdiff
path: root/src/ref/tweakey.c
diff options
context:
space:
mode:
authorKévin Le Gouguec <kevin.legouguec@airbus.com>2019-07-01 17:00:15 +0200
committerKévin Le Gouguec <kevin.legouguec@airbus.com>2019-07-04 13:43:12 +0200
commit3a074358065de5af65510d53f131b98c28f0b547 (patch)
tree36af02f6d476115b59cd0b2bff0a9a1e81cb3cdc /src/ref/tweakey.c
parent7e4b76b05d9a3945b916af09de0f9672abd2b22c (diff)
downloadlilliput-ae-implem-3a074358065de5af65510d53f131b98c28f0b547.tar.xz
Ajout de la multiplication M⁴
- α₀ devient M - α₁ M² - α₂ M³ - α₃ M⁴ - α₄ M_R - α₅ M_R² - α₆ M_R³
Diffstat (limited to 'src/ref/tweakey.c')
-rw-r--r--src/ref/tweakey.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/ref/tweakey.c b/src/ref/tweakey.c
index 2f357ca..510f35a 100644
--- a/src/ref/tweakey.c
+++ b/src/ref/tweakey.c
@@ -63,10 +63,11 @@ void tweakey_state_extract(
typedef void (*matrix_multiplication)(const uint8_t x[LANE_BYTES], uint8_t y[LANE_BYTES]);
-static const matrix_multiplication ALPHAS[6] = {
+static const matrix_multiplication ALPHAS[7] = {
_multiply_M,
_multiply_M2,
_multiply_M3,
+ _multiply_M4,
_multiply_MR,
_multiply_MR2,
_multiply_MR3
@@ -75,15 +76,13 @@ static const matrix_multiplication ALPHAS[6] = {
void tweakey_state_update(uint8_t TK[TWEAKEY_BYTES])
{
- /* Skip lane 0, as it is multiplied by the identity matrix. */
-
- for (size_t j=1; j<LANES_NB; j++)
+ for (size_t j=0; j<LANES_NB; j++)
{
uint8_t *TKj = TK + j*LANE_BYTES;
uint8_t TKj_old[LANE_BYTES];
memcpy(TKj_old, TKj, LANE_BYTES);
- ALPHAS[j-1](TKj_old, TKj);
+ ALPHAS[j](TKj_old, TKj);
}
}