Lightweight Cryptography Primitives
 All Data Structures Files Functions Variables Typedefs Macros Pages
internal-gift128-m.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2021 Southern Storm Software, Pty Ltd.
3  *
4  * Permission is hereby granted, free of charge, to any person obtaining a
5  * copy of this software and associated documentation files (the "Software"),
6  * to deal in the Software without restriction, including without limitation
7  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8  * and/or sell copies of the Software, and to permit persons to whom the
9  * Software is furnished to do so, subject to the following conditions:
10  *
11  * The above copyright notice and this permission notice shall be included
12  * in all copies or substantial portions of the Software.
13  *
14  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
15  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20  * DEALINGS IN THE SOFTWARE.
21  */
22 
23 #ifndef LW_INTERNAL_GIFT128_M_H
24 #define LW_INTERNAL_GIFT128_M_H
25 
31 #include "internal-masking.h"
33 
34 #ifdef __cplusplus
35 extern "C" {
36 #endif
37 
41 #define GIFT128_MASKED_BLOCK_SIZE 16
42 
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
51 #else
52 #define GIFT128_MASKED_ROUND_KEYS 80
53 #endif
54 
58 typedef struct
59 {
62 
64 
72  (gift128b_masked_key_schedule_t *ks, const unsigned char *key);
73 
89  (const gift128b_masked_key_schedule_t *ks, mask_uint32_t output[4],
90  const mask_uint32_t input[4]);
91 
107  (const gift128b_masked_key_schedule_t *ks, mask_uint32_t output[4],
108  const mask_uint32_t input[4]);
109 
110 #ifdef __cplusplus
111 }
112 #endif
113 
114 #endif
void gift128b_decrypt_preloaded_masked(const gift128b_masked_key_schedule_t *ks, mask_uint32_t output[4], const mask_uint32_t input[4])
Decrypts a block with masked GIFT-128 (bit-sliced and pre-loaded).
Definition: internal-gift128-m.c:872
#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:327
Utilities that help to implement masked ciphers.
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:780