diff options
| author | Kévin Le Gouguec <kevin.legouguec@airbus.com> | 2019-07-02 09:47:19 +0200 |
|---|---|---|
| committer | Kévin Le Gouguec <kevin.legouguec@airbus.com> | 2019-07-04 13:43:12 +0200 |
| commit | f5dd6a11b1b33e736048f8b04fe78e96937be6af (patch) | |
| tree | f6ad13b9f0226bd11047d2b07effde63b0a087ea | |
| parent | b64afaa513d66390005ea515ecd2393cb7e19c4f (diff) | |
| download | lilliput-ae-implem-f5dd6a11b1b33e736048f8b04fe78e96937be6af.tar.xz | |
Mise à jour de l'implémentation 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); } } |
