summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKévin Le Gouguec <kevin.legouguec@airbus.com>2019-07-05 15:23:04 +0200
committerKévin Le Gouguec <kevin.legouguec@airbus.com>2019-07-05 16:37:11 +0200
commit09602fcb6e50fda8245213ac66a340510f21a12f (patch)
treeca0f582ceb579db33f2eea7b12b7a3ea63f7f52b
parent1b4b310cde60372107376c130de1d1950adc8809 (diff)
downloadlilliput-ae-implem-09602fcb6e50fda8245213ac66a340510f21a12f.tar.xz
Suppression d'une variable intermédiaire dans add_felicsref
Pas sûr que la variable soit utile dans les autres… 🤷
-rw-r--r--CHANGELOG.txt3
-rw-r--r--src/add_felicsref/cipher.c9
2 files changed, 6 insertions, 6 deletions
diff --git a/CHANGELOG.txt b/CHANGELOG.txt
index 2e92008..31acfd2 100644
--- a/CHANGELOG.txt
+++ b/CHANGELOG.txt
@@ -68,6 +68,9 @@ See reference implementation. Further changes:
- Compute round-tweakeys on the fly to save on RAM, instead of storing all pre-computed round-tweakeys.
(cipher.c)
+- Remove intermediate buffer X in lilliput_tbc_decrypt(), to resemble lilliput_tbc_encrypt().
+ (cipher.c)
+
add_threshold
-------------
diff --git a/src/add_felicsref/cipher.c b/src/add_felicsref/cipher.c
index 87689df..916f0ab 100644
--- a/src/add_felicsref/cipher.c
+++ b/src/add_felicsref/cipher.c
@@ -168,18 +168,15 @@ void lilliput_tbc_decrypt(
uint8_t message[BLOCK_BYTES]
)
{
- uint8_t X[BLOCK_BYTES];
- _state_init(X, ciphertext);
+ _state_init(message, ciphertext);
uint8_t RTK[ROUNDS][ROUND_TWEAKEY_BYTES];
_compute_round_tweakeys(key, tweak, RTK);
for (size_t i=0; i<ROUNDS-1; i++)
{
- _one_round_egfn(X, RTK[ROUNDS-1-i], PERMUTATION_DECRYPTION);
+ _one_round_egfn(message, RTK[ROUNDS-1-i], PERMUTATION_DECRYPTION);
}
- _one_round_egfn(X, RTK[0], PERMUTATION_NONE);
-
- memcpy(message, X, BLOCK_BYTES);
+ _one_round_egfn(message, RTK[0], PERMUTATION_NONE);
}