diff options
Diffstat (limited to 'crypto_aead/lilliputaei128v1/ref/tweakey.c')
| -rw-r--r-- | crypto_aead/lilliputaei128v1/ref/tweakey.c | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/crypto_aead/lilliputaei128v1/ref/tweakey.c b/crypto_aead/lilliputaei128v1/ref/tweakey.c index d7a5805..71bc030 100644 --- a/crypto_aead/lilliputaei128v1/ref/tweakey.c +++ b/crypto_aead/lilliputaei128v1/ref/tweakey.c @@ -8,6 +8,7 @@ #define LANE_BITS 64 #define LANE_BYTES (LANE_BITS/8) +#define LANES_NB (TWEAKEY_BYTES/LANE_BYTES) static void _dump_buffer(FILE *output, size_t len, const uint8_t buf[len], int indent) @@ -90,8 +91,22 @@ static void _permute_state(tweakey_state *TK) } } -static void _multiply_state(__attribute__((unused)) tweakey_state *TK) +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++) + { + const uint8_t* P_lane = P[lane-1]; + + /* TODO: homogenize indices; here b=byte */ + + for (size_t b=0; b<LANE_BYTES; b++) + { + size_t offset = lane*LANE_BYTES + b; + TK->TK[offset] = P_lane[TK->TK[offset]]; + } + } } void tweakey_state_update(tweakey_state *TK) |
