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) 24 template <
class DERIVED,
class BASE>
28 Clonable * Clone()
const {
return new DERIVED(*static_cast<const DERIVED *>(
this));}
35 template <
class BASE,
class ALGORITHM_INFO=BASE>
43 static std::string CRYPTOPP_API StaticAlgorithmName() {
return ALGORITHM_INFO::StaticAlgorithmName();}
48 std::string
AlgorithmName()
const {
return ALGORITHM_INFO::StaticAlgorithmName();}
94 bool IsolatedFlush(
bool hardFlush,
bool blocking)
95 {CRYPTOPP_UNUSED(hardFlush); CRYPTOPP_UNUSED(blocking);
return false;}
104 bool Flush(
bool completeFlush,
int propagation=-1,
bool blocking=
true)
105 {
return ChannelFlush(
DEFAULT_CHANNEL, completeFlush, propagation, blocking);}
106 bool IsolatedFlush(
bool hardFlush,
bool blocking)
107 {CRYPTOPP_UNUSED(hardFlush); CRYPTOPP_UNUSED(blocking);
CRYPTOPP_ASSERT(
false);
return false;}
108 bool ChannelFlush(
const std::string &channel,
bool hardFlush,
int propagation=-1,
bool blocking=
true)
110 if (hardFlush && !InputBufferIsEmpty())
111 throw CannotFlush(
"Unflushable<T>: this object has buffered input that cannot be flushed");
115 return attached && propagation ? attached->
ChannelFlush(channel, hardFlush, propagation-1, blocking) :
false;
120 virtual bool InputBufferIsEmpty()
const {
return false;}
144 size_t Put2(
const byte *inString,
size_t length,
int messageEnd,
bool blocking)
145 {CRYPTOPP_UNUSED(inString); CRYPTOPP_UNUSED(length); CRYPTOPP_UNUSED(messageEnd); CRYPTOPP_UNUSED(blocking);
throw InputRejected();}
150 bool IsolatedFlush(
bool hardFlush,
bool blocking)
151 {CRYPTOPP_UNUSED(hardFlush); CRYPTOPP_UNUSED(blocking);
return false;}
152 bool IsolatedMessageSeriesEnd(
bool blocking)
153 {CRYPTOPP_UNUSED(blocking);
throw InputRejected();}
154 size_t ChannelPut2(
const std::string &channel,
const byte *inString,
size_t length,
int messageEnd,
bool blocking)
155 {CRYPTOPP_UNUSED(channel); CRYPTOPP_UNUSED(inString); CRYPTOPP_UNUSED(length); CRYPTOPP_UNUSED(messageEnd); CRYPTOPP_UNUSED(blocking);
throw InputRejected();}
156 bool ChannelMessageSeriesEnd(
const std::string& channel,
int messageEnd,
bool blocking)
157 {CRYPTOPP_UNUSED(channel); CRYPTOPP_UNUSED(messageEnd); CRYPTOPP_UNUSED(blocking);
throw InputRejected();}
184 virtual bool Flush(
bool hardFlush,
int propagation=-1,
bool blocking=
true) =0;
189 bool IsolatedFlush(
bool hardFlush,
bool blocking)
190 {CRYPTOPP_UNUSED(hardFlush); CRYPTOPP_UNUSED(blocking);
CRYPTOPP_ASSERT(
false);
return false;}
221 bool Flush(
bool hardFlush,
int propagation=-1,
bool blocking=
true)
222 {
return this->ChannelFlush(
DEFAULT_CHANNEL, hardFlush, propagation, blocking);}
233 {
return this->ChannelMessageSeriesEnd(
DEFAULT_CHANNEL, propagation, blocking);}
253 size_t Put2(
const byte *inString,
size_t length,
int messageEnd,
bool blocking)
254 {
return this->ChannelPut2(
DEFAULT_CHANNEL, inString, length, messageEnd, blocking);}
262 size_t PutModifiable2(byte *inString,
size_t length,
int messageEnd,
bool blocking)
263 {
return this->ChannelPutModifiable2(
DEFAULT_CHANNEL, inString, length, messageEnd, blocking);}
267 byte * ChannelCreatePutSpace(
const std::string &channel,
size_t &size)
268 {CRYPTOPP_UNUSED(channel); size = 0;
return NULLPTR;}
269 bool ChannelPutModifiable(
const std::string &channel, byte *inString,
size_t length)
270 {this->ChannelPut(channel, inString, length);
return false;}
272 virtual size_t ChannelPut2(
const std::string &channel,
const byte *begin,
size_t length,
int messageEnd,
bool blocking) =0;
273 size_t ChannelPutModifiable2(
const std::string &channel, byte *begin,
size_t length,
int messageEnd,
bool blocking)
274 {
return ChannelPut2(channel, begin, length, messageEnd, blocking);}
276 virtual bool ChannelFlush(
const std::string &channel,
bool hardFlush,
int propagation=-1,
bool blocking=
true) =0;
289 void SetAutoSignalPropagation(
int propagation)
290 {m_autoSignalPropagation = propagation;}
291 int GetAutoSignalPropagation()
const 292 {
return m_autoSignalPropagation;}
295 int m_autoSignalPropagation;
299 class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE
Store :
public AutoSignaling<InputRejecting<BufferedTransformation> >
307 m_messageEnd =
false;
308 StoreInitialize(parameters);
312 bool GetNextMessage();
316 virtual void StoreInitialize(
const NameValuePairs ¶meters) =0;
334 {CRYPTOPP_UNUSED(target); CRYPTOPP_UNUSED(transferBytes); CRYPTOPP_UNUSED(channel); CRYPTOPP_UNUSED(blocking); transferBytes = 0;
return 0;}
336 {CRYPTOPP_UNUSED(target); CRYPTOPP_UNUSED(begin); CRYPTOPP_UNUSED(end); CRYPTOPP_UNUSED(channel); CRYPTOPP_UNUSED(blocking);
return 0;}
347 {CRYPTOPP_UNUSED(params);}
348 size_t Put2(
const byte *inString,
size_t length,
int messageEnd,
bool blocking)
349 {CRYPTOPP_UNUSED(inString); CRYPTOPP_UNUSED(length); CRYPTOPP_UNUSED(messageEnd); CRYPTOPP_UNUSED(blocking);
return 0;}
354 #if CRYPTOPP_MSC_VERSION 355 # pragma warning(pop) size_t Put2(const byte *inString, size_t length, int messageEnd, bool blocking)
Input multiple bytes for processing.
An invalid argument was detected.
Utility functions for the Crypto++ library.
Store()
Construct a Store.
Base class for identifying alogorithm.
Exception thrown when an invalid key length is encountered.
std::string AlgorithmName() const
The algorithm name.
unsigned int NumberOfMessages() const
Provides the number of meesages processed by this object.
Flush(true) was called but it can't completely flush its buffers.
Abstract base classes that provide a uniform interface to this library.
bool Flush(bool hardFlush, int propagation=-1, bool blocking=true)
Flush buffered input and/or output, with signal propagation.
void IsolatedInitialize(const NameValuePairs ¶ms)
Initialize or reinitialize this object, without signal propagation.
Library configuration file.
Acts as a Source for pre-existing, static data.
Interface for cloning objects.
Interface for custom flush signals propagation.
Exception thrown when an invalid salt length is encountered.
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.
Exception thrown when an invalid block size is encountered.
void IsolatedInitialize(const NameValuePairs ¶meters)
Initialize or reinitialize this object, without signal propagation.
Exception thrown when an invalid personalization string length is encountered.
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.
#define CRYPTOPP_ASSERT(exp)
Debugging and diagnostic assertion.
size_t PutModifiable2(byte *inString, size_t length, int messageEnd, bool blocking)
Input multiple bytes that may be modified by callee.
const NameValuePairs g_nullNameValuePairs
An empty set of name-value pairs.
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.
byte * CreatePutSpace(size_t &size)
Request space which can be written into by the caller.
bool MessageSeriesEnd(int propagation=-1, bool blocking=true)
Marks the end of a series of messages, with signal propagation.
Acts as an input discarding Filter or Sink.
Crypto++ library namespace.
std::string AlgorithmName() const
Provides the name of this algorithm.
Multiple channels support for custom signal processing.
Interface for custom flush signals.
AutoSignaling(int propagation=-1)
Construct an AutoSignaling.
Base class for bufferless filters.
Interface for retrieving values given their names.