diff options
| author | Gaetan Leplus <gaetan.leplus@airbus.com> | 2019-07-05 16:16:19 +0200 |
|---|---|---|
| committer | Gaetan Leplus <gaetan.leplus@airbus.com> | 2019-07-05 16:16:19 +0200 |
| commit | a432c19745907a96303b3a25111e0fd622202e0c (patch) | |
| tree | 3ac352a3598fa444d45695dbb2b4cee63698ac57 /src/add_threshold | |
| parent | 92893d79b36c9fb5a90644b82d16d9fa2563feb1 (diff) | |
| parent | 4f58d99e11e1c412a600f39f32a8d181765f0246 (diff) | |
| download | lilliput-ae-implem-a432c19745907a96303b3a25111e0fd622202e0c.tar.xz | |
Merge remote-tracking branch 'origin/master' into fix-vhdltbc
Diffstat (limited to 'src/add_threshold')
| -rw-r--r-- | src/add_threshold/tweakey.c | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/src/add_threshold/tweakey.c b/src/add_threshold/tweakey.c index 8f531d9..7822564 100644 --- a/src/add_threshold/tweakey.c +++ b/src/add_threshold/tweakey.c @@ -90,10 +90,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 @@ -102,16 +103,14 @@ static const matrix_multiplication ALPHAS[6] = { void tweakey_state_update(uint8_t TK_X[TWEAKEY_BYTES], uint8_t TK_Y[KEY_BYTES]) { - /* Skip lane 0, as it is multiplied by the identity matrix. */ - - for (size_t j=1; j<TWEAK_LANES_NB; j++) + for (size_t j=0; j<TWEAK_LANES_NB; j++) { uint8_t *TKj_X = TK_X + j*LANE_BYTES; uint8_t TKj_old_X[LANE_BYTES]; memcpy(TKj_old_X, TKj_X, LANE_BYTES); - ALPHAS[j-1](TKj_old_X, TKj_X); + ALPHAS[j](TKj_old_X, TKj_X); } for (size_t j=0; j<KEY_LANES_NB; j++) @@ -124,7 +123,7 @@ void tweakey_state_update(uint8_t TK_X[TWEAKEY_BYTES], uint8_t TK_Y[KEY_BYTES]) memcpy(TKj_X_old, TKj_X, LANE_BYTES); memcpy(TKj_Y_old, TKj_Y, LANE_BYTES); - ALPHAS[j-1 + TWEAK_LANES_NB](TKj_X_old, TKj_X); - ALPHAS[j-1 + TWEAK_LANES_NB](TKj_Y_old, TKj_Y); + ALPHAS[j + TWEAK_LANES_NB](TKj_X_old, TKj_X); + ALPHAS[j + TWEAK_LANES_NB](TKj_Y_old, TKj_Y); } } |
