Skinny-C
 All Data Structures Files Functions Variables Groups Pages
Public Member Functions | Protected Member Functions
Skinny128 Class Reference

Abstract base class for SKINNY block ciphers with 128-bit blocks. More...

#include <Skinny128.h>

Inheritance diagram for Skinny128:
BlockCipher Skinny128_128 Skinny128_256 Skinny128_384 Skinny128_Tweaked Skinny128_256_Tweaked Skinny128_384_Tweaked

Public Member Functions

virtual ~Skinny128 ()
 Destroys this Skinny-128 block cipher object after clearing sensitive information.
 
size_t blockSize () const
 Size of a Skinny-128 block in bytes. More...
 
void encryptBlock (uint8_t *output, const uint8_t *input)
 Encrypts a single block using this cipher. More...
 
void decryptBlock (uint8_t *output, const uint8_t *input)
 Decrypts a single block using this cipher. More...
 
void clear ()
 Clears all security-sensitive state from this block cipher. More...
 
- Public Member Functions inherited from BlockCipher
 BlockCipher ()
 Constructs a block cipher.
 
virtual ~BlockCipher ()
 Destroys this block cipher object. More...
 
virtual size_t keySize () const =0
 Default size of the key for this block cipher, in bytes. More...
 
virtual bool setKey (const uint8_t *key, size_t len)=0
 Sets the key to use for future encryption and decryption operations. More...
 

Protected Member Functions

 Skinny128 (uint32_t *schedule, uint8_t rounds)
 Constructs a Skinny-128 block cipher object. More...
 
void setTK1 (const uint8_t *key, bool tweaked=false)
 Clears the key schedule and sets it to the schedule for TK1. More...
 
void xorTK1 (const uint8_t *key)
 XOR's the key schedule with the schedule for TK1. More...
 
void setTK2 (const uint8_t *key)
 XOR's the key schedule with the schedule for TK2. More...
 
void setTK3 (const uint8_t *key)
 XOR's the key schedule with the schedule for TK3. More...
 

Detailed Description

Abstract base class for SKINNY block ciphers with 128-bit blocks.

This class is abstract. The caller should instantiate Skinny128_128, Skinny128_256, or Skinny128_384 to create a SKINNY block cipher with a specific key size. Or instantiate Skinny128_256_Tweaked or Skinny128_384_Tweaked for a tweakable version of the SKINNY block cipher.

Reference: https://sites.google.com/site/skinnycipher/

See Also
Skinny128_128, Skinny128_256, Skinny128_384, Skinny128_Tweaked

Definition at line 28 of file Skinny128.h.

Constructor & Destructor Documentation

Skinny128::Skinny128 ( uint32_t *  schedule,
uint8_t  rounds 
)
protected

Constructs a Skinny-128 block cipher object.

Parameters
schedulePoints to the schedule data structure in the subclass.
roundsThe number of rounds to perform during encryption/decryption.

Definition at line 109 of file Skinny128.cpp.

Member Function Documentation

size_t Skinny128::blockSize ( ) const
virtual

Size of a Skinny-128 block in bytes.

Returns
Always returns 16.

Implements BlockCipher.

Definition at line 126 of file Skinny128.cpp.

void Skinny128::clear ( )
virtual

Clears all security-sensitive state from this block cipher.

Security-sensitive information includes key schedules and any temporary state that is used by encryptBlock() or decryptBlock() which is stored in the object itself.

See Also
setKey(), encryptBlock(), decryptBlock()

Implements BlockCipher.

Reimplemented in Skinny128_Tweaked.

Definition at line 717 of file Skinny128.cpp.

void Skinny128::decryptBlock ( uint8_t *  output,
const uint8_t *  input 
)
virtual

Decrypts a single block using this cipher.

Parameters
outputThe output buffer to put the plaintext into. Must be at least blockSize() bytes in length.
inputThe input buffer to read the ciphertext from which is allowed to overlap with output. Must be at least blockSize() bytes in length.
See Also
encryptBlock(), blockSize()

Implements BlockCipher.

Definition at line 531 of file Skinny128.cpp.

void Skinny128::encryptBlock ( uint8_t *  output,
const uint8_t *  input 
)
virtual

Encrypts a single block using this cipher.

Parameters
outputThe output buffer to put the ciphertext into. Must be at least blockSize() bytes in length.
inputThe input buffer to read the plaintext from which is allowed to overlap with output. Must be at least blockSize() bytes in length.
See Also
decryptBlock(), blockSize()

Implements BlockCipher.

Definition at line 343 of file Skinny128.cpp.

void Skinny128::setTK1 ( const uint8_t *  key,
bool  tweaked = false 
)
protected

Clears the key schedule and sets it to the schedule for TK1.

Parameters
keyPoints to the 16 bytes of TK1.
tweakedSet to true if the subclass uses tweaks.

Definition at line 773 of file Skinny128.cpp.

void Skinny128::setTK2 ( const uint8_t *  key)
protected

XOR's the key schedule with the schedule for TK2.

Parameters
keyPoints to the 16 bytes of TK2.

Definition at line 1014 of file Skinny128.cpp.

void Skinny128::setTK3 ( const uint8_t *  key)
protected

XOR's the key schedule with the schedule for TK3.

Parameters
keyPoints to the 16 bytes of TK3.

Definition at line 1122 of file Skinny128.cpp.

void Skinny128::xorTK1 ( const uint8_t *  key)
protected

XOR's the key schedule with the schedule for TK1.

Parameters
keyPoints to the 16 bytes of TK1.

This function is used to adjust the tweak for the tweakable versions of the SKINNY block cipher.

Definition at line 891 of file Skinny128.cpp.


The documentation for this class was generated from the following files: