summaryrefslogtreecommitdiff
path: root/crypto_aead/lilliputaei128v1/ref
diff options
context:
space:
mode:
Diffstat (limited to 'crypto_aead/lilliputaei128v1/ref')
-rw-r--r--crypto_aead/lilliputaei128v1/ref/cipher.c12
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);
}