mirror of
https://github.com/wheremyfoodat/Panda3DS.git
synced 2025-07-04 06:16:20 +12:00
Remove cryptoppwin submodule (#754)
Some checks failed
Android Build / x64 (release) (push) Has been cancelled
Android Build / arm64 (release) (push) Has been cancelled
HTTP Server Build / build (push) Has been cancelled
Hydra Core Build / Windows (push) Has been cancelled
Hydra Core Build / MacOS (push) Has been cancelled
Hydra Core Build / Linux (push) Has been cancelled
Hydra Core Build / Android-x64 (push) Has been cancelled
Hydra Core Build / ARM-Libretro (push) Has been cancelled
Linux AppImage Build / build (push) Has been cancelled
Linux Build / build (push) Has been cancelled
MacOS Build / MacOS-arm64 (push) Has been cancelled
MacOS Build / MacOS-x86_64 (push) Has been cancelled
MacOS Build / MacOS-Universal (push) Has been cancelled
Qt Build / Windows (push) Has been cancelled
Qt Build / MacOS-arm64 (push) Has been cancelled
Qt Build / MacOS-x86_64 (push) Has been cancelled
Qt Build / MacOS-Universal (push) Has been cancelled
Qt Build / Linux (push) Has been cancelled
Windows Build / build (push) Has been cancelled
iOS Simulator Build / build (push) Has been cancelled
Some checks failed
Android Build / x64 (release) (push) Has been cancelled
Android Build / arm64 (release) (push) Has been cancelled
HTTP Server Build / build (push) Has been cancelled
Hydra Core Build / Windows (push) Has been cancelled
Hydra Core Build / MacOS (push) Has been cancelled
Hydra Core Build / Linux (push) Has been cancelled
Hydra Core Build / Android-x64 (push) Has been cancelled
Hydra Core Build / ARM-Libretro (push) Has been cancelled
Linux AppImage Build / build (push) Has been cancelled
Linux Build / build (push) Has been cancelled
MacOS Build / MacOS-arm64 (push) Has been cancelled
MacOS Build / MacOS-x86_64 (push) Has been cancelled
MacOS Build / MacOS-Universal (push) Has been cancelled
Qt Build / Windows (push) Has been cancelled
Qt Build / MacOS-arm64 (push) Has been cancelled
Qt Build / MacOS-x86_64 (push) Has been cancelled
Qt Build / MacOS-Universal (push) Has been cancelled
Qt Build / Linux (push) Has been cancelled
Windows Build / build (push) Has been cancelled
iOS Simulator Build / build (push) Has been cancelled
This commit is contained in:
parent
5591606177
commit
6182d4cfe9
198 changed files with 51291 additions and 4 deletions
179
third_party/cryptoppwin/include/cryptopp/factory.h
vendored
Normal file
179
third_party/cryptoppwin/include/cryptopp/factory.h
vendored
Normal file
|
@ -0,0 +1,179 @@
|
|||
// factory.h - originally written and placed in the public domain by Wei Dai
|
||||
|
||||
/// \file factory.h
|
||||
/// \brief Classes and functions for registering and locating library objects
|
||||
|
||||
#ifndef CRYPTOPP_OBJFACT_H
|
||||
#define CRYPTOPP_OBJFACT_H
|
||||
|
||||
#include "cryptlib.h"
|
||||
#include "misc.h"
|
||||
#include "stdcpp.h"
|
||||
|
||||
NAMESPACE_BEGIN(CryptoPP)
|
||||
|
||||
/// \brief Object factory interface for registering objects
|
||||
/// \tparam AbstractClass Base class interface of the object
|
||||
template <class AbstractClass>
|
||||
class ObjectFactory
|
||||
{
|
||||
public:
|
||||
virtual ~ObjectFactory () {}
|
||||
virtual AbstractClass * CreateObject() const =0;
|
||||
};
|
||||
|
||||
/// \brief Object factory for registering objects
|
||||
/// \tparam AbstractClass Base class interface of the object
|
||||
/// \tparam ConcreteClass Class object
|
||||
template <class AbstractClass, class ConcreteClass>
|
||||
class DefaultObjectFactory : public ObjectFactory<AbstractClass>
|
||||
{
|
||||
public:
|
||||
AbstractClass * CreateObject() const
|
||||
{
|
||||
return new ConcreteClass;
|
||||
}
|
||||
};
|
||||
|
||||
/// \brief Object factory registry
|
||||
/// \tparam AbstractClass Base class interface of the object
|
||||
/// \tparam instance unique identifier
|
||||
template <class AbstractClass, int instance=0>
|
||||
class ObjectFactoryRegistry
|
||||
{
|
||||
public:
|
||||
class FactoryNotFound : public Exception
|
||||
{
|
||||
public:
|
||||
FactoryNotFound(const char *name) : Exception(OTHER_ERROR, std::string("ObjectFactoryRegistry: could not find factory for algorithm ") + name) {}
|
||||
};
|
||||
|
||||
~ObjectFactoryRegistry()
|
||||
{
|
||||
for (typename Map::iterator i = m_map.begin(); i != m_map.end(); ++i)
|
||||
{
|
||||
delete (ObjectFactory<AbstractClass> *)i->second;
|
||||
i->second = NULLPTR;
|
||||
}
|
||||
}
|
||||
|
||||
void RegisterFactory(const std::string &name, ObjectFactory<AbstractClass> *factory)
|
||||
{
|
||||
m_map[name] = factory;
|
||||
}
|
||||
|
||||
const ObjectFactory<AbstractClass> * GetFactory(const char *name) const
|
||||
{
|
||||
typename Map::const_iterator i = m_map.find(name);
|
||||
return i == m_map.end() ? NULLPTR : (ObjectFactory<AbstractClass> *)i->second;
|
||||
}
|
||||
|
||||
AbstractClass *CreateObject(const char *name) const
|
||||
{
|
||||
const ObjectFactory<AbstractClass> *factory = GetFactory(name);
|
||||
if (!factory)
|
||||
throw FactoryNotFound(name);
|
||||
return factory->CreateObject();
|
||||
}
|
||||
|
||||
// Return a vector containing the factory names. This is easier than returning an iterator.
|
||||
// from Andrew Pitonyak
|
||||
std::vector<std::string> GetFactoryNames() const
|
||||
{
|
||||
std::vector<std::string> names;
|
||||
typename Map::const_iterator iter;
|
||||
for (iter = m_map.begin(); iter != m_map.end(); ++iter)
|
||||
names.push_back(iter->first);
|
||||
return names;
|
||||
}
|
||||
|
||||
CRYPTOPP_NOINLINE static ObjectFactoryRegistry<AbstractClass, instance> & Registry(CRYPTOPP_NOINLINE_DOTDOTDOT);
|
||||
|
||||
private:
|
||||
// use void * instead of ObjectFactory<AbstractClass> * to save code size
|
||||
typedef std::map<std::string, void *> Map;
|
||||
Map m_map;
|
||||
};
|
||||
|
||||
template <class AbstractClass, int instance>
|
||||
ObjectFactoryRegistry<AbstractClass, instance> & ObjectFactoryRegistry<AbstractClass, instance>::Registry(CRYPTOPP_NOINLINE_DOTDOTDOT)
|
||||
{
|
||||
static ObjectFactoryRegistry<AbstractClass, instance> s_registry;
|
||||
return s_registry;
|
||||
}
|
||||
|
||||
/// \brief Object factory registry helper
|
||||
/// \tparam AbstractClass Base class interface of the object
|
||||
/// \tparam ConcreteClass Class object
|
||||
/// \tparam instance unique identifier
|
||||
template <class AbstractClass, class ConcreteClass, int instance = 0>
|
||||
struct RegisterDefaultFactoryFor
|
||||
{
|
||||
RegisterDefaultFactoryFor(const char *name=NULLPTR)
|
||||
{
|
||||
// BCB2006 workaround
|
||||
std::string n = name ? std::string(name) : std::string(ConcreteClass::StaticAlgorithmName());
|
||||
ObjectFactoryRegistry<AbstractClass, instance>::Registry().
|
||||
RegisterFactory(n, new DefaultObjectFactory<AbstractClass, ConcreteClass>);
|
||||
}
|
||||
};
|
||||
|
||||
/// \fn RegisterAsymmetricCipherDefaultFactories
|
||||
/// \brief Register asymmetric ciphers
|
||||
/// \tparam SchemeClass interface of the object under a scheme
|
||||
/// \details Schemes include asymmetric ciphers (registers <tt>SchemeClass::Encryptor</tt> and <tt>SchemeClass::Decryptor</tt>),
|
||||
/// signature schemes (registers <tt>SchemeClass::Signer</tt> and <tt>SchemeClass::Verifier</tt>),
|
||||
/// symmetric ciphers (registers <tt>SchemeClass::Encryptor</tt> and <tt>SchemeClass::Decryptor</tt>),
|
||||
/// authenticated symmetric ciphers (registers <tt>SchemeClass::Encryptor</tt> and <tt>SchemeClass::Decryptor</tt>), etc.
|
||||
template <class SchemeClass>
|
||||
void RegisterAsymmetricCipherDefaultFactories(const char *name=NULLPTR)
|
||||
{
|
||||
RegisterDefaultFactoryFor<PK_Encryptor, typename SchemeClass::Encryptor>((const char *)name);
|
||||
RegisterDefaultFactoryFor<PK_Decryptor, typename SchemeClass::Decryptor>((const char *)name);
|
||||
}
|
||||
|
||||
/// \fn RegisterSignatureSchemeDefaultFactories
|
||||
/// \brief Register signature schemes
|
||||
/// \tparam SchemeClass interface of the object under a scheme
|
||||
/// \details Schemes include asymmetric ciphers (registers <tt>SchemeClass::Encryptor</tt> and <tt>SchemeClass::Decryptor</tt>),
|
||||
/// signature schemes (registers <tt>SchemeClass::Signer</tt> and <tt>SchemeClass::Verifier</tt>),
|
||||
/// symmetric ciphers (registers <tt>SchemeClass::Encryptor</tt> and <tt>SchemeClass::Decryptor</tt>),
|
||||
/// authenticated symmetric ciphers (registers <tt>SchemeClass::Encryptor</tt> and <tt>SchemeClass::Decryptor</tt>), etc.
|
||||
template <class SchemeClass>
|
||||
void RegisterSignatureSchemeDefaultFactories(const char *name=NULLPTR)
|
||||
{
|
||||
RegisterDefaultFactoryFor<PK_Signer, typename SchemeClass::Signer>((const char *)name);
|
||||
RegisterDefaultFactoryFor<PK_Verifier, typename SchemeClass::Verifier>((const char *)name);
|
||||
}
|
||||
|
||||
/// \fn RegisterSymmetricCipherDefaultFactories
|
||||
/// \brief Register symmetric ciphers
|
||||
/// \tparam SchemeClass interface of the object under a scheme
|
||||
/// \details Schemes include asymmetric ciphers (registers <tt>SchemeClass::Encryptor</tt> and <tt>SchemeClass::Decryptor</tt>),
|
||||
/// signature schemes (registers <tt>SchemeClass::Signer</tt> and <tt>SchemeClass::Verifier</tt>),
|
||||
/// symmetric ciphers (registers <tt>SchemeClass::Encryptor</tt> and <tt>SchemeClass::Decryptor</tt>),
|
||||
/// authenticated symmetric ciphers (registers <tt>SchemeClass::Encryptor</tt> and <tt>SchemeClass::Decryptor</tt>), etc.
|
||||
template <class SchemeClass>
|
||||
void RegisterSymmetricCipherDefaultFactories(const char *name=NULLPTR)
|
||||
{
|
||||
RegisterDefaultFactoryFor<SymmetricCipher, typename SchemeClass::Encryption, ENCRYPTION>((const char *)name);
|
||||
RegisterDefaultFactoryFor<SymmetricCipher, typename SchemeClass::Decryption, DECRYPTION>((const char *)name);
|
||||
}
|
||||
|
||||
/// \fn RegisterAuthenticatedSymmetricCipherDefaultFactories
|
||||
/// \brief Register authenticated symmetric ciphers
|
||||
/// \tparam SchemeClass interface of the object under a scheme
|
||||
/// \details Schemes include asymmetric ciphers (registers <tt>SchemeClass::Encryptor</tt> and <tt>SchemeClass::Decryptor</tt>),
|
||||
/// signature schemes (registers <tt>SchemeClass::Signer</tt> and <tt>SchemeClass::Verifier</tt>),
|
||||
/// symmetric ciphers (registers <tt>SchemeClass::Encryptor</tt> and <tt>SchemeClass::Decryptor</tt>),
|
||||
/// authenticated symmetric ciphers (registers <tt>SchemeClass::Encryptor</tt> and <tt>SchemeClass::Decryptor</tt>), etc.
|
||||
template <class SchemeClass>
|
||||
void RegisterAuthenticatedSymmetricCipherDefaultFactories(const char *name=NULLPTR)
|
||||
{
|
||||
RegisterDefaultFactoryFor<AuthenticatedSymmetricCipher, typename SchemeClass::Encryption, ENCRYPTION>((const char *)name);
|
||||
RegisterDefaultFactoryFor<AuthenticatedSymmetricCipher, typename SchemeClass::Decryption, DECRYPTION>((const char *)name);
|
||||
}
|
||||
|
||||
NAMESPACE_END
|
||||
|
||||
#endif
|
Loading…
Add table
Add a link
Reference in a new issue