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

SKINNY-128 block cipher family. More...

#include <stddef.h>
#include <stdint.h>

Go to the source code of this file.

Data Structures

struct  skinny_128_384_key_schedule_t
 Structure of the key schedule for SKINNY-128-384. More...
 
struct  skinny_128_256_key_schedule_t
 Structure of the key schedule for SKINNY-128-256. More...
 

Macros

#define SKINNY_128_SMALL_SCHEDULE   0
 Defined to 1 to use the small key schedule version of SKINNY-128.
 
#define SKINNY_128_BLOCK_SIZE   16
 Size of a block for SKINNY-128 block ciphers.
 
#define SKINNY_128_384_ROUNDS   56
 Number of rounds for SKINNY-128-384.
 
#define SKINNY_128_256_ROUNDS   48
 Number of rounds for SKINNY-128-256.
 

Functions

void skinny_128_384_init (skinny_128_384_key_schedule_t *ks, const unsigned char key[48])
 Initializes the key schedule for SKINNY-128-384. More...
 
void skinny_128_384_encrypt (const skinny_128_384_key_schedule_t *ks, unsigned char *output, const unsigned char *input)
 Encrypts a 128-bit block with SKINNY-128-384. More...
 
void skinny_128_384_decrypt (const skinny_128_384_key_schedule_t *ks, unsigned char *output, const unsigned char *input)
 Decrypts a 128-bit block with SKINNY-128-384. More...
 
void skinny_128_384_encrypt_tk2 (skinny_128_384_key_schedule_t *ks, unsigned char *output, const unsigned char *input, const unsigned char *tk2)
 Encrypts a 128-bit block with SKINNY-128-384 and an explicitly provided TK2 value. More...
 
void skinny_128_384_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. More...
 
void skinny_128_256_init (skinny_128_256_key_schedule_t *ks, const unsigned char key[32])
 Initializes the key schedule for SKINNY-128-256. More...
 
void skinny_128_256_encrypt (const skinny_128_256_key_schedule_t *ks, unsigned char *output, const unsigned char *input)
 Encrypts a 128-bit block with SKINNY-128-256. More...
 
void skinny_128_256_decrypt (const skinny_128_256_key_schedule_t *ks, unsigned char *output, const unsigned char *input)
 Decrypts a 128-bit block with SKINNY-128-256. More...
 
void skinny_128_256_encrypt_tk_full (const unsigned char key[32], unsigned char *output, const unsigned char *input)
 Encrypts a 128-bit block with SKINNY-128-256 and a fully specified tweakey value. More...
 

Detailed Description

SKINNY-128 block cipher family.

References: https://eprint.iacr.org/2016/660.pdf, https://sites.google.com/site/skinnycipher/

Function Documentation

void skinny_128_256_decrypt ( const skinny_128_256_key_schedule_t ks,
unsigned char *  output,
const unsigned char *  input 
)

Decrypts a 128-bit block with SKINNY-128-256.

Parameters
ksPoints to the SKINNY-128-256 key schedule.
outputOutput buffer which must be at least 16 bytes in length.
inputInput buffer which must be at least 16 bytes in length.

The input and output buffers can be the same buffer for in-place encryption.

void skinny_128_256_encrypt ( const skinny_128_256_key_schedule_t ks,
unsigned char *  output,
const unsigned char *  input 
)

Encrypts a 128-bit block with SKINNY-128-256.

Parameters
ksPoints to the SKINNY-128-256 key schedule.
outputOutput buffer which must be at least 16 bytes in length.
inputInput buffer which must be at least 16 bytes in length.

The input and output buffers can be the same buffer for in-place encryption.

void skinny_128_256_encrypt_tk_full ( const unsigned char  key[32],
unsigned char *  output,
const unsigned char *  input 
)

Encrypts a 128-bit block with SKINNY-128-256 and a fully specified tweakey value.

Parameters
keyPoints to the 256-bit tweakey value.
outputOutput buffer which must be at least 16 bytes in length.
inputInput buffer which must be at least 16 bytes in length.

The input and output buffers can be the same buffer for in-place encryption.

This version is useful when the entire tweakey changes from block to block. It is slower than the other versions of SKINNY-128-256 but more memory-efficient.

void skinny_128_256_init ( skinny_128_256_key_schedule_t ks,
const unsigned char  key[32] 
)

Initializes the key schedule for SKINNY-128-256.

Parameters
ksPoints to the key schedule to initialize.
keyPoints to the key data.
void skinny_128_384_decrypt ( const skinny_128_384_key_schedule_t ks,
unsigned char *  output,
const unsigned char *  input 
)

Decrypts a 128-bit block with SKINNY-128-384.

Parameters
ksPoints to the SKINNY-128-384 key schedule.
outputOutput buffer which must be at least 16 bytes in length.
inputInput buffer which must be at least 16 bytes in length.

The input and output buffers can be the same buffer for in-place encryption.

void skinny_128_384_encrypt ( const skinny_128_384_key_schedule_t ks,
unsigned char *  output,
const unsigned char *  input 
)

Encrypts a 128-bit block with SKINNY-128-384.

Parameters
ksPoints to the SKINNY-128-384 key schedule.
outputOutput buffer which must be at least 16 bytes in length.
inputInput buffer which must be at least 16 bytes in length.

The input and output buffers can be the same buffer for in-place encryption.

void skinny_128_384_encrypt_tk2 ( skinny_128_384_key_schedule_t ks,
unsigned char *  output,
const unsigned char *  input,
const unsigned char *  tk2 
)

Encrypts a 128-bit block with SKINNY-128-384 and an explicitly provided TK2 value.

Parameters
ksPoints to the SKINNY-128-384 key schedule.
outputOutput buffer which must be at least 16 bytes in length.
inputInput buffer which must be at least 16 bytes in length.
tk2TK2 value that should be updated on the fly.

The input and output buffers can be the same buffer for in-place encryption.

This version is useful when both TK1 and TK2 change from block to block. When the key is initialized with skinny_128_384_init(), the TK2 part of the key value should be set to zero.

Note
Some versions of this function may modify the key schedule to copy tk2 into place.
void skinny_128_384_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.

Parameters
keyPoints to the 384-bit tweakey value.
outputOutput buffer which must be at least 16 bytes in length.
inputInput buffer which must be at least 16 bytes in length.

The input and output buffers can be the same buffer for in-place encryption.

This version is useful when the entire tweakey changes from block to block. It is slower than the other versions of SKINNY-128-384 but more memory-efficient.

void skinny_128_384_init ( skinny_128_384_key_schedule_t ks,
const unsigned char  key[48] 
)

Initializes the key schedule for SKINNY-128-384.

Parameters
ksPoints to the key schedule to initialize.
keyPoints to the key data.