6 #ifndef CRYPTOPP_SIMPLE_H 7 #define CRYPTOPP_SIMPLE_H 11 #if CRYPTOPP_MSC_VERSION 12 # pragma warning(push) 13 # pragma warning(disable: 4127 4189) 25 template <class DERIVED, class BASE>
29 Clonable * Clone()
const {
return new DERIVED(*static_cast<const DERIVED *>(
this));}
37 template <
class BASE,
class ALGORITHM_INFO=BASE>
41 static std::string CRYPTOPP_API StaticAlgorithmName() {
return ALGORITHM_INFO::StaticAlgorithmName();}
42 std::string AlgorithmName()
const {
return ALGORITHM_INFO::StaticAlgorithmName();}
70 bool IsolatedFlush(
bool hardFlush,
bool blocking)
71 {CRYPTOPP_UNUSED(hardFlush); CRYPTOPP_UNUSED(blocking);
return false;}
81 bool Flush(
bool completeFlush,
int propagation=-1,
bool blocking=
true)
82 {
return ChannelFlush(
DEFAULT_CHANNEL, completeFlush, propagation, blocking);}
83 bool IsolatedFlush(
bool hardFlush,
bool blocking)
84 {CRYPTOPP_UNUSED(hardFlush); CRYPTOPP_UNUSED(blocking); assert(
false);
return false;}
85 bool ChannelFlush(
const std::string &channel,
bool hardFlush,
int propagation=-1,
bool blocking=
true)
87 if (hardFlush && !InputBufferIsEmpty())
88 throw CannotFlush(
"Unflushable<T>: this object has buffered input that cannot be flushed");
92 return attached && propagation ? attached->
ChannelFlush(channel, hardFlush, propagation-1, blocking) :
false;
97 virtual bool InputBufferIsEmpty()
const {
return false;}
122 size_t Put2(
const byte *inString,
size_t length,
int messageEnd,
bool blocking)
123 {CRYPTOPP_UNUSED(inString); CRYPTOPP_UNUSED(length); CRYPTOPP_UNUSED(messageEnd); CRYPTOPP_UNUSED(blocking);
throw InputRejected();}
128 bool IsolatedFlush(
bool hardFlush,
bool blocking)
129 {CRYPTOPP_UNUSED(hardFlush); CRYPTOPP_UNUSED(blocking);
return false;}
130 bool IsolatedMessageSeriesEnd(
bool blocking)
131 {CRYPTOPP_UNUSED(blocking);
throw InputRejected();}
132 size_t ChannelPut2(
const std::string &channel,
const byte *inString,
size_t length,
int messageEnd,
bool blocking)
133 {CRYPTOPP_UNUSED(channel); CRYPTOPP_UNUSED(inString); CRYPTOPP_UNUSED(length); CRYPTOPP_UNUSED(messageEnd); CRYPTOPP_UNUSED(blocking);
throw InputRejected();}
134 bool ChannelMessageSeriesEnd(
const std::string& channel,
int messageEnd,
bool blocking)
135 {CRYPTOPP_UNUSED(channel); CRYPTOPP_UNUSED(messageEnd); CRYPTOPP_UNUSED(blocking);
throw InputRejected();}
149 virtual bool Flush(
bool hardFlush,
int propagation=-1,
bool blocking=
true) =0;
153 bool IsolatedFlush(
bool hardFlush,
bool blocking)
154 {CRYPTOPP_UNUSED(hardFlush); CRYPTOPP_UNUSED(blocking); assert(
false);
return false;}
169 {CRYPTOPP_UNUSED(parameters); assert(
false);}
180 bool Flush(
bool hardFlush,
int propagation=-1,
bool blocking=
true)
181 {
return this->ChannelFlush(
DEFAULT_CHANNEL, hardFlush, propagation, blocking);}
182 bool MessageSeriesEnd(
int propagation=-1,
bool blocking=
true)
183 {
return this->ChannelMessageSeriesEnd(
DEFAULT_CHANNEL, propagation, blocking);}
184 byte * CreatePutSpace(
size_t &size)
186 size_t Put2(
const byte *inString,
size_t length,
int messageEnd,
bool blocking)
187 {
return this->ChannelPut2(
DEFAULT_CHANNEL, inString, length, messageEnd, blocking);}
188 size_t PutModifiable2(byte *inString,
size_t length,
int messageEnd,
bool blocking)
189 {
return this->ChannelPutModifiable2(
DEFAULT_CHANNEL, inString, length, messageEnd, blocking);}
193 byte * ChannelCreatePutSpace(
const std::string &channel,
size_t &size)
194 {CRYPTOPP_UNUSED(channel); size = 0;
return NULL;}
195 bool ChannelPutModifiable(
const std::string &channel, byte *inString,
size_t length)
196 {this->ChannelPut(channel, inString, length);
return false;}
198 virtual size_t ChannelPut2(
const std::string &channel,
const byte *begin,
size_t length,
int messageEnd,
bool blocking) =0;
199 size_t ChannelPutModifiable2(
const std::string &channel, byte *begin,
size_t length,
int messageEnd,
bool blocking)
200 {
return ChannelPut2(channel, begin, length, messageEnd, blocking);}
202 virtual bool ChannelFlush(
const std::string &channel,
bool hardFlush,
int propagation=-1,
bool blocking=
true) =0;
213 AutoSignaling(
int propagation=-1) : m_autoSignalPropagation(propagation) {}
215 void SetAutoSignalPropagation(
int propagation)
216 {m_autoSignalPropagation = propagation;}
217 int GetAutoSignalPropagation()
const 218 {
return m_autoSignalPropagation;}
221 int m_autoSignalPropagation;
228 class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE
Store :
public AutoSignaling<InputRejecting<BufferedTransformation> >
231 Store() : m_messageEnd(
false) {}
235 m_messageEnd =
false;
236 StoreInitialize(parameters);
240 bool GetNextMessage();
244 virtual void StoreInitialize(
const NameValuePairs ¶meters) =0;
263 {CRYPTOPP_UNUSED(target); CRYPTOPP_UNUSED(transferBytes); CRYPTOPP_UNUSED(channel); CRYPTOPP_UNUSED(blocking); transferBytes = 0;
return 0;}
265 {CRYPTOPP_UNUSED(target); CRYPTOPP_UNUSED(begin); CRYPTOPP_UNUSED(end); CRYPTOPP_UNUSED(channel); CRYPTOPP_UNUSED(blocking);
return 0;}
278 {CRYPTOPP_UNUSED(params);}
279 size_t Put2(
const byte *inString,
size_t length,
int messageEnd,
bool blocking)
280 {CRYPTOPP_UNUSED(inString); CRYPTOPP_UNUSED(length); CRYPTOPP_UNUSED(messageEnd); CRYPTOPP_UNUSED(blocking);
return 0;}
285 #if CRYPTOPP_MSC_VERSION 286 # pragma warning(pop) An invalid argument was detected.
Utility functions for the Crypto++ library.
Base class for identifying alogorithm.
Exception thrown when an invalid key length is encountered.
Flush(true) was called but it can't completely flush its buffers.
Abstract base classes that provide a uniform interface to this library.
void IsolatedInitialize(const NameValuePairs ¶ms)
Initialize or reinitialize this object, without signal propagation.
Library configuration file.
std::string AlgorithmName() const
Provides the name of this algorithm.
Acts as a Source for pre-existing, static data.
Interface for cloning objects.
Provides interface for custom flush signals.
void IsolatedInitialize(const NameValuePairs ¶meters)
Initialize or reinitialize this object, without signal propagation.
A method was called which was not implemented.
const std::string DEFAULT_CHANNEL
Default channel for BufferedTransformation.
Exception thrown when an invalid number of rounds is encountered.
size_t TransferTo2(BufferedTransformation &target, lword &transferBytes, const std::string &channel=DEFAULT_CHANNEL, bool blocking=true)
Transfer bytes from this object to another BufferedTransformation.
const NameValuePairs & g_nullNameValuePairs
An empty set of name-value pairs.
size_t CopyRangeTo2(BufferedTransformation &target, lword &begin, lword end=LWORD_MAX, const std::string &channel=DEFAULT_CHANNEL, bool blocking=true) const
Copy bytes from this object to another BufferedTransformation.
Base class for unflushable filters.
size_t Put2(const byte *inString, size_t length, int messageEnd, bool blocking)
Input multiple bytes for processing.
Implementation of BufferedTransformation's attachment interface.
Provides auto signaling support.
std::string IntToString(T value, unsigned int base=10)
Converts a value to a string.
Acts as an input discarding Filter or Sink.
Crypto++ library namespace.
unsigned int NumberOfMessages() const
Provides the number of meesages processed by this object.
Provides multiple channels support for custom flush signal processing.
Provides interface for initialization of derived filters.
Base class for bufferless filters.
Interface for retrieving values given their names.
Base class for identifying alogorithm.