Lightweight Cryptography Primitives
 All Data Structures Files Functions Variables Typedefs Macros Pages
Data Structures | Functions
internal-forkskinny.h File Reference

ForkSkinny block cipher family. More...

#include "internal-util.h"

Go to the source code of this file.

Data Structures

struct  forkskinny_128_256_state_t
 State information for ForkSkinny-128-256. More...
 
struct  forkskinny_128_384_state_t
 State information for ForkSkinny-128-384. More...
 
struct  forkskinny_64_192_state_t
 State information for ForkSkinny-64-192. More...
 

Functions

void forkskinny_128_256_rounds (forkskinny_128_256_state_t *state, unsigned first, unsigned last)
 Applies several rounds of ForkSkinny-128-256. More...
 
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. More...
 
void forkskinny_128_256_forward_tk (forkskinny_128_256_state_t *state, unsigned rounds)
 Forwards the tweakey for ForkSkinny-128-256. More...
 
void forkskinny_128_256_reverse_tk (forkskinny_128_256_state_t *state, unsigned rounds)
 Reverses the tweakey for ForkSkinny-128-256. More...
 
void forkskinny_128_384_rounds (forkskinny_128_384_state_t *state, unsigned first, unsigned last)
 Applies several rounds of ForkSkinny-128-384. More...
 
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. More...
 
void forkskinny_128_384_forward_tk (forkskinny_128_384_state_t *state, unsigned rounds)
 Forwards the tweakey for ForkSkinny-128-384. More...
 
void forkskinny_128_384_reverse_tk (forkskinny_128_384_state_t *state, unsigned rounds)
 Reverses the tweakey for ForkSkinny-128-384. More...
 
void forkskinny_64_192_rounds (forkskinny_64_192_state_t *state, unsigned first, unsigned last)
 Applies several rounds of ForkSkinny-64-192. More...
 
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. More...
 
void forkskinny_64_192_forward_tk (forkskinny_64_192_state_t *state, unsigned rounds)
 Forwards the tweakey for ForkSkinny-64-192. More...
 
void forkskinny_64_192_reverse_tk (forkskinny_64_192_state_t *state, unsigned rounds)
 Reverses the tweakey for ForkSkinny-64-192. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 

Detailed Description

ForkSkinny block cipher family.

ForkSkinny is a modified version of the SKINNY block cipher that supports "forking": half-way through the rounds the cipher is forked in two different directions to produce two different outputs.

References: https://www.esat.kuleuven.be/cosic/forkae/

Function Documentation

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.

Parameters
key256-bit tweakey for ForkSkinny-128-256.
output_leftLeft output block, which is the plaintext.
output_rightRight output block for the authentication tag.
input128-bit input ciphertext block.

Both output blocks will be populated; neither is optional.

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.

Parameters
key256-bit tweakey for ForkSkinny-128-256.
output_leftLeft output block for the ciphertext, or NULL if the left output is not required.
output_rightRight output block for the authentication tag, or NULL if the right output is not required.
input128-bit input plaintext block.

ForkSkinny-128-192 also uses this function with a padded tweakey.

void forkskinny_128_256_forward_tk ( forkskinny_128_256_state_t state,
unsigned  rounds 
)

Forwards the tweakey for ForkSkinny-128-256.

Parameters
statePoints to the ForkSkinny-128-256 state.
roundsNumber of rounds to forward by.
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.

Parameters
stateState to apply the rounds to.
firstFirst round to apply plus 1.
lastLast round to apply.
void forkskinny_128_256_reverse_tk ( forkskinny_128_256_state_t state,
unsigned  rounds 
)

Reverses the tweakey for ForkSkinny-128-256.

Parameters
statePoints to the ForkSkinny-128-256 state.
roundsNumber of rounds to reverse by.
void forkskinny_128_256_rounds ( forkskinny_128_256_state_t state,
unsigned  first,
unsigned  last 
)

Applies several rounds of ForkSkinny-128-256.

Parameters
stateState to apply the rounds to.
firstFirst round to apply.
lastLast round to apply plus 1.
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.

Parameters
key384-bit tweakey for ForkSkinny-128-384.
output_leftLeft output block, which is the plaintext.
output_rightRight output block for the authentication tag.
input128-bit input ciphertext block.

Both output blocks will be populated; neither is optional.

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.

Parameters
key384-bit tweakey for ForkSkinny-128-384.
output_leftLeft output block for the ciphertext, or NULL if the left output is not required.
output_rightRight output block for the authentication tag, or NULL if the right output is not required.
input128-bit input plaintext block.

ForkSkinny-128-288 also uses this function with a padded tweakey.

void forkskinny_128_384_forward_tk ( forkskinny_128_384_state_t state,
unsigned  rounds 
)

Forwards the tweakey for ForkSkinny-128-384.

Parameters
statePoints to the ForkSkinny-128-384 state.
roundsNumber of rounds to forward by.
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.

Parameters
stateState to apply the rounds to.
firstFirst round to apply plus 1.
lastLast round to apply.
void forkskinny_128_384_reverse_tk ( forkskinny_128_384_state_t state,
unsigned  rounds 
)

Reverses the tweakey for ForkSkinny-128-384.

Parameters
statePoints to the ForkSkinny-128-384 state.
roundsNumber of rounds to reverse by.
void forkskinny_128_384_rounds ( forkskinny_128_384_state_t state,
unsigned  first,
unsigned  last 
)

Applies several rounds of ForkSkinny-128-384.

Parameters
stateState to apply the rounds to.
firstFirst round to apply.
lastLast round to apply plus 1.
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.

Parameters
key192-bit tweakey for ForkSkinny-64-192.
output_leftLeft output block, which is the plaintext.
output_rightRight output block for the authentication tag.
input64-bit input ciphertext block.

Both output blocks will be populated; neither is optional.

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.

Parameters
key192-bit tweakey for ForkSkinny-64-192.
output_leftFirst output block, or NULL if left is not required.
output_rightSecond output block, or NULL if right is not required.
input64-bit input block. Encrypts a block of plaintext with ForkSkinny-64-192.
key192-bit tweakey for ForkSkinny-64-192.
output_leftLeft output block for the ciphertext, or NULL if the left output is not required.
output_rightRight output block for the authentication tag, or NULL if the right output is not required.
input64-bit input plaintext block.
void forkskinny_64_192_forward_tk ( forkskinny_64_192_state_t state,
unsigned  rounds 
)

Forwards the tweakey for ForkSkinny-64-192.

Parameters
statePoints to the ForkSkinny-64-192 state.
roundsNumber of rounds to forward by.
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.

Parameters
stateState to apply the rounds to.
firstFirst round to apply plus 1.
lastLast round to apply.
void forkskinny_64_192_reverse_tk ( forkskinny_64_192_state_t state,
unsigned  rounds 
)

Reverses the tweakey for ForkSkinny-64-192.

Parameters
statePoints to the ForkSkinny-64-192 state.
roundsNumber of rounds to reverse by.
void forkskinny_64_192_rounds ( forkskinny_64_192_state_t state,
unsigned  first,
unsigned  last 
)

Applies several rounds of ForkSkinny-64-192.

Parameters
stateState to apply the rounds to.
firstFirst round to apply.
lastLast round to apply plus 1.

Note: The cells of each row are ordered in big-endian nibble order so it is simplest to manage the rows in big-endian byte order.