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 66287d37ee996d7ee8e067ff649720cbbab9bae2
parent d26dfcef1bca5d86ce9042b78605a399b6d74423
Author: Kévin Le Gouguec <kevin.legouguec@airbus.com>
Date:   Fri, 22 Mar 2019 08:41:23 +0100

Simplification et documentation de pad10*

Pas besoin de la condition. Ajout d'un exemple.

Diffstat:
Msrc/ref/lilliput-ae-utils.h | 20+++++++++++++-------
1 file changed, 13 insertions(+), 7 deletions(-)

diff --git a/src/ref/lilliput-ae-utils.h b/src/ref/lilliput-ae-utils.h @@ -70,18 +70,24 @@ static inline void pad10(size_t X_len, const uint8_t X[X_len], uint8_t padded[BL { /* pad10*(X) = X || 1 || 0^{n-|X|-1} */ + /* For example, with uint8_t X[3] = { [0]=0x01, [1]=0x02, [2]=0x03 } + * + * pad10*(X) = + * X[2] X[1] X[0] 1 0* + * 00000011 00000010 00000001 1 0000000 00000000... + * + * - padded[0, 11]: zeroes + * - padded[12]: 10000000 + * - padded[13, 15]: X[0, 2] + */ + /* Assume that X_len<BLOCK_BYTES. */ size_t pad_len = BLOCK_BYTES-X_len; - memcpy(padded+pad_len, X, X_len); - + memset(padded, 0, pad_len-1); padded[pad_len-1] = 0x80; - - if (pad_len > 1) - { - memset(padded, 0, pad_len-1); - } + memcpy(padded+pad_len, X, X_len); } static inline void fill_index_tweak(