From 5a6f2f82b11cf89d6fbe9b0f0b08cae1b15290c7 Mon Sep 17 00:00:00 2001 From: Kévin Le Gouguec Date: Fri, 3 May 2019 13:12:12 +0200 Subject: Correction du mode ΘCB3 quand sizeof(size_t)<8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Bug introduit par ce047dd. --- src/ref/lilliput-i.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/ref/lilliput-i.c b/src/ref/lilliput-i.c index 3ba7ea2..11fdc45 100644 --- a/src/ref/lilliput-i.c +++ b/src/ref/lilliput-i.c @@ -42,7 +42,7 @@ static void _fill_msg_tweak( /* With an s-bit block index, the t-bit tweak is filled as follows: * * - bits [ 1, t-|N|-4]: block index - * [ 1, s]: actual 64-bit block index + * [ 1, s]: actual block index * [ s+1, t-|N|-4]: 0-padding * - bits [t-|N|-4, t-4]: nonce * - bits [ t-3, t]: 4-bit prefix @@ -50,11 +50,12 @@ static void _fill_msg_tweak( copy_block_index(block_index, tweak); - tweak[sizeof(block_index)] = lower_nibble(N[0]) << 4; + size_t N_start = TWEAK_BYTES - NONCE_BYTES - 1; + tweak[N_start] = lower_nibble(N[0]) << 4; for (size_t i=1; i