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 89d08745d767ef36ac1694ba80403dabdf6ee9cb
parent 6726d240017eb64ea042115005251e457bbb112b
Author: Kévin Le Gouguec <kevin.legouguec@airbus.com>
Date:   Mon,  4 Feb 2019 09:04:26 +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 @@ -53,6 +53,11 @@ static uint8_t _M2(uint8_t x) return x<<6 ^ (x & 0xf8) ^ x>>6; } +static uint8_t _M3(uint8_t x) +{ + return x & 0x1f; +} + static void _multiply_M(const uint8_t X[LANE_BYTES], uint8_t Y[LANE_BYTES]) { Y[7] = X[6]; @@ -103,9 +108,14 @@ static void _multiply_MR(const uint8_t X[LANE_BYTES], uint8_t Y[LANE_BYTES]) static void _multiply_MR2(const uint8_t X[LANE_BYTES], uint8_t Y[LANE_BYTES]) { - uint8_t MR_X[LANE_BYTES]; - _multiply_MR(X, MR_X); - _multiply_MR(MR_X, Y); + Y[0] = X[2]; + Y[1] = X[3] ^ X[4]>>3; + Y[2] = X[4] ^ X[5]>>3 ^ _M3(X[6]); + Y[3] = X[5] ^ X[6]<<3; + Y[4] = X[3]<<2 ^ X[6] ^ X[7]<<3; + Y[5] = X[4]<<2 ^ X[7]; + Y[6] = X[0]; + Y[7] = X[1]; } static void _multiply_MR3(const uint8_t X[LANE_BYTES], uint8_t Y[LANE_BYTES])