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 ae461f64bd249f959411b8b7cf56e549bb2ecb5c
parent efc65320b38cb51b2786c8f08df1a37de75e97a2
Author: Kévin Le Gouguec <kevin.legouguec@gmail.com>
Date:   Fri,  1 Feb 2019 14:00:05 +0100

Implémentation de M₁

Diffstat:
Msrc/add_developedtweakey/tweakey.c | 16+++++++++++++---
1 file changed, 13 insertions(+), 3 deletions(-)

diff --git a/src/add_developedtweakey/tweakey.c b/src/add_developedtweakey/tweakey.c @@ -43,6 +43,11 @@ void tweakey_state_extract( } +static uint8_t _M1(uint8_t x) +{ + return x<<3 ^ x>>3; +} + static void _multiply_M(const uint8_t X[LANE_BYTES], uint8_t Y[LANE_BYTES]) { Y[7] = X[6]; @@ -57,9 +62,14 @@ static void _multiply_M(const uint8_t X[LANE_BYTES], uint8_t Y[LANE_BYTES]) static void _multiply_M2(const uint8_t X[LANE_BYTES], uint8_t Y[LANE_BYTES]) { - uint8_t M_X[LANE_BYTES]; - _multiply_M(X, M_X); - _multiply_M(M_X, Y); + Y[7] = X[5]; + Y[6] = X[5]<<3 ^ X[4]; + Y[5] = X[5]<<6 ^ _M1(X[4]) ^ X[3]; + Y[4] = X[4]>>6 ^ X[3]>>3 ^ X[2]; + Y[3] = X[6]<<2 ^ X[1]; + Y[2] = X[5]<<2 ^ X[0]; + Y[1] = X[7]; + Y[0] = X[6]; } static void _multiply_M3(const uint8_t X[LANE_BYTES], uint8_t Y[LANE_BYTES])