5 #ifndef CRYPTOPP_IMPORTS 10 #if defined(CRYPTOPP_DEBUG) 16 #if defined(CRYPTOPP_DEBUG) && !defined(CRYPTOPP_DOXYGEN_PROCESSING) 17 void Modes_TestInstantiations()
44 if (iterationCount > 1)
50 memcpy(m_temp, input+(iterationCount-1)*s, s);
51 if (iterationCount > 1)
62 unsigned int updateSize =
BlockSize()-m_feedbackSize;
78 m_feedbackSize = feedbackSize ? feedbackSize :
BlockSize();
92 if (iterationCount > 1)
111 m_counterArray[i] = (
byte) sum;
113 iterationCount >>= 8;
126 unsigned int inputIncrement = input ? s : 0;
128 while (iterationCount)
130 byte lsb = m_counterArray[s-1];
131 size_t blocks =
UnsignedMin(iterationCount, 256U-lsb);
133 if ((m_counterArray[s-1] = lsb + (
byte)blocks) == 0)
134 IncrementCounterBy256();
137 input += blocks*inputIncrement;
138 iterationCount -= blocks;
183 if (length > blockSize)
193 throw InvalidArgument(
"CBC_Encryption: message is too short for ciphertext stealing");
197 outString = m_stolenIV;
228 memcpy(m_temp, inString+length-blockSize, blockSize);
229 if (length > blockSize)
237 const byte *pn, *pn1;
255 xorbuf(m_temp, pn, length);
258 memcpy(outString, m_temp, length);
263 memcpy(m_temp, pn, length);
An invalid argument was detected.
void ProcessData(byte *outString, const byte *inString, size_t length)
Encrypt or decrypt an array of bytes.
void Iterate(byte *output, const byte *input, CipherDir dir, size_t iterationCount)
Iterate the cipher.
void memmove_s(void *dest, size_t sizeInBytes, const void *src, size_t count)
Bounds checking replacement for memmove()
void TransformRegister()
TODO.
void ProcessLastBlock(byte *outString, const byte *inString, size_t length)
Encrypt or decrypt the last block of data.
void swap(SecBlock< T, A > &b)
Swap contents with another SecBlock.
Utility functions for the Crypto++ library.
virtual void SetKey(const byte *key, size_t length, const NameValuePairs ¶ms=g_nullNameValuePairs)
Sets or reset the key of this object.
const byte * GetIVAndThrowIfInvalid(const NameValuePairs ¶ms, size_t &size)
Retrieves and validates the IV.
void IncrementCounterByOne(byte *inout, unsigned int size)
Performs an addition with carry on a block of bytes.
Class file for modes of operation.
#define NAMESPACE_BEGIN(x)
void CopyOrZero(void *dest, const void *src, size_t s)
CipherDir
Specifies a direction for a cipher to operate.
void SeekToIteration(lword iterationCount)
Seeks to a random position in the stream.
void memcpy_s(void *dest, size_t sizeInBytes, const void *src, size_t count)
Bounds checking replacement for memcpy()
size_type size() const
Provides the count of elements in the SecBlock.
virtual void ResizeBuffers()
void CipherResynchronize(byte *keystreamBuffer, const byte *iv, size_t length)
Resynchronize the cipher.
void New(size_type newSize)
Change size without preserving contents.
the cipher is performing encryption
void ProcessLastBlock(byte *outString, const byte *inString, size_t length)
Encrypt or decrypt the last block of data.
void OperateKeystream(KeystreamOperation operation, byte *output, const byte *input, size_t iterationCount)
Operates the keystream.
Block cipher mode of operation aggregate.
bool IsResynchronizable() const
Determines if the object can be resynchronized.
virtual void Resynchronize(const byte *iv, int ivLength=-1)
Resynchronize with an IV.
const T1 UnsignedMin(const T1 &a, const T2 &b)
Safe comparison of values that could be neagtive and incorrectly promoted.
void CipherResynchronize(const byte *iv, size_t length)
Resynchronize the cipher.
virtual void IncrementCounterBy256()
void SetFeedbackSize(unsigned int feedbackSize)
#define CRYPTOPP_ASSERT(exp)
void xorbuf(byte *buf, const byte *mask, size_t count)
Performs an XOR of a buffer with a mask.
Classes for DES, 2-key Triple-DES, 3-key Triple-DES and DESX.
void WriteKeystream(byte *keystreamBuffer, size_t iterationCount)
Generate the keystream.
AlignedSecByteBlock m_register
void * memcpy(void *a, const void *b, size_t c)
#define CRYPTOPP_UNUSED(x)
virtual void ResizeBuffers()
void UncheckedSetKey(const byte *key, unsigned int length, const NameValuePairs ¶ms)
Sets the key for this object without performing parameter validation.
KeystreamOperation
Keystream operation flags.
void ProcessData(byte *outString, const byte *inString, size_t length)
Encrypt or decrypt an array of bytes.
void CipherResynchronize(byte *keystreamBuffer, const byte *iv, size_t length)
Resynchronize the cipher.
unsigned int BlockSize() const
void ProcessData(byte *outString, const byte *inString, size_t length)
Encrypt or decrypt an array of bytes.
virtual void ResizeBuffers()
Interface for retrieving values given their names.