Crypto++
8.6
Free C++ class library of cryptographic schemes
|
Go to the documentation of this file.
22 #ifndef CRYPTOPP_XTS_MODE_H
23 #define CRYPTOPP_XTS_MODE_H
41 #ifndef CRYPTOPP_XTS_WIDE_BLOCK_CIPHERS
42 # define CRYPTOPP_XTS_WIDE_BLOCK_CIPHERS 0
43 #endif // CRYPTOPP_XTS_WIDE_BLOCK_CIPHERS
56 CRYPTOPP_STATIC_CONSTEXPR
const char* StaticAlgorithmName()
62 {
return GetBlockCipher().AlgorithmName() +
"/XTS";}
64 {
return GetBlockCipher().AlgorithmProvider();}
67 {
return GetBlockCipher().MinKeyLength()*2;}
69 {
return GetBlockCipher().MaxKeyLength()*2;}
71 {
return GetBlockCipher().DefaultKeyLength()*2;}
73 {
return 2*GetBlockCipher().GetValidKeyLength((n+1)/2);}
75 {
return keylength == GetValidKeyLength(keylength);}
80 void ThrowIfInvalidKeyLength(
size_t length);
85 {
return GetBlockCipher().BlockSize();}
94 {
return GetBlockCipher().BlockSize()*ParallelBlocks;}
96 {
return GetBlockCipher().BlockSize()+1;}
98 {
return GetBlockCipher().OptimalDataAlignment();}
107 void ThrowIfInvalidBlockSize(
size_t length);
111 void Resynchronize(
const byte *iv,
int ivLength=-1);
112 void ProcessData(
byte *outString,
const byte *inString,
size_t length);
113 size_t ProcessLastBlock(
byte *outString,
size_t outLength,
const byte *inString,
size_t inLength);
123 virtual void ResizeBuffers();
125 inline size_t ProcessLastPlainBlock(
byte *outString,
size_t outLength,
const byte *inString,
size_t inLength);
126 inline size_t ProcessLastCipherBlock(
byte *outString,
size_t outLength,
const byte *inString,
size_t inLength);
132 {
return const_cast<XTS_ModeBase*
>(
this)->AccessBlockCipher();}
134 {
return const_cast<XTS_ModeBase*
>(
this)->AccessTweakCipher();}
142 #if CRYPTOPP_BOOL_X64 || CRYPTOPP_BOOL_X32 || CRYPTOPP_BOOL_X86
143 enum {ParallelBlocks = 4};
145 enum {ParallelBlocks = 12};
174 template <
class CIPHER>
184 typename CIPHER::Encryption m_tweaker;
212 template <
class CIPHER>
224 #endif // CRYPTOPP_XTS_MODE_H
bool IsValidKeyLength(size_t keylength) const
Returns whether keylength is a valid key length.
size_t MaxKeyLength() const
Returns largest valid key length.
@ BIG_ENDIAN_ORDER
byte order is big-endian
Classes for block cipher modes of operation.
unsigned int MinLastBlockSize() const
Provides the size of the last block.
Classes and functions for secure memory allocations.
Interface for one direction (encryption or decryption) of a stream cipher or cipher mode.
XTS block cipher mode of operation implementation.
unsigned long long word64
64-bit unsigned datatype
XTS block cipher mode of operation default implementation.
unsigned int GetOptimalBlockSize() const
Provides the input block size most efficient for this cipher.
IV_Requirement
Secure IVs requirements as enumerated values.
size_t GetValidKeyLength(size_t n) const
Returns a valid key length for the algorithm.
size_t MinKeyLength() const
Returns smallest valid key length.
Utility functions for the Crypto++ library.
Block cipher mode of operation information.
XTS block cipher mode of operation.
std::string AlgorithmProvider() const
Retrieve the provider of this algorithm.
unsigned int BlockSize() const
Provides the block size of the cipher.
ByteOrder
Provides the byte ordering.
std::string AlgorithmName() const
Provides the name of this algorithm.
IV_Requirement IVRequirement() const
Minimal requirement for secure IVs.
Block cipher mode of operation aggregate.
const NameValuePairs & g_nullNameValuePairs
An empty set of name-value pairs.
Crypto++ library namespace.
unsigned int OptimalDataAlignment() const
Provides input and output data alignment for optimal performance.
Interface for one direction (encryption or decryption) of a block cipher.
Block cipher mode of operation default implementation.
SecBlock using AllocatorWithCleanup<byte, true> typedef.
Interface for retrieving values given their names.
Abstract base classes that provide a uniform interface to this library.
size_t DefaultKeyLength() const
Returns default key length.