diff options
| author | Kévin Le Gouguec <kevin.legouguec@airbus.com> | 2019-07-05 09:48:32 +0200 |
|---|---|---|
| committer | Kévin Le Gouguec <kevin.legouguec@airbus.com> | 2019-07-05 09:51:21 +0200 |
| commit | 5fdd2fd67a68d43830300c3ddf4440478ff73cfd (patch) | |
| tree | 4b5a946faad84309dacbc406ded839ba8d521be9 | |
| parent | 5fc1268d9c866ac78d3360af51eb0c0201a31167 (diff) | |
| download | lilliput-ae-implem-5fdd2fd67a68d43830300c3ddf4440478ff73cfd.tar.xz | |
Utilisation de "size_t" pour l'indexation d'un tableau
Cf. db83bae, surtout par souci d'homogénéité.
| -rw-r--r-- | CHANGELOG.txt | 6 | ||||
| -rw-r--r-- | src/add_felicsref/cipher.c | 4 | ||||
| -rw-r--r-- | src/ref/cipher.c | 4 |
3 files changed, 7 insertions, 7 deletions
diff --git a/CHANGELOG.txt b/CHANGELOG.txt index cc38a27..eb074ad 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -34,6 +34,9 @@ These modifications are structural and/or stylistic and do not change the algori - Extract tweakey multiplications into their own header file, so that other implementations can make more targeted changes. (constants.h, multiplications.h, tweakey.c) +- Use size_t to iterate on arrays in lilliput_tbc_encrypt() and lilliput_tbc_decrypt(). + (cipher.c) + add_threshold ------------- @@ -45,9 +48,6 @@ See reference implementation. See reference implementation. Further cleanups: -- Use size_t to iterate on arrays in lilliput_tbc_encrypt() and lilliput_tbc_decrypt(). - (cipher.c) - - Add constant macros KEY_LANES_NB and TWEAK_LANES_NB to make tweakey schedule code more legible. (tweakey.c) diff --git a/src/add_felicsref/cipher.c b/src/add_felicsref/cipher.c index 7de0a08..59bc5d8 100644 --- a/src/add_felicsref/cipher.c +++ b/src/add_felicsref/cipher.c @@ -150,7 +150,7 @@ void lilliput_tbc_encrypt( uint8_t RTK[ROUND_TWEAKEY_BYTES]; tweakey_state_init(TK, key, tweak); - for (unsigned i=0; i<ROUNDS-1; i++) + for (size_t i=0; i<ROUNDS-1; i++) { tweakey_state_extract(TK, i, RTK); _one_round_egfn(ciphertext, RTK, PERMUTATION_ENCRYPTION); @@ -174,7 +174,7 @@ void lilliput_tbc_decrypt( uint8_t RTK[ROUNDS][ROUND_TWEAKEY_BYTES]; _compute_round_tweakeys(key, tweak, RTK); - for (uint8_t i=0; i<ROUNDS-1; i++) + for (size_t i=0; i<ROUNDS-1; i++) { _one_round_egfn(X, RTK[ROUNDS-1-i], PERMUTATION_DECRYPTION); } diff --git a/src/ref/cipher.c b/src/ref/cipher.c index 8ebbbc3..07405e1 100644 --- a/src/ref/cipher.c +++ b/src/ref/cipher.c @@ -148,7 +148,7 @@ void lilliput_tbc_encrypt( uint8_t RTK[ROUNDS][ROUND_TWEAKEY_BYTES]; _compute_round_tweakeys(key, tweak, RTK); - for (uint8_t i=0; i<ROUNDS-1; i++) + for (size_t i=0; i<ROUNDS-1; i++) { _one_round_egfn(X, RTK[i], PERMUTATION_ENCRYPTION); } @@ -171,7 +171,7 @@ void lilliput_tbc_decrypt( uint8_t RTK[ROUNDS][ROUND_TWEAKEY_BYTES]; _compute_round_tweakeys(key, tweak, RTK); - for (uint8_t i=0; i<ROUNDS-1; i++) + for (size_t i=0; i<ROUNDS-1; i++) { _one_round_egfn(X, RTK[ROUNDS-1-i], PERMUTATION_DECRYPTION); } |
