From b36b15af3c8e8f1846b82da0ca1942e610666e2f Mon Sep 17 00:00:00 2001 From: Kévin Le Gouguec Date: Wed, 21 Nov 2018 14:18:25 +0100 Subject: Ébauche du code de la partie TBC MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit I.e. définition des fonctions de haut-niveau ; reste à implémenter les fonctions en-dessous, et les sorties de debug. --- crypto_aead/lilliputaei128v1/ref/cipher.c | 103 ++++++++++++++++++++++++++++++ 1 file changed, 103 insertions(+) create mode 100644 crypto_aead/lilliputaei128v1/ref/cipher.c (limited to 'crypto_aead/lilliputaei128v1/ref/cipher.c') diff --git a/crypto_aead/lilliputaei128v1/ref/cipher.c b/crypto_aead/lilliputaei128v1/ref/cipher.c new file mode 100644 index 0000000..60e0d16 --- /dev/null +++ b/crypto_aead/lilliputaei128v1/ref/cipher.c @@ -0,0 +1,103 @@ +#include +#include +#include /* debug */ +#include + +#include "cipher.h" +#include "parameters.h" +#include "tweakey.h" + + +struct cipher_state +{ + uint8_t X[BLOCK_BYTES]; + FILE* debug; +}; + + +typedef struct cipher_state cipher_state; + + +static void _state_init(cipher_state *X, const uint8_t message[BLOCK_BYTES], FILE* debug) +{ + memcpy(X->X, message, sizeof(X->X)); + X->debug = debug; +} + + +static void _compute_round_tweakeys( + const uint8_t key[KEY_BYTES], + const uint8_t tweak[TWEAK_BYTES], + uint8_t RTK[ROUNDS][ROUND_TWEAKEY_BYTES] +) +{ + tweakey_state TK; + tweakey_state_init(&TK, key, tweak, NULL); + tweakey_state_extract(&TK, RTK[0], 0); + + for (uint8_t i=1; i