Lightweight Cryptography Primitives
 All Data Structures Files Functions Variables Typedefs Macros Pages
internal-forkskinny.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2020 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_FORKSKINNY_H
24 #define LW_INTERNAL_FORKSKINNY_H
25 
26 #include "internal-util.h"
27 
39 #ifdef __cplusplus
40 extern "C" {
41 #endif
42 
46 typedef struct
47 {
48  uint32_t TK1[4];
49  uint32_t TK2[4];
50  uint32_t S[4];
53 
57 typedef struct
58 {
59  uint32_t TK1[4];
60  uint32_t TK2[4];
61  uint32_t TK3[4];
62  uint32_t S[4];
65 
69 typedef struct
70 {
71  uint16_t TK1[4];
72  uint16_t TK2[4];
73  uint16_t TK3[4];
74  uint16_t S[4];
77 
86  (forkskinny_128_256_state_t *state, unsigned first, unsigned last);
87 
96  (forkskinny_128_256_state_t *state, unsigned first, unsigned last);
97 
105  (forkskinny_128_256_state_t *state, unsigned rounds);
106 
114  (forkskinny_128_256_state_t *state, unsigned rounds);
115 
124  (forkskinny_128_384_state_t *state, unsigned first, unsigned last);
125 
134  (forkskinny_128_384_state_t *state, unsigned first, unsigned last);
135 
143  (forkskinny_128_384_state_t *state, unsigned rounds);
144 
152  (forkskinny_128_384_state_t *state, unsigned rounds);
153 
165  (forkskinny_64_192_state_t *state, unsigned first, unsigned last);
166 
175  (forkskinny_64_192_state_t *state, unsigned first, unsigned last);
176 
184  (forkskinny_64_192_state_t *state, unsigned rounds);
185 
193  (forkskinny_64_192_state_t *state, unsigned rounds);
194 
208  (const unsigned char key[32], unsigned char *output_left,
209  unsigned char *output_right, const unsigned char *input);
210 
222  (const unsigned char key[32], unsigned char *output_left,
223  unsigned char *output_right, const unsigned char *input);
224 
238  (const unsigned char key[48], unsigned char *output_left,
239  unsigned char *output_right, const unsigned char *input);
240 
252  (const unsigned char key[48], unsigned char *output_left,
253  unsigned char *output_right, const unsigned char *input);
254 
274  (const unsigned char key[24], unsigned char *output_left,
275  unsigned char *output_right, const unsigned char *input);
276 
288  (const unsigned char key[24], unsigned char *output_left,
289  unsigned char *output_right, const unsigned char *input);
290 
291 #ifdef __cplusplus
292 }
293 #endif
294 
295 #endif
void forkskinny_64_192_inv_rounds(forkskinny_64_192_state_t *state, unsigned first, unsigned last)
Applies several rounds of ForkSkinny-64-192 in reverse.
Definition: internal-forkskinny.c:463
State information for ForkSkinny-128-256.
Definition: internal-forkskinny.h:46
void forkskinny_128_384_inv_rounds(forkskinny_128_384_state_t *state, unsigned first, unsigned last)
Applies several rounds of ForkSkinny-128-384 in reverse.
Definition: internal-forkskinny.c:274
State information for ForkSkinny-128-384.
Definition: internal-forkskinny.h:57
void forkskinny_128_384_reverse_tk(forkskinny_128_384_state_t *state, unsigned rounds)
Reverses the tweakey for ForkSkinny-128-384.
Definition: internal-forkskinny.c:369
State information for ForkSkinny-64-192.
Definition: internal-forkskinny.h:69
void forkskinny_128_256_forward_tk(forkskinny_128_256_state_t *state, unsigned rounds)
Forwards the tweakey for ForkSkinny-128-256.
Definition: internal-forkskinny.c:158
void forkskinny_64_192_rounds(forkskinny_64_192_state_t *state, unsigned first, unsigned last)
Applies several rounds of ForkSkinny-64-192.
Definition: internal-forkskinny.c:404
void forkskinny_64_192_reverse_tk(forkskinny_64_192_state_t *state, unsigned rounds)
Reverses the tweakey for ForkSkinny-64-192.
Definition: internal-forkskinny.c:557
void forkskinny_128_256_encrypt(const unsigned char key[32], unsigned char *output_left, unsigned char *output_right, const unsigned char *input)
Encrypts a block of plaintext with ForkSkinny-128-256.
Definition: forkae.c:155
void forkskinny_64_192_encrypt(const unsigned char key[24], unsigned char *output_left, unsigned char *output_right, const unsigned char *input)
Encrypts a block of input with ForkSkinny-64-192.
Definition: forkae.c:466
void forkskinny_128_256_decrypt(const unsigned char key[32], unsigned char *output_left, unsigned char *output_right, const unsigned char *input)
Decrypts a block of ciphertext with ForkSkinny-128-256.
Definition: forkae.c:231
void forkskinny_64_192_forward_tk(forkskinny_64_192_state_t *state, unsigned rounds)
Forwards the tweakey for ForkSkinny-64-192.
Definition: internal-forkskinny.c:522
void forkskinny_128_384_forward_tk(forkskinny_128_384_state_t *state, unsigned rounds)
Forwards the tweakey for ForkSkinny-128-384.
Definition: internal-forkskinny.c:334
void forkskinny_128_384_decrypt(const unsigned char key[48], unsigned char *output_left, unsigned char *output_right, const unsigned char *input)
Decrypts a block of ciphertext with ForkSkinny-128-384.
Definition: forkae.c:387
void forkskinny_128_256_reverse_tk(forkskinny_128_256_state_t *state, unsigned rounds)
Reverses the tweakey for ForkSkinny-128-256.
Definition: internal-forkskinny.c:186
void forkskinny_128_384_rounds(forkskinny_128_384_state_t *state, unsigned first, unsigned last)
Applies several rounds of ForkSkinny-128-384.
Definition: internal-forkskinny.c:214
void forkskinny_128_256_inv_rounds(forkskinny_128_256_state_t *state, unsigned first, unsigned last)
Applies several rounds of ForkSkinny-128-256 in reverse.
Definition: internal-forkskinny.c:102
void forkskinny_128_384_encrypt(const unsigned char key[48], unsigned char *output_left, unsigned char *output_right, const unsigned char *input)
Encrypts a block of plaintext with ForkSkinny-128-384.
Definition: forkae.c:307
void forkskinny_128_256_rounds(forkskinny_128_256_state_t *state, unsigned first, unsigned last)
Applies several rounds of ForkSkinny-128-256.
Definition: internal-forkskinny.c:46
void forkskinny_64_192_decrypt(const unsigned char key[24], unsigned char *output_left, unsigned char *output_right, const unsigned char *input)
Decrypts a block of ciphertext with ForkSkinny-64-192.
Definition: forkae.c:546