summaryrefslogtreecommitdiff
path: root/src/tweakey.c
diff options
context:
space:
mode:
authorKévin Le Gouguec <kevin.legouguec@airbus.com>2018-12-03 10:28:12 +0100
committerKévin Le Gouguec <kevin.legouguec@airbus.com>2018-12-03 10:28:12 +0100
commit8a8950699eb8bb9cd29311d32d003431a4472ae4 (patch)
tree9f019a137299e96ae655e01dc63000cba7c8d5d4 /src/tweakey.c
parent156b597dbe5900635fd629fd95783917b7c964d8 (diff)
downloadlilliput-ae-implem-8a8950699eb8bb9cd29311d32d003431a4472ae4.tar.xz
Nettoyage du code du key schedule
Diffstat (limited to 'src/tweakey.c')
-rw-r--r--src/tweakey.c12
1 files changed, 4 insertions, 8 deletions
diff --git a/src/tweakey.c b/src/tweakey.c
index da97019..7c66ee9 100644
--- a/src/tweakey.c
+++ b/src/tweakey.c
@@ -47,8 +47,6 @@ static void _permute_state(tweakey_state *TK)
uint8_t TK_old[TWEAKEY_BYTES];
memcpy(TK_old, TK->TK, sizeof(TK_old));
- /* TODO: homogenize indices; here j=lane; k=byte */
-
for (size_t j=0; j<TWEAKEY_BYTES; j+=LANE_BYTES)
{
for (size_t k=0; k<LANE_BYTES; k++)
@@ -62,15 +60,13 @@ static void _multiply_state(tweakey_state *TK)
{
/* Lane 0 is multiplied by Id; lane 1 by P_0, lane 2 by P_1... */
- for (size_t lane=1; lane<LANES_NB; lane++)
+ for (size_t j=1; j<LANES_NB; j++)
{
- const uint8_t* P_lane = P[lane-1];
-
- /* TODO: homogenize indices; here b=byte */
+ const uint8_t *P_lane = P[j-1];
- for (size_t b=0; b<LANE_BYTES; b++)
+ for (size_t k=0; k<LANE_BYTES; k++)
{
- size_t offset = lane*LANE_BYTES + b;
+ size_t offset = j*LANE_BYTES + k;
TK->TK[offset] = P_lane[TK->TK[offset]];
}
}