From 6b148934c4cc1992dda774bff87acc28c9961aa1 Mon Sep 17 00:00:00 2001 From: Kévin Le Gouguec Date: Mon, 1 Jul 2019 17:40:36 +0200 Subject: Factorisation de code dans l'implémentation à seuil MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Plus facile à lire, je trouve (pas besoin de se demander "c'est quoi cette division ?" à chaque fois). --- src/add_threshold/tweakey.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/add_threshold/tweakey.c b/src/add_threshold/tweakey.c index 888e893..8f531d9 100644 --- a/src/add_threshold/tweakey.c +++ b/src/add_threshold/tweakey.c @@ -29,7 +29,9 @@ tweakey schedule, where the tweak and the key are split into two shares. #include "tweakey.h" -#define LANES_NB (TWEAKEY_BYTES/LANE_BYTES) +#define LANES_NB (TWEAKEY_BYTES/LANE_BYTES) +#define TWEAK_LANES_NB (TWEAK_BYTES/LANE_BYTES) +#define KEY_LANES_NB (KEY_BYTES/LANE_BYTES) void tweakey_state_init( @@ -72,8 +74,7 @@ void tweakey_state_extract( } } - - for (size_t j=0; j<(KEY_BYTES / LANE_BYTES); j++) + for (size_t j=0; j