BlockTransformation Class Reference

Interface for the data processing part of block ciphers. More...

Inheritance diagram for BlockTransformation:
Algorithm Clonable BlockCipher SAFER::Base SimpleKeyingInterfaceImpl< BlockCipher, BTEA_Info > SAFER::Dec SAFER::Enc AlgorithmImpl< SimpleKeyingInterfaceImpl< BlockCipher, BTEA_Info >, BTEA_Info >

List of all members.

Public Types

enum  FlagsForAdvancedProcessBlocks {
  BT_InBlockIsCounter = 1, BT_DontIncrementInOutPointers = 2, BT_XorInput = 4, BT_ReverseDirection = 8,
  BT_AllowParallel = 16
}
 

Bit flags that control AdvancedProcessBlocks() behavior.

More...

Public Member Functions

virtual void ProcessAndXorBlock (const byte *inBlock, const byte *xorBlock, byte *outBlock) const =0
 Encrypt or decrypt a block.
void ProcessBlock (const byte *inBlock, byte *outBlock) const
 Encrypt or decrypt a block.
void ProcessBlock (byte *inoutBlock) const
 Encrypt or decrypt a block in place.
virtual unsigned int BlockSize () const =0
 Provides the block size of the cipher.
virtual unsigned int OptimalDataAlignment () const
 Provides input and output data alignment for optimal performance.
virtual bool IsPermutation () const
 returns true if this is a permutation (i.e. there is an inverse transformation)
virtual bool IsForwardTransformation () const =0
 Determines if the cipher is being operated in its forward direction.
virtual unsigned int OptimalNumberOfParallelBlocks () const
 Determines the number of blocks that can be processed in parallel.
virtual size_t AdvancedProcessBlocks (const byte *inBlocks, const byte *xorBlocks, byte *outBlocks, size_t length, word32 flags) const
 Encrypt and xor multiple blocks using additional flags.
CipherDir GetCipherDirection () const
virtual std::string AlgorithmName () const
 Provides the name of this algorithm.
virtual ClonableClone () const
 Copies this object.

Detailed Description

Interface for the data processing part of block ciphers.

Classes derived from BlockTransformation are block ciphers in ECB mode (for example the DES::Encryption class), which are stateless. These classes should not be used directly, but only in combination with a mode class (see CipherModeDocumentation in modes.h).

Definition at line 663 of file cryptlib.h.


Member Enumeration Documentation

Bit flags that control AdvancedProcessBlocks() behavior.

Enumerator:
BT_InBlockIsCounter 

inBlock is a counter

BT_DontIncrementInOutPointers 

should not modify block pointers

BT_ReverseDirection 

perform the transformation in reverse

Definition at line 719 of file cryptlib.h.


Member Function Documentation

virtual void BlockTransformation::ProcessAndXorBlock ( const byte *  inBlock,
const byte *  xorBlock,
byte *  outBlock 
) const [pure virtual]

Encrypt or decrypt a block.

Parameters:
inBlock the input message before processing
outBlock the output message after processing
xorBlock an optional XOR mask

ProcessAndXorBlock encrypts or decrypts inBlock, xor with xorBlock, and write to outBlock.

The size of the block is determined by the block cipher and its documentation. Use BLOCKSIZE at compile time, or BlockSize() at runtime.

Note:
The message can be transformed in-place, or the buffers must not overlap
See also:
FixedBlockSize, BlockCipherFinal from seckey.h and BlockSize()

Implemented in SAFER::Enc, and SAFER::Dec.

Referenced by AdvancedProcessBlocks().

void BlockTransformation::ProcessBlock ( const byte *  inBlock,
byte *  outBlock 
) const [inline]

Encrypt or decrypt a block.

Parameters:
inBlock the input message before processing
outBlock the output message after processing

ProcessBlock encrypts or decrypts inBlock and write to outBlock.

The size of the block is determined by the block cipher and its documentation. Use BLOCKSIZE at compile time, or BlockSize() at runtime.

See also:
FixedBlockSize, BlockCipherFinal from seckey.h and BlockSize()
Note:
The message can be transformed in-place, or the buffers must not overlap

Definition at line 685 of file cryptlib.h.

Referenced by AdvancedProcessBlocks(), VMAC_Base::Resynchronize(), VMAC_Base::UncheckedSetKey(), CMAC_Base::UncheckedSetKey(), and CMAC_Base::Update().

void BlockTransformation::ProcessBlock ( byte *  inoutBlock  )  const [inline]

Encrypt or decrypt a block in place.

Parameters:
inoutBlock the input message before processing

ProcessBlock encrypts or decrypts inoutBlock in-place.

The size of the block is determined by the block cipher and its documentation. Use BLOCKSIZE at compile time, or BlockSize() at runtime.

See also:
FixedBlockSize, BlockCipherFinal from seckey.h and BlockSize()

Definition at line 694 of file cryptlib.h.

virtual unsigned int BlockTransformation::BlockSize (  )  const [pure virtual]

Provides the block size of the cipher.

Returns:
the block size of the cipher, in bytes

Referenced by AdvancedProcessBlocks(), CMAC_Base::TruncatedFinal(), VMAC_Base::UncheckedSetKey(), CMAC_Base::UncheckedSetKey(), CMAC_Base::Update(), and CBC_MAC_Base::Update().

unsigned int BlockTransformation::OptimalDataAlignment (  )  const [virtual]

Provides input and output data alignment for optimal performance.

Returns:
the input data alignment that provides optimal performance

Reimplemented in SAFER::Base.

Definition at line 232 of file cryptlib.cpp.

Referenced by VMAC_Base::OptimalDataAlignment(), and GCM_Base::OptimalDataAlignment().

virtual bool BlockTransformation::IsForwardTransformation (  )  const [pure virtual]

Determines if the cipher is being operated in its forward direction.

Returns:
true if DIR is ENCRYPTION, false otherwise
See also:
IsForwardTransformation(), IsPermutation(), GetCipherDirection()
virtual unsigned int BlockTransformation::OptimalNumberOfParallelBlocks (  )  const [inline, virtual]

Determines the number of blocks that can be processed in parallel.

Returns:
the number of blocks that can be processed in parallel, for bit-slicing implementations

Bit-slicing is often used to improve throughput and minimize timing attacks.

Definition at line 716 of file cryptlib.h.

size_t BlockTransformation::AdvancedProcessBlocks ( const byte *  inBlocks,
const byte *  xorBlocks,
byte *  outBlocks,
size_t  length,
word32  flags 
) const [virtual]

Encrypt and xor multiple blocks using additional flags.

Parameters:
inBlocks the input message before processing
xorBlocks an optional XOR mask
outBlocks the output message after processing
length the size of the blocks, in bytes
flags additional flags to control processing

Encrypt and xor multiple blocks according to FlagsForAdvancedProcessBlocks flags.

Note:
If BT_InBlockIsCounter is set, then the last byte of inBlocks may be modified.

Definition at line 181 of file cryptlib.cpp.

References BlockSize(), BT_DontIncrementInOutPointers, BT_InBlockIsCounter, BT_ReverseDirection, ProcessAndXorBlock(), and ProcessBlock().

Referenced by CMAC_Base::TruncatedFinal(), VMAC_Base::UncheckedSetKey(), CMAC_Base::Update(), and CBC_MAC_Base::Update().

CipherDir BlockTransformation::GetCipherDirection (  )  const [inline]
virtual std::string Algorithm::AlgorithmName (  )  const [inline, virtual, inherited]

Provides the name of this algorithm.

Returns:
the standard algorithm name

The standard algorithm name can be a name like AES or AES/GCM. Some algorithms do not have standard names yet. For example, there is no standard algorithm name for Shoup's ECIES.

Note:
AlgorithmName is not universally implemented yet

Reimplemented in Adler32, CCM_Base, CRC32, ClassNullRNG, AuthenticatedSymmetricCipher, DH_Domain< GROUP_PARAMETERS, COFACTOR_OPTION >, EAX_Base, StreamTransformationFilter, HashFilter, HashVerificationFilter, AuthenticatedDecryptionFilter, SignerFilter, SignatureVerificationFilter, GCM_Base, HMAC< T >, RDRAND, RDSEED, SHA3, BitBucket, and VMAC_Base.

Definition at line 488 of file cryptlib.h.

Referenced by BufferedTransformation::ChannelCreatePutSpace(), BufferedTransformation::ChannelFlush(), BufferedTransformation::ChannelMessageSeriesEnd(), BufferedTransformation::ChannelPut2(), TF_DecryptorBase::Decrypt(), TF_EncryptorBase::Encrypt(), StreamTransformation::ProcessLastBlock(), and PK_DefaultDecryptionFilter::Put2().

virtual Clonable* Clonable::Clone (  )  const [inline, virtual, inherited]

Copies this object.

Returns:
a copy of this object
Exceptions:
NotImplemented 
Note:
this is not implemented by most classes
See also:
NotCopyable

Definition at line 464 of file cryptlib.h.


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

Generated on 24 Mar 2016 for Crypto++ by  doxygen 1.6.1