Lightweight Cryptography Primitives
 All Data Structures Files Functions Variables Typedefs Macros Pages
internal-skinny-plus.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_SKINNY_PLUS_H
24 #define LW_INTERNAL_SKINNY_PLUS_H
25 
34 #include <stddef.h>
35 #include <stdint.h>
37 
38 #ifdef __cplusplus
39 extern "C" {
40 #endif
41 
45 #define SKINNY_PLUS_BLOCK_SIZE 16
46 
50 #define SKINNY_PLUS_ROUNDS 40
51 
55 typedef struct
56 {
58  uint8_t TK1[16];
59 
60 #if SKINNY_PLUS_VARIANT == SKINNY_PLUS_VARIANT_TINY
61 
62  uint8_t TK2[16];
63 
65  uint8_t TK3[16];
66 #elif SKINNY_PLUS_VARIANT == SKINNY_PLUS_VARIANT_FULL
67 
68  uint32_t k[SKINNY_PLUS_ROUNDS * 4];
69 #else
70 
71  uint32_t k[SKINNY_PLUS_ROUNDS * 2];
72 #endif
73 
75 
83  (skinny_plus_key_schedule_t *ks, const unsigned char key[48]);
84 
93  (skinny_plus_key_schedule_t *ks, const unsigned char *tk2,
94  const unsigned char *tk3);
95 
107  (const skinny_plus_key_schedule_t *ks, unsigned char *output,
108  const unsigned char *input);
109 
121  (const skinny_plus_key_schedule_t *ks, unsigned char *output,
122  const unsigned char *input);
123 
140  (const unsigned char key[48], unsigned char *output,
141  const unsigned char *input);
142 
159  (const unsigned char key[48], unsigned char *output,
160  const unsigned char *input);
161 
162 #ifdef __cplusplus
163 }
164 #endif
165 
166 #endif
void skinny_plus_decrypt(const skinny_plus_key_schedule_t *ks, unsigned char *output, const unsigned char *input)
Decrypts a 128-bit block with SKINNY-128-384+.
Definition: internal-skinny-plus.c:852
void skinny_plus_init_without_tk1(skinny_plus_key_schedule_t *ks, const unsigned char *tk2, const unsigned char *tk3)
Initializes the key schedule for SKINNY-128-384+ without TK1.
Definition: internal-skinny-plus.c:820
void skinny_plus_encrypt_tk_full(const unsigned char key[48], unsigned char *output, const unsigned char *input)
Encrypts a 128-bit block with SKINNY-128-384+ and a fully specified tweakey value.
Definition: internal-skinny-plus.c:876
void skinny_plus_init(skinny_plus_key_schedule_t *ks, const unsigned char key[48])
Initializes the key schedule for SKINNY-128-384+.
Definition: internal-skinny-plus.c:810
void skinny_plus_encrypt(const skinny_plus_key_schedule_t *ks, unsigned char *output, const unsigned char *input)
Encrypts a 128-bit block with SKINNY-128-384+.
Definition: internal-skinny-plus.c:828
void skinny_plus_decrypt_tk_full(const unsigned char key[48], unsigned char *output, const unsigned char *input)
Decrypts a 128-bit block with SKINNY-128-384+ and a fully specified tweakey value.
Definition: internal-skinny-plus.c:901
Structure of the key schedule for SKINNY-128-384+.
Definition: internal-skinny-plus.h:55
#define SKINNY_PLUS_ROUNDS
Number of rounds for SKINNY-128-384+.
Definition: internal-skinny-plus.h:50
Configures the variant of SKINNY-128-384+ to use.