23 #ifndef LW_INTERNAL_GIFT128_M_H
24 #define LW_INTERNAL_GIFT128_M_H
41 #define GIFT128_MASKED_BLOCK_SIZE 16
47 #if GIFT128_VARIANT == GIFT128_VARIANT_TINY
48 #define GIFT128_MASKED_ROUND_KEYS 4
49 #elif GIFT128_VARIANT == GIFT128_VARIANT_SMALL
50 #define GIFT128_MASKED_ROUND_KEYS 20
52 #define GIFT128_MASKED_ROUND_KEYS 80
86 const unsigned char *input);
118 const unsigned char *input);
132 (gift128n_masked_key_schedule_t *ks,
const unsigned char *key);
145 (
const gift128n_masked_key_schedule_t *ks,
unsigned char *output,
146 const unsigned char *input);
159 (
const gift128n_masked_key_schedule_t *ks,
unsigned char *output,
160 const unsigned char *input);
163 #define GIFT128TM_TWEAK_0 0x00000000
164 #define GIFT128TM_TWEAK_1 0xe1e1e1e1
165 #define GIFT128TM_TWEAK_2 0xd2d2d2d2
166 #define GIFT128TM_TWEAK_3 0x33333333
167 #define GIFT128TM_TWEAK_4 0xb4b4b4b4
168 #define GIFT128TM_TWEAK_5 0x55555555
169 #define GIFT128TM_TWEAK_6 0x66666666
170 #define GIFT128TM_TWEAK_7 0x87878787
171 #define GIFT128TM_TWEAK_8 0x78787878
172 #define GIFT128TM_TWEAK_9 0x99999999
173 #define GIFT128TM_TWEAK_10 0xaaaaaaaa
174 #define GIFT128TM_TWEAK_11 0x4b4b4b4b
175 #define GIFT128TM_TWEAK_12 0xcccccccc
176 #define GIFT128TM_TWEAK_13 0x2d2d2d2d
177 #define GIFT128TM_TWEAK_14 0x1e1e1e1e
178 #define GIFT128TM_TWEAK_15 0xffffffff
196 void gift128t_encrypt_masked
197 (
const gift128n_masked_key_schedule_t *ks,
unsigned char *output,
198 const unsigned char *input, uint32_t tweak);
217 (
const gift128n_masked_key_schedule_t *ks,
unsigned char *output,
218 const unsigned char *input, uint32_t tweak);
void gift128n_decrypt_masked(const gift128n_masked_key_schedule_t *ks, unsigned char *output, const unsigned char *input)
Decrypts a 128-bit block with masked GIFT-128 (nibble-based).
Definition: internal-gift128-m.c:355
gift128b_masked_key_schedule_t gift128n_masked_key_schedule_t
Structure of the key schedule for masked GIFT-128 (nibble-based).
Definition: internal-gift128-m.h:123
void gift128n_encrypt_masked(const gift128n_masked_key_schedule_t *ks, unsigned char *output, const unsigned char *input)
Encrypts a 128-bit block with masked GIFT-128 (nibble-based).
Definition: internal-gift128-m.c:346
void gift128b_decrypt_masked(const gift128b_masked_key_schedule_t *ks, unsigned char *output, const unsigned char *input)
Decrypts a 128-bit block with masked GIFT-128 (bit-sliced).
Definition: internal-gift128-m.c:1300
#define GIFT128_MASKED_ROUND_KEYS
Number of round keys for the GIFT-128 key schedule.
Definition: internal-gift128-m.h:52
void gift128b_init_masked(gift128b_masked_key_schedule_t *ks, const unsigned char *key)
Initializes the key schedule for masked GIFT-128 (bit-sliced).
Definition: internal-gift128-m.c:568
Utilities that help to implement masked ciphers.
void gift128t_decrypt_masked(const gift128n_masked_key_schedule_t *ks, unsigned char *output, const unsigned char *input, uint32_t tweak)
Decrypts a 128-bit block with masked TweGIFT-128 (tweakable variant).
Definition: internal-gift128-m.c:1327
Masked 32-bit word with four shares.
Definition: internal-masking.h:152
Configures the variant of GIFT-128 to use.
Structure of the key schedule for masked GIFT-128 (bit-sliced).
Definition: internal-gift128-m.h:58
void gift128b_encrypt_preloaded_masked(const gift128b_masked_key_schedule_t *ks, mask_uint32_t output[4], const mask_uint32_t input[4])
Encrypts a block with masked GIFT-128 (bit-sliced and pre-loaded).
Definition: internal-gift128-m.c:1051
void gift128b_encrypt_masked(const gift128b_masked_key_schedule_t *ks, unsigned char *output, const unsigned char *input)
Encrypts a 128-bit block with masked GIFT-128 (bit-sliced).
Definition: internal-gift128-m.c:1024
void gift128n_init_masked(gift128n_masked_key_schedule_t *ks, const unsigned char *key)
Initializes the key schedule for masked GIFT-128 (nibble-based).
Definition: internal-gift128-m.c:576