diff options
| author | Kévin Le Gouguec <kevin.legouguec@airbus.com> | 2018-11-21 18:00:22 +0100 |
|---|---|---|
| committer | Kévin Le Gouguec <kevin.legouguec@airbus.com> | 2018-11-21 18:00:22 +0100 |
| commit | c30548a179dcd0999bd342b10eeaad2a1a304e90 (patch) | |
| tree | 5167ce88109eff2bbb340338296b853885d59076 /crypto_aead/lilliputaei128v1/ref/cipher.c | |
| parent | 52abee4e2d33c1bd7805e8c917e0def94045ebd1 (diff) | |
| download | lilliput-ae-implem-c30548a179dcd0999bd342b10eeaad2a1a304e90.tar.xz | |
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 (limited to 'crypto_aead/lilliputaei128v1/ref/cipher.c')
| -rw-r--r-- | crypto_aead/lilliputaei128v1/ref/cipher.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/crypto_aead/lilliputaei128v1/ref/cipher.c b/crypto_aead/lilliputaei128v1/ref/cipher.c index 7510a00..c866e4c 100644 --- 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); } |
