diff options
| author | Kévin Le Gouguec <kevin.legouguec@airbus.com> | 2019-05-03 13:12:12 +0200 |
|---|---|---|
| committer | Kévin Le Gouguec <kevin.legouguec@airbus.com> | 2019-05-03 13:12:12 +0200 |
| commit | 5a6f2f82b11cf89d6fbe9b0f0b08cae1b15290c7 (patch) | |
| tree | d8f7348c2c20e11d98173d7c19bbf6177f295fbe | |
| parent | db83baed9936156a8ea2fe72980fbda21542d7ec (diff) | |
| download | lilliput-ae-implem-5a6f2f82b11cf89d6fbe9b0f0b08cae1b15290c7.tar.xz | |
Correction du mode ΘCB3 quand sizeof(size_t)<8
Bug introduit par ce047dd.
| -rw-r--r-- | src/ref/lilliput-i.c | 7 |
1 files 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<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]); |
