diff options
| author | Kévin Le Gouguec <kevin.legouguec@airbus.com> | 2018-12-03 13:57:07 +0100 |
|---|---|---|
| committer | Kévin Le Gouguec <kevin.legouguec@airbus.com> | 2018-12-04 08:17:43 +0100 |
| commit | 4e5d619a69aa79c61986ce3b4ee86486e583eab3 (patch) | |
| tree | c557a0b21386a95afc2533c72ca0a733b32b2697 | |
| parent | 85a50344c964d0a57b09c7d03974c83b5d07932d (diff) | |
| download | lilliput-ae-implem-4e5d619a69aa79c61986ce3b4ee86486e583eab3.tar.xz | |
Mise à jour du code selon les modifs de !2
| -rw-r--r-- | src/tweakey.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/src/tweakey.c b/src/tweakey.c index 761ec53..d1893e0 100644 --- a/src/tweakey.c +++ b/src/tweakey.c @@ -58,16 +58,24 @@ static void _permute_state(uint8_t TK[TWEAKEY_BYTES]) static void _multiply_state(uint8_t TK[TWEAKEY_BYTES]) { - /* Lane 0 is multiplied by Id; lane 1 by P_0, lane 2 by P_1... */ + /* Each byte in lane 0 is multiplied by alpha_0 = 1, i.e. it + * remains unchanged. + * + * Each byte b in lanes j = { 1, ..., p-1 } is multiplied by + * alpha_j; the result of b*alpha_j is stored in P_j[b]. + * + * In this implementation, P_j sequences are stored in array P; + * P_j = P[j-1]. + */ for (size_t j=1; j<LANES_NB; j++) { - const uint8_t *P_lane = P[j-1]; + const uint8_t *P_j = P[j-1]; for (size_t k=0; k<LANE_BYTES; k++) { size_t offset = j*LANE_BYTES + k; - TK[offset] = P_lane[TK[offset]]; + TK[offset] = P_j[TK[offset]]; } } } |
