diff options
Diffstat (limited to 'src')
| -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]]; } } } |
