summaryrefslogtreecommitdiffstats
path: root/cryptopp562/channels.h
diff options
context:
space:
mode:
authorMalfurious <m@lfurio.us>2024-10-24 06:44:24 -0400
committerMalfurious <m@lfurio.us>2024-10-24 06:44:24 -0400
commit512aa4c77b3dc0d72db713a9215ff65a98a99ec3 (patch)
tree6db82e0109dc987b5b021f81d4e8a0926eb75ff7 /cryptopp562/channels.h
parent428471d39fb8c205a9fad899c88c30a2cb7df685 (diff)
parent10affea371406c0ae4c080e5a19390a8e9bd154b (diff)
downloadcompass-512aa4c77b3dc0d72db713a9215ff65a98a99ec3.tar.gz
compass-512aa4c77b3dc0d72db713a9215ff65a98a99ec3.zip
Merge branch 'mbedtls'
Replace Crypto++ 5.6.2 with Mbed TLS 3.6.0 Newer compilers are starting to show the age of the crypto library we've been using, as it is sometimes a pain to recompile compass lately. So, the tracked version of Crypto++ was at least due for an upgrade. However, I plan to soon begin reimplementing compass in C. So, I'm taking this opportunity to first just migrate the cryptography library to a newer C alternative. This branch does so, and integrates its use into the current C++ version of compass. * mbedtls: Remove unnecessary exception handler catch block Refactor random password generation to use mbedtls entropy source Refactor SHA256 function to use mbedtls Refactor AES functions to use mbedtls Add Mbedtls library Remove Crypto++ library
Diffstat (limited to 'cryptopp562/channels.h')
-rw-r--r--cryptopp562/channels.h123
1 files changed, 0 insertions, 123 deletions
diff --git a/cryptopp562/channels.h b/cryptopp562/channels.h
deleted file mode 100644
index 8374156..0000000
--- a/cryptopp562/channels.h
+++ /dev/null
@@ -1,123 +0,0 @@
-#ifndef CRYPTOPP_CHANNELS_H
-#define CRYPTOPP_CHANNELS_H
-
-#include "simple.h"
-#include "smartptr.h"
-#include <map>
-#include <list>
-
-NAMESPACE_BEGIN(CryptoPP)
-
-#if 0
-//! Route input on default channel to different and/or multiple channels based on message sequence number
-class MessageSwitch : public Sink
-{
-public:
- void AddDefaultRoute(BufferedTransformation &destination, const std::string &channel);
- void AddRoute(unsigned int begin, unsigned int end, BufferedTransformation &destination, const std::string &channel);
-
- void Put(byte inByte);
- void Put(const byte *inString, unsigned int length);
-
- void Flush(bool completeFlush, int propagation=-1);
- void MessageEnd(int propagation=-1);
- void PutMessageEnd(const byte *inString, unsigned int length, int propagation=-1);
- void MessageSeriesEnd(int propagation=-1);
-
-private:
- typedef std::pair<BufferedTransformation *, std::string> Route;
- struct RangeRoute
- {
- RangeRoute(unsigned int begin, unsigned int end, const Route &route)
- : begin(begin), end(end), route(route) {}
- bool operator<(const RangeRoute &rhs) const {return begin < rhs.begin;}
- unsigned int begin, end;
- Route route;
- };
-
- typedef std::list<RangeRoute> RouteList;
- typedef std::list<Route> DefaultRouteList;
-
- RouteList m_routes;
- DefaultRouteList m_defaultRoutes;
- unsigned int m_nCurrentMessage;
-};
-#endif
-
-class ChannelSwitchTypedefs
-{
-public:
- typedef std::pair<BufferedTransformation *, std::string> Route;
- typedef std::multimap<std::string, Route> RouteMap;
-
- typedef std::pair<BufferedTransformation *, value_ptr<std::string> > DefaultRoute;
- typedef std::list<DefaultRoute> DefaultRouteList;
-
- // SunCC workaround: can't use const_iterator here
- typedef RouteMap::iterator MapIterator;
- typedef DefaultRouteList::iterator ListIterator;
-};
-
-class ChannelSwitch;
-
-class ChannelRouteIterator : public ChannelSwitchTypedefs
-{
-public:
- ChannelSwitch& m_cs;
- std::string m_channel;
- bool m_useDefault;
- MapIterator m_itMapCurrent, m_itMapEnd;
- ListIterator m_itListCurrent, m_itListEnd;
-
- ChannelRouteIterator(ChannelSwitch &cs) : m_cs(cs) {}
- void Reset(const std::string &channel);
- bool End() const;
- void Next();
- BufferedTransformation & Destination();
- const std::string & Channel();
-};
-
-//! Route input to different and/or multiple channels based on channel ID
-class CRYPTOPP_DLL ChannelSwitch : public Multichannel<Sink>, public ChannelSwitchTypedefs
-{
-public:
- ChannelSwitch() : m_it(*this), m_blocked(false) {}
- ChannelSwitch(BufferedTransformation &destination) : m_it(*this), m_blocked(false)
- {
- AddDefaultRoute(destination);
- }
- ChannelSwitch(BufferedTransformation &destination, const std::string &outChannel) : m_it(*this), m_blocked(false)
- {
- AddDefaultRoute(destination, outChannel);
- }
-
- void IsolatedInitialize(const NameValuePairs &parameters=g_nullNameValuePairs);
-
- size_t ChannelPut2(const std::string &channel, const byte *begin, size_t length, int messageEnd, bool blocking);
- size_t ChannelPutModifiable2(const std::string &channel, byte *begin, size_t length, int messageEnd, bool blocking);
-
- bool ChannelFlush(const std::string &channel, bool completeFlush, int propagation=-1, bool blocking=true);
- bool ChannelMessageSeriesEnd(const std::string &channel, int propagation=-1, bool blocking=true);
-
- byte * ChannelCreatePutSpace(const std::string &channel, size_t &size);
-
- void AddDefaultRoute(BufferedTransformation &destination);
- void RemoveDefaultRoute(BufferedTransformation &destination);
- void AddDefaultRoute(BufferedTransformation &destination, const std::string &outChannel);
- void RemoveDefaultRoute(BufferedTransformation &destination, const std::string &outChannel);
- void AddRoute(const std::string &inChannel, BufferedTransformation &destination, const std::string &outChannel);
- void RemoveRoute(const std::string &inChannel, BufferedTransformation &destination, const std::string &outChannel);
-
-private:
- RouteMap m_routeMap;
- DefaultRouteList m_defaultRoutes;
-
- ChannelRouteIterator m_it;
- bool m_blocked;
-
- friend class ChannelRouteIterator;
-};
-
-NAMESPACE_END
-
-#endif