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

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

#include <Skinny128.h>

Inheritance diagram for Skinny128_Tweaked:
Skinny128 BlockCipher Skinny128_256_Tweaked Skinny128_384_Tweaked

Public Member Functions

virtual ~Skinny128_Tweaked ()
 Destroys this tweakable Skinny-128 block cipher object after clearing sensitive information.
 
bool setTweak (const uint8_t *tweak, size_t len)
 Sets the 128-bit tweak value for this block cipher. More...
 
void clear ()
 Clears all security-sensitive state from this block cipher. More...
 
- Public Member Functions inherited from Skinny128
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...
 
- 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_Tweaked (uint32_t *schedule, uint8_t rounds)
 Constructs a tweakable Skinny-128 block cipher object. More...
 
void resetTweak ()
 Resets the tweak to all-zeroes. More...
 
- Protected Member Functions inherited from Skinny128
 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 tweakable block ciphers with 128-bit blocks.

This class is abstract. The caller should instantiate Skinny128_256_Tweaked or Skinny128_384_Tweaked to create a SKINNY block cipher with a tweak and a specific key size.

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

See Also
Skinny128_256_Tweaked, Skinny128_384_Tweaked

Definition at line 53 of file Skinny128.h.

Constructor & Destructor Documentation

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

Constructs a tweakable 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 1231 of file Skinny128.cpp.

Member Function Documentation

void Skinny128_Tweaked::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()

Reimplemented from Skinny128.

Definition at line 1274 of file Skinny128.cpp.

void Skinny128_Tweaked::resetTweak ( )
protected

Resets the tweak to all-zeroes.

This is used by subclass implementations of setKey().

Definition at line 1285 of file Skinny128.cpp.

bool Skinny128_Tweaked::setTweak ( const uint8_t *  tweak,
size_t  len 
)

Sets the 128-bit tweak value for this block cipher.

Parameters
tweakPoints to the tweak, and can be NULL if you want a tweak of all-zeroes (the default).
lenLength of tweak in bytes, which must be 16.
Returns
Returns true if the tweak was set or false if len is incorrect.

This function must be called after setKey() as the setKey() call will implicitly set the tweak back to all-zeroes.

See Also
setKey()

Definition at line 1260 of file Skinny128.cpp.


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