summaryrefslogtreecommitdiff
path: root/src/add_threshold/cipher.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/add_threshold/cipher.c')
-rw-r--r--src/add_threshold/cipher.c34
1 files changed, 17 insertions, 17 deletions
diff --git a/src/add_threshold/cipher.c b/src/add_threshold/cipher.c
index d78270d..1535025 100644
--- 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++)
{