Interface for the data processing part of block ciphers. More...
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 Clonable * | Clone () const |
Copies this object. |
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.
Bit flags that control AdvancedProcessBlocks() behavior.
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.
virtual void BlockTransformation::ProcessAndXorBlock | ( | const byte * | inBlock, | |
const byte * | xorBlock, | |||
byte * | outBlock | |||
) | const [pure virtual] |
Encrypt or decrypt a block.
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.
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.
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.
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.
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.
Definition at line 694 of file cryptlib.h.
virtual unsigned int BlockTransformation::BlockSize | ( | ) | const [pure virtual] |
Provides the block size of the cipher.
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.
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.
virtual unsigned int BlockTransformation::OptimalNumberOfParallelBlocks | ( | ) | const [inline, virtual] |
Determines the number of blocks that can be processed in parallel.
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.
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.
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] |
Definition at line 742 of file cryptlib.h.
virtual std::string Algorithm::AlgorithmName | ( | ) | const [inline, virtual, inherited] |
Provides the name of this algorithm.
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.
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.
NotImplemented |
Definition at line 464 of file cryptlib.h.