From 833b24eb5dffcfb675aabbefd2435ed6f6b72bfe Mon Sep 17 00:00:00 2001 From: Kévin Le Gouguec Date: Tue, 5 Feb 2019 08:21:47 +0100 Subject: Mise en commun des sources à l'aide de liens symboliques MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/add_tweakeysequences/lilliput-ae-ii.c | 161 +----------------------------- 1 file changed, 1 insertion(+), 160 deletions(-) mode change 100644 => 120000 src/add_tweakeysequences/lilliput-ae-ii.c (limited to 'src/add_tweakeysequences/lilliput-ae-ii.c') diff --git a/src/add_tweakeysequences/lilliput-ae-ii.c b/src/add_tweakeysequences/lilliput-ae-ii.c deleted file mode 100644 index 26885e5..0000000 --- a/src/add_tweakeysequences/lilliput-ae-ii.c +++ /dev/null @@ -1,160 +0,0 @@ -#include -#include -#include - -#include "ae-common.h" -#include "cipher.h" -#include "lilliput-ae.h" - - -static void _init_msg_tweak(const uint8_t tag[TAG_BYTES], uint8_t tweak[TWEAK_BYTES]) -{ - /* The t-bit tweak is filled as follows: - * - * - bits [ 1, t-1]: tag + block index - * [ 1, 64]: tag[ 1.. 64] XOR block index - * [ 65, t-1]: tag[65..t-1] - * - bit t: 1 - */ - - memcpy(tweak+sizeof(uint64_t), tag+sizeof(uint64_t), TAG_BYTES-sizeof(uint64_t)); - tweak[TWEAK_BYTES-1] |= 0x80; -} - -static void _fill_msg_tweak(const uint8_t tag[TAG_BYTES], uint64_t block_index, uint8_t tweak[TWEAK_BYTES]) -{ - /* Assume bits 65 to t-1 are set. */ - for (size_t i=0; i> i*8 & 0xff; - tweak[i] = tag[i] ^ index_i; - } -} - -static void _fill_tag_tweak(const uint8_t N[NONCE_BYTES], uint8_t tweak[TWEAK_BYTES]) -{ - /* The t-bit tweak is filled as follows: - * - * - bits [ 1, t-7]: N - * - bits [t-7, t]: 0001||0^4 - */ - - memcpy(tweak, N, TWEAK_BYTES-1); - tweak[TWEAK_BYTES-1] = 0x10; -} - -static void _generate_tag( - const uint8_t key[KEY_BYTES], - size_t M_len, - const uint8_t M[M_len], - const uint8_t N[NONCE_BYTES], - const uint8_t Auth[BLOCK_BYTES], - uint8_t tag[TAG_BYTES] -) -{ - uint8_t Ek_Mj[BLOCK_BYTES]; - uint8_t tag_tmp[TAG_BYTES]; - uint8_t tweak[TWEAK_BYTES]; - - memset(tweak, 0, TWEAK_BYTES); - memcpy(tag_tmp, Auth, TAG_BYTES); - - size_t l = M_len / BLOCK_BYTES; - size_t rest = M_len % BLOCK_BYTES; - - for (size_t j=0; j