From 3a570315f28ea52e277bdeb7790e35fd11661592 Mon Sep 17 00:00:00 2001 From: Kévin Le Gouguec Date: Mon, 20 May 2019 11:01:40 +0200 Subject: Réécriture de l'implémentation des couches non-linéaire et linéaire MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Changements mineurs : - remplacement du tableau intermédiaire F par une fonction, - réécriture de la couche linéaire avec des boucles. Le but est d'améliorer la lisibilité par rapport à la spécification, tout en limitant les différences avec la version "felicsref". --- src/ref/cipher.c | 40 ++++++++++++++-------------------------- 1 file changed, 14 insertions(+), 26 deletions(-) (limited to 'src') diff --git a/src/ref/cipher.c b/src/ref/cipher.c index 5f26cc9..5822575 100644 --- a/src/ref/cipher.c +++ b/src/ref/cipher.c @@ -83,44 +83,32 @@ static void _compute_round_tweakeys( } +static uint8_t _Fj(uint8_t Xj, uint8_t RTKj) +{ + return S[Xj] ^ RTK[j]; +} + static void _nonlinear_layer(uint8_t X[BLOCK_BYTES], const uint8_t RTK[ROUND_TWEAKEY_BYTES]) { - uint8_t F[ROUND_TWEAKEY_BYTES]; - for (size_t j=0; j