commit c30548a179dcd0999bd342b10eeaad2a1a304e90
parent 52abee4e2d33c1bd7805e8c917e0def94045ebd1
Author: Kévin Le Gouguec <kevin.legouguec@airbus.com>
Date: Wed, 21 Nov 2018 18:00:22 +0100
Implémentation de la permutation
Toujours conforme au vecteur de test ! Le test passe, du coup.
J'ai un doute sur la gestion des indices de π, ceci dit.
Diffstat:
1 file changed, 12 insertions(+), 0 deletions(-)
diff --git a/crypto_aead/lilliputaei128v1/ref/cipher.c b/crypto_aead/lilliputaei128v1/ref/cipher.c
@@ -130,7 +130,19 @@ static void _permutation_layer(cipher_state *X, permutation p)
{
return;
}
+
debug_dump_buffer(X->debug, " Permutation Layer :", sizeof(X->X), X->X, 10);
+
+ uint8_t X_old[BLOCK_BYTES];
+ memcpy(X_old, X, sizeof(X_old));
+
+ const uint8_t *pi = PERMUTATIONS[p];
+
+ for (size_t j=0; j<BLOCK_BYTES; j++)
+ {
+ X->X[pi[j]] = X_old[j];
+ }
+
debug_dump_buffer(X->debug, " State permuted :", sizeof(X->X), X->X, 10);
}