lilliput-ae-reference-implementation

Implementations of Lilliput-AE submitted to the NIST LWC standardization process
git clone https://git.kevinlegouguec.net/lilliput-ae-reference-implementation
Log | Files | Refs | README

commit 5a6f2f82b11cf89d6fbe9b0f0b08cae1b15290c7
parent db83baed9936156a8ea2fe72980fbda21542d7ec
Author: Kévin Le Gouguec <kevin.legouguec@airbus.com>
Date:   Fri,  3 May 2019 13:12:12 +0200

Correction du mode ΘCB3 quand sizeof(size_t)<8

Bug introduit par ce047dd.

Diffstat:
Msrc/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 @@ -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<NONCE_BYTES; i++) { - tweak[sizeof(block_index)+i] = lower_nibble(N[i]) << 4 ^ upper_nibble(N[i-1]); + tweak[N_start+i] = lower_nibble(N[i]) << 4 ^ upper_nibble(N[i-1]); } tweak[TWEAK_BYTES-1] = prefix << 4 ^ upper_nibble(N[NONCE_BYTES-1]);