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 a3fcc8a19fd39e13e41f96abb78a9f6c0bb4c5e5
parent 7a2cf03fece905c33bcf3fbbad8d93c682c09bc0
Author: Kévin Le Gouguec <kevin.legouguec@airbus.com>
Date:   Tue, 12 Mar 2019 11:22:45 +0100

Retrait des suffixes _TI

Dans le but de rendre

    diff -ru ref add_threshold

plus digeste.

Diffstat:
Msrc/add_threshold/cipher.c | 34+++++++++++++++++-----------------
Msrc/add_threshold/tweakey.c | 6+++---
Msrc/add_threshold/tweakey.h | 6+++---
3 files changed, 23 insertions(+), 23 deletions(-)

diff --git a/src/add_threshold/cipher.c b/src/add_threshold/cipher.c @@ -84,7 +84,7 @@ static const uint8_t P[16] = { 0x0, 0x2, 0x8, 0xa, 0x4, 0X6, 0xc, 0xe, 0x1, 0x3, 0x9, 0xb, 0x5, 0x7, 0xd, 0xf }; -static void _state_init_TI(uint8_t X[BLOCK_BYTES], uint8_t Y[BLOCK_BYTES], uint8_t Z[BLOCK_BYTES], const uint8_t message[BLOCK_BYTES]) +static void _state_init(uint8_t X[BLOCK_BYTES], uint8_t Y[BLOCK_BYTES], uint8_t Z[BLOCK_BYTES], const uint8_t message[BLOCK_BYTES]) { // To be replaced by real random numbers!!! uint8_t SHARES_0[BLOCK_BYTES] = { @@ -103,7 +103,7 @@ static void _state_init_TI(uint8_t X[BLOCK_BYTES], uint8_t Y[BLOCK_BYTES], uint8 } -static void _compute_round_tweakeys_TI( +static void _compute_round_tweakeys( const uint8_t key[KEY_BYTES], const uint8_t tweak[TWEAK_BYTES], uint8_t RTK_X[ROUNDS][ROUND_TWEAKEY_BYTES], @@ -112,18 +112,18 @@ static void _compute_round_tweakeys_TI( { uint8_t TK_X[TWEAKEY_BYTES]; uint8_t TK_Y[TWEAKEY_BYTES]; - tweakey_state_init_TI(TK_X, TK_Y, key, tweak); - tweakey_state_extract_TI(TK_X, TK_Y, 0, RTK_X[0], RTK_Y[0]); + tweakey_state_init(TK_X, TK_Y, key, tweak); + tweakey_state_extract(TK_X, TK_Y, 0, RTK_X[0], RTK_Y[0]); for (uint8_t i=1; i<ROUNDS; i++) { - tweakey_state_update_TI(TK_X, TK_Y); - tweakey_state_extract_TI(TK_X, TK_Y, i, RTK_X[i], RTK_Y[i]); + tweakey_state_update(TK_X, TK_Y); + tweakey_state_extract(TK_X, TK_Y, i, RTK_X[i], RTK_Y[i]); } } -static void _nonlinear_layer_TI( +static void _nonlinear_layer( uint8_t X[BLOCK_BYTES], uint8_t Y[BLOCK_BYTES], uint8_t Z[BLOCK_BYTES], @@ -227,7 +227,7 @@ static void _permutation_layer(uint8_t X[BLOCK_BYTES], permutation p) } } -static void _one_round_egfn_TI( +static void _one_round_egfn( uint8_t X[BLOCK_BYTES], uint8_t Y[BLOCK_BYTES], uint8_t Z[BLOCK_BYTES], @@ -236,7 +236,7 @@ static void _one_round_egfn_TI( permutation p ) { - _nonlinear_layer_TI(X, Y, Z, RTK_X, RTK_Y); + _nonlinear_layer(X, Y, Z, RTK_X, RTK_Y); _linear_layer(X); _linear_layer(Y); _linear_layer(Z); @@ -256,19 +256,19 @@ void lilliput_tbc_encrypt( uint8_t X[BLOCK_BYTES]; uint8_t Y[BLOCK_BYTES]; uint8_t Z[BLOCK_BYTES]; - _state_init_TI(X, Y, Z, message); + _state_init(X, Y, Z, message); uint8_t RTK_X[ROUNDS][ROUND_TWEAKEY_BYTES]; uint8_t RTK_Y[ROUNDS][ROUND_TWEAKEY_BYTES]; - _compute_round_tweakeys_TI(key, tweak, RTK_X, RTK_Y); + _compute_round_tweakeys(key, tweak, RTK_X, RTK_Y); for (uint8_t i=0; i<ROUNDS-1; i++) { - _one_round_egfn_TI(X, Y, Z, RTK_X[i], RTK_Y[i], PERMUTATION_ENCRYPTION); + _one_round_egfn(X, Y, Z, RTK_X[i], RTK_Y[i], PERMUTATION_ENCRYPTION); } - _one_round_egfn_TI(X, Y, Z, RTK_X[ROUNDS-1], RTK_Y[ROUNDS-1], PERMUTATION_NONE); + _one_round_egfn(X, Y, Z, RTK_X[ROUNDS-1], RTK_Y[ROUNDS-1], PERMUTATION_NONE); for (size_t i=0; i<BLOCK_BYTES; i++) @@ -287,18 +287,18 @@ void lilliput_tbc_decrypt( uint8_t X[BLOCK_BYTES]; uint8_t Y[BLOCK_BYTES]; uint8_t Z[BLOCK_BYTES]; - _state_init_TI(X, Y, Z, ciphertext); + _state_init(X, Y, Z, ciphertext); uint8_t RTK_X[ROUNDS][ROUND_TWEAKEY_BYTES]; uint8_t RTK_Y[ROUNDS][ROUND_TWEAKEY_BYTES]; - _compute_round_tweakeys_TI(key, tweak, RTK_X, RTK_Y); + _compute_round_tweakeys(key, tweak, RTK_X, RTK_Y); for (uint8_t i=0; i<ROUNDS-1; i++) { - _one_round_egfn_TI(X, Y, Z, RTK_X[ROUNDS-1-i], RTK_Y[ROUNDS-1-i], PERMUTATION_DECRYPTION); + _one_round_egfn(X, Y, Z, RTK_X[ROUNDS-1-i], RTK_Y[ROUNDS-1-i], PERMUTATION_DECRYPTION); } - _one_round_egfn_TI(X, Y, Z, RTK_X[0], RTK_Y[0], PERMUTATION_NONE); + _one_round_egfn(X, Y, Z, RTK_X[0], RTK_Y[0], PERMUTATION_NONE); for (size_t i=0; i<BLOCK_BYTES; i++) { diff --git a/src/add_threshold/tweakey.c b/src/add_threshold/tweakey.c @@ -32,7 +32,7 @@ tweakey schedule, where the tweak and the key are split into two shares. #define LANES_NB (TWEAKEY_BYTES/LANE_BYTES) -void tweakey_state_init_TI( +void tweakey_state_init( uint8_t TK_X[TWEAKEY_BYTES], uint8_t TK_Y[KEY_BYTES], const uint8_t key[KEY_BYTES], @@ -53,7 +53,7 @@ void tweakey_state_init_TI( } -void tweakey_state_extract_TI( +void tweakey_state_extract( const uint8_t TK_X[TWEAKEY_BYTES], const uint8_t TK_Y[KEY_BYTES], uint8_t round_constant, @@ -186,7 +186,7 @@ static const matrix_multiplication ALPHAS[6] = { }; -void tweakey_state_update_TI(uint8_t TK_X[TWEAKEY_BYTES], uint8_t TK_Y[KEY_BYTES]) +void tweakey_state_update(uint8_t TK_X[TWEAKEY_BYTES], uint8_t TK_Y[KEY_BYTES]) { /* Skip lane 0, as it is multiplied by the identity matrix. */ diff --git a/src/add_threshold/tweakey.h b/src/add_threshold/tweakey.h @@ -28,14 +28,14 @@ of Lilliput-TBC's tweakey schedule. #include "constants.h" -void tweakey_state_init_TI( +void tweakey_state_init( uint8_t TK_X[TWEAKEY_BYTES], uint8_t TK_Y[TWEAKEY_BYTES], const uint8_t key[KEY_BYTES], const uint8_t tweak[TWEAK_BYTES] ); -void tweakey_state_extract_TI( +void tweakey_state_extract( const uint8_t TK_X[TWEAKEY_BYTES], const uint8_t TK_Y[KEY_BYTES], uint8_t round_constant, @@ -43,7 +43,7 @@ void tweakey_state_extract_TI( uint8_t round_tweakey_Y[ROUND_TWEAKEY_BYTES] ); -void tweakey_state_update_TI(uint8_t TK_X[TWEAKEY_BYTES], uint8_t TK_Y[KEY_BYTES]); +void tweakey_state_update(uint8_t TK_X[TWEAKEY_BYTES], uint8_t TK_Y[KEY_BYTES]); #endif /* TWEAKEY_H */