From 30b6de9dd377259685cfd0aedabd1f891fcf0d44 Mon Sep 17 00:00:00 2001 From: Kévin Le Gouguec Date: Tue, 27 Nov 2018 14:08:56 +0100 Subject: Implémentation du mode SCT-2 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/ae-common.h | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) (limited to 'src/ae-common.h') diff --git a/src/ae-common.h b/src/ae-common.h index da5d04d..561854e 100644 --- a/src/ae-common.h +++ b/src/ae-common.h @@ -65,26 +65,23 @@ static inline void pad10(size_t X_len, const uint8_t X[X_len], uint8_t padded[BL } } -static inline void _fill_ad_tweak( +static inline void fill_index_tweak( uint8_t prefix, - uint64_t block_nb, + uint64_t block_index, uint8_t tweak[TWEAK_BYTES] ) { /* The t-bit tweak is filled as follows: * - * - bits [ 1, t-4]: block number - * [ 1, 64]: actual 64-bit block number + * - bits [ 1, t-4]: block index + * [ 1, 64]: actual 64-bit block index * [ 65, t-4]: 0-padding * - bits [t-3, t]: constant 4-bit prefix */ - for (size_t i=0; i> 8*i; - - tweak[i] = b; + tweak[i] = block_index >> 8*i & 0xff; } /* Assume padding bytes have already been memset to 0. */ @@ -110,7 +107,7 @@ static void process_associated_data( for (size_t i=0; i