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 77b6bd8e98f1917d01b4addd3166e3bfc938f141
parent 96a7d3976141519ac9f0c6eacbd0d34204426bc1
Author: Kévin Le Gouguec <kevin.legouguec@airbus.com>
Date:   Mon, 26 Nov 2018 16:56:57 +0100

Correction de pad10*

Tests  toujours en  vrac, vu  que Léo  rembourre des  bits et  moi des
octets.

Diffstat:
Mcrypto_aead/lilliputaei128v1/ref/lilliput-ae-i.c | 16+++++++++++-----
1 file changed, 11 insertions(+), 5 deletions(-)

diff --git a/crypto_aead/lilliputaei128v1/ref/lilliput-ae-i.c b/crypto_aead/lilliputaei128v1/ref/lilliput-ae-i.c @@ -50,15 +50,21 @@ static void _xor_arrays(size_t len, uint8_t out[len], const uint8_t a[len], cons out[i] = a[i] ^ b[i]; } -static void _pad10(size_t len, const uint8_t buf[len], uint8_t padded[BLOCK_BYTES]) +static void _pad10(size_t X_len, const uint8_t X[X_len], uint8_t padded[BLOCK_BYTES]) { + /* pad10*(X) = X || 1 || 0^{n-|X|-1} */ + /* Assume that len<BLOCK_BYTES. */ - memcpy(padded, buf, len); - padded[len] = 0x80; - if (len+1 < BLOCK_BYTES) + size_t pad_len = BLOCK_BYTES-X_len; + + memcpy(padded+pad_len, X, X_len); + + padded[pad_len-1] = 0x80; + + if (pad_len > 1) { - memset(padded+len+1, 0, BLOCK_BYTES-len-1); + memset(padded, 0, pad_len-1); } }