aboutsummaryrefslogtreecommitdiffstats
path: root/src/libstate/engine/def_engine
diff options
context:
space:
mode:
authorlloyd <[email protected]>2008-11-11 19:20:32 +0000
committerlloyd <[email protected]>2008-11-11 19:20:32 +0000
commit2af6c4499013911d7b01ce3ce1acc5aa8fef15ab (patch)
tree894612d39bbcd50187334c1bedf197c4475c7393 /src/libstate/engine/def_engine
parent25d7b7aa9e9896df45f12fa59db4c44411bc21f0 (diff)
Move most of the remaining libstate code to pk_engine.cpp, move engines
back to the toplevel since most othe dependencies have been removed now (except get_cipher which still needs changes)
Diffstat (limited to 'src/libstate/engine/def_engine')
-rw-r--r--src/libstate/engine/def_engine/def_eng.h79
-rw-r--r--src/libstate/engine/def_engine/def_mode.cpp194
-rw-r--r--src/libstate/engine/def_engine/def_pk_ops.cpp119
-rw-r--r--src/libstate/engine/def_engine/def_powm.cpp22
-rw-r--r--src/libstate/engine/def_engine/info.txt16
-rw-r--r--src/libstate/engine/def_engine/lookup_block.cpp262
-rw-r--r--src/libstate/engine/def_engine/lookup_hash.cpp188
-rw-r--r--src/libstate/engine/def_engine/lookup_mac.cpp68
-rw-r--r--src/libstate/engine/def_engine/lookup_stream.cpp59
9 files changed, 0 insertions, 1007 deletions
diff --git a/src/libstate/engine/def_engine/def_eng.h b/src/libstate/engine/def_engine/def_eng.h
deleted file mode 100644
index 0c95c08c5..000000000
--- a/src/libstate/engine/def_engine/def_eng.h
+++ /dev/null
@@ -1,79 +0,0 @@
-/*************************************************
-* Default Engine Header File *
-* (C) 1999-2007 Jack Lloyd *
-*************************************************/
-
-#ifndef BOTAN_DEFAULT_ENGINE_H__
-#define BOTAN_DEFAULT_ENGINE_H__
-
-#include <botan/engine.h>
-
-namespace Botan {
-
-/*************************************************
-* Default Engine *
-*************************************************/
-class BOTAN_DLL Default_Engine : public Engine
- {
- public:
- std::string provider_name() const { return "core"; }
-
-#if defined(BOTAN_HAS_IF_PUBLIC_KEY_FAMILY)
- IF_Operation* if_op(const BigInt&, const BigInt&, const BigInt&,
- const BigInt&, const BigInt&, const BigInt&,
- const BigInt&, const BigInt&) const;
-#endif
-
-#if defined(BOTAN_HAS_DSA)
- DSA_Operation* dsa_op(const DL_Group&, const BigInt&,
- const BigInt&) const;
-#endif
-
-#if defined(BOTAN_HAS_NYBERG_RUEPPEL)
- NR_Operation* nr_op(const DL_Group&, const BigInt&, const BigInt&) const;
-#endif
-
-#if defined(BOTAN_HAS_ELGAMAL)
- ELG_Operation* elg_op(const DL_Group&, const BigInt&,
- const BigInt&) const;
-#endif
-
-#if defined(BOTAN_HAS_DIFFIE_HELLMAN)
- DH_Operation* dh_op(const DL_Group&, const BigInt&) const;
-#endif
-
-#if defined(BOTAN_HAS_ECDSA)
- virtual ECDSA_Operation* ecdsa_op(const EC_Domain_Params&,
- const BigInt&,
- const PointGFp&) const;
-#endif
-
-#if defined(BOTAN_HAS_ECKAEG)
- virtual ECKAEG_Operation* eckaeg_op(const EC_Domain_Params&,
- const BigInt&,
- const PointGFp&) const;
-#endif
-
- Modular_Exponentiator* mod_exp(const BigInt&,
- Power_Mod::Usage_Hints) const;
-
- virtual bool can_add_algorithms() { return true; }
-
- Keyed_Filter* get_cipher(const std::string&, Cipher_Dir);
- private:
- BlockCipher* find_block_cipher(const SCAN_Name&,
- Algorithm_Factory&) const;
-
- StreamCipher* find_stream_cipher(const SCAN_Name&,
- Algorithm_Factory&) const;
-
- HashFunction* find_hash(const SCAN_Name& reqeust,
- Algorithm_Factory&) const;
-
- MessageAuthenticationCode* find_mac(const SCAN_Name& reqeust,
- Algorithm_Factory&) const;
- };
-
-}
-
-#endif
diff --git a/src/libstate/engine/def_engine/def_mode.cpp b/src/libstate/engine/def_engine/def_mode.cpp
deleted file mode 100644
index 7933fbb84..000000000
--- a/src/libstate/engine/def_engine/def_mode.cpp
+++ /dev/null
@@ -1,194 +0,0 @@
-/*************************************************
-* Default Engine Source File *
-* (C) 1999-2007 Jack Lloyd *
-*************************************************/
-
-#include <botan/def_eng.h>
-#include <botan/parsing.h>
-#include <botan/filters.h>
-#include <botan/libstate.h>
-#include <botan/mode_pad.h>
-#include <memory>
-
-#if defined(BOTAN_HAS_ECB)
- #include <botan/ecb.h>
-#endif
-
-#if defined(BOTAN_HAS_CBC)
- #include <botan/cbc.h>
-#endif
-
-#if defined(BOTAN_HAS_CTS)
- #include <botan/cts.h>
-#endif
-
-#if defined(BOTAN_HAS_CFB)
- #include <botan/cfb.h>
-#endif
-
-#if defined(BOTAN_HAS_OFB)
- #include <botan/ofb.h>
-#endif
-
-#if defined(BOTAN_HAS_CTR)
- #include <botan/ctr.h>
-#endif
-
-#if defined(BOTAN_HAS_EAX)
- #include <botan/eax.h>
-#endif
-
-namespace Botan {
-
-namespace {
-
-/**
-* Get a block cipher padding method by name
-*/
-BlockCipherModePaddingMethod* get_bc_pad(const std::string& algo_spec)
- {
- SCAN_Name request(algo_spec);
-
-#if defined(BOTAN_HAS_CIPHER_MODE_PADDING)
- if(request.algo_name() == "PKCS7")
- return new PKCS7_Padding;
-
- if(request.algo_name() == "OneAndZeros")
- return new OneAndZeros_Padding;
-
- if(request.algo_name() == "X9.23")
- return new ANSI_X923_Padding;
-
- if(request.algo_name() == "NoPadding")
- return new Null_Padding;
-#endif
-
- throw Algorithm_Not_Found(algo_spec);
- }
-
-}
-
-/*************************************************
-* Get a cipher object *
-*************************************************/
-Keyed_Filter* Default_Engine::get_cipher(const std::string& algo_spec,
- Cipher_Dir direction)
- {
- std::vector<std::string> algo_parts = split_on(algo_spec, '/');
- if(algo_parts.empty())
- throw Invalid_Algorithm_Name(algo_spec);
-
- const std::string cipher_name = algo_parts[0];
-
- Algorithm_Factory& af = global_state().algo_factory();
-
- // check if it is a stream cipher first (easy case)
- const StreamCipher* stream_cipher = af.prototype_stream_cipher(cipher_name);
- if(stream_cipher)
- return new StreamCipher_Filter(stream_cipher->clone());
-
- const BlockCipher* block_cipher = af.prototype_block_cipher(cipher_name);
- if(!block_cipher)
- return 0;
-
- if(algo_parts.size() != 2 && algo_parts.size() != 3)
- return 0;
-
- std::string mode = algo_parts[1];
- u32bit bits = 0;
-
- if(mode.find("CFB") != std::string::npos ||
- mode.find("EAX") != std::string::npos)
- {
- std::vector<std::string> algo_info = parse_algorithm_name(mode);
- mode = algo_info[0];
- if(algo_info.size() == 1)
- bits = 8*block_cipher->BLOCK_SIZE;
- else if(algo_info.size() == 2)
- bits = to_u32bit(algo_info[1]);
- else
- throw Invalid_Algorithm_Name(algo_spec);
- }
-
- std::string padding;
- if(algo_parts.size() == 3)
- padding = algo_parts[2];
- else
- padding = (mode == "CBC") ? "PKCS7" : "NoPadding";
-
- if(mode == "ECB" && padding == "CTS")
- return 0;
- else if((mode != "CBC" && mode != "ECB") && padding != "NoPadding")
- throw Invalid_Algorithm_Name(algo_spec);
-
-#if defined(BOTAN_HAS_OFB)
- if(mode == "OFB")
- return new OFB(block_cipher->clone());
-#endif
-
-#if defined(BOTAN_HAS_CTR)
- if(mode == "CTR-BE")
- return new CTR_BE(block_cipher->clone());
-#endif
-
-#if defined(BOTAN_HAS_ECB)
- if(mode == "ECB")
- {
- if(direction == ENCRYPTION)
- return new ECB_Encryption(block_cipher->clone(), get_bc_pad(padding));
- else
- return new ECB_Decryption(block_cipher->clone(), get_bc_pad(padding));
- }
-#endif
-
-#if defined(BOTAN_HAS_CFB)
- if(mode == "CFB")
- {
- if(direction == ENCRYPTION)
- return new CFB_Encryption(block_cipher->clone(), bits);
- else
- return new CFB_Decryption(block_cipher->clone(), bits);
- }
-#endif
-
- if(mode == "CBC")
- {
- if(padding == "CTS")
- {
-#if defined(BOTAN_HAS_CTS)
- if(direction == ENCRYPTION)
- return new CTS_Encryption(block_cipher->clone());
- else
- return new CTS_Decryption(block_cipher->clone());
-#else
- return 0;
-#endif
- }
-
-#if defined(BOTAN_HAS_CBC)
- if(direction == ENCRYPTION)
- return new CBC_Encryption(block_cipher->clone(),
- get_bc_pad(padding));
- else
- return new CBC_Decryption(block_cipher->clone(),
- get_bc_pad(padding));
-#else
- return 0;
-#endif
- }
-
-#if defined(BOTAN_HAS_EAX)
- if(mode == "EAX")
- {
- if(direction == ENCRYPTION)
- return new EAX_Encryption(block_cipher->clone(), bits);
- else
- return new EAX_Decryption(block_cipher->clone(), bits);
- }
-#endif
-
- throw Algorithm_Not_Found("get_mode: " + cipher_name + "/" +
- mode + "/" + padding);
- }
-
-}
diff --git a/src/libstate/engine/def_engine/def_pk_ops.cpp b/src/libstate/engine/def_engine/def_pk_ops.cpp
deleted file mode 100644
index 5e29e110f..000000000
--- a/src/libstate/engine/def_engine/def_pk_ops.cpp
+++ /dev/null
@@ -1,119 +0,0 @@
-/*************************************************
-* PK Operations Source File *
-* (C) 1999-2007 Jack Lloyd *
-*************************************************/
-
-#include <botan/def_eng.h>
-
-#if defined(BOTAN_HAS_IF_PUBLIC_KEY_FAMILY)
- #include <botan/if_op.h>
-#endif
-
-#if defined(BOTAN_HAS_DSA)
- #include <botan/dsa_op.h>
-#endif
-
-#if defined(BOTAN_HAS_NYBERG_RUEPPEL)
- #include <botan/nr_op.h>
-#endif
-
-#if defined(BOTAN_HAS_ELGAMAL)
- #include <botan/elg_op.h>
-#endif
-
-#if defined(BOTAN_HAS_DIFFIE_HELLMAN)
- #include <botan/dh_op.h>
-#endif
-
-#if defined(BOTAN_HAS_ECDSA)
- #include <botan/ecdsa_op.h>
-#endif
-
-#if defined(BOTAN_HAS_ECKAEG)
- #include <botan/eckaeg_op.h>
-#endif
-
-namespace Botan {
-
-#if defined(BOTAN_HAS_IF_PUBLIC_KEY_FAMILY)
-/*************************************************
-* Acquire an IF op *
-*************************************************/
-IF_Operation* Default_Engine::if_op(const BigInt& e, const BigInt& n,
- const BigInt& d, const BigInt& p,
- const BigInt& q, const BigInt& d1,
- const BigInt& d2, const BigInt& c) const
- {
- return new Default_IF_Op(e, n, d, p, q, d1, d2, c);
- }
-#endif
-
-#if defined(BOTAN_HAS_DSA)
-/*************************************************
-* Acquire a DSA op *
-*************************************************/
-DSA_Operation* Default_Engine::dsa_op(const DL_Group& group, const BigInt& y,
- const BigInt& x) const
- {
- return new Default_DSA_Op(group, y, x);
- }
-#endif
-
-#if defined(BOTAN_HAS_NYBERG_RUEPPEL)
-/*************************************************
-* Acquire a NR op *
-*************************************************/
-NR_Operation* Default_Engine::nr_op(const DL_Group& group, const BigInt& y,
- const BigInt& x) const
- {
- return new Default_NR_Op(group, y, x);
- }
-#endif
-
-#if defined(BOTAN_HAS_ELGAMAL)
-/*************************************************
-* Acquire an ElGamal op *
-*************************************************/
-ELG_Operation* Default_Engine::elg_op(const DL_Group& group, const BigInt& y,
- const BigInt& x) const
- {
- return new Default_ELG_Op(group, y, x);
- }
-#endif
-
-#if defined(BOTAN_HAS_DIFFIE_HELLMAN)
-/*************************************************
-* Acquire a DH op *
-*************************************************/
-DH_Operation* Default_Engine::dh_op(const DL_Group& group,
- const BigInt& x) const
- {
- return new Default_DH_Op(group, x);
- }
-#endif
-
-#if defined(BOTAN_HAS_ECDSA)
-/*************************************************
-* Acquire a ECDSA op *
-*************************************************/
-ECDSA_Operation* Default_Engine::ecdsa_op(const EC_Domain_Params& dom_pars,
- const BigInt& priv_key,
- const PointGFp& pub_key) const
- {
- return new Default_ECDSA_Op(dom_pars, priv_key, pub_key);
- }
-#endif
-
-#if defined(BOTAN_HAS_ECKAEG)
-/*************************************************
-* Acquire a ECKAEG op *
-*************************************************/
-ECKAEG_Operation* Default_Engine::eckaeg_op(const EC_Domain_Params& dom_pars,
- const BigInt& priv_key,
- const PointGFp& pub_key) const
- {
- return new Default_ECKAEG_Op(dom_pars, priv_key, pub_key);
- }
-#endif
-
-}
diff --git a/src/libstate/engine/def_engine/def_powm.cpp b/src/libstate/engine/def_engine/def_powm.cpp
deleted file mode 100644
index 38aca901c..000000000
--- a/src/libstate/engine/def_engine/def_powm.cpp
+++ /dev/null
@@ -1,22 +0,0 @@
-/*************************************************
-* Modular Exponentiation Source File *
-* (C) 1999-2007 Jack Lloyd *
-*************************************************/
-
-#include <botan/def_eng.h>
-#include <botan/def_powm.h>
-
-namespace Botan {
-
-/*************************************************
-* Choose a modular exponentation algorithm *
-*************************************************/
-Modular_Exponentiator*
-Default_Engine::mod_exp(const BigInt& n, Power_Mod::Usage_Hints hints) const
- {
- if(n.is_odd())
- return new Montgomery_Exponentiator(n, hints);
- return new Fixed_Window_Exponentiator(n, hints);
- }
-
-}
diff --git a/src/libstate/engine/def_engine/info.txt b/src/libstate/engine/def_engine/info.txt
deleted file mode 100644
index 503a4392f..000000000
--- a/src/libstate/engine/def_engine/info.txt
+++ /dev/null
@@ -1,16 +0,0 @@
-realname "Default Engine"
-
-define DEFAULT_ENGINE
-
-load_on auto
-
-<add>
-def_eng.h
-def_mode.cpp
-def_pk_ops.cpp
-def_powm.cpp
-lookup_block.cpp
-lookup_hash.cpp
-lookup_mac.cpp
-lookup_stream.cpp
-</add>
diff --git a/src/libstate/engine/def_engine/lookup_block.cpp b/src/libstate/engine/def_engine/lookup_block.cpp
deleted file mode 100644
index 64a969dce..000000000
--- a/src/libstate/engine/def_engine/lookup_block.cpp
+++ /dev/null
@@ -1,262 +0,0 @@
-/*************************************************
-* Block Cipher Lookup *
-* (C) 1999-2007 Jack Lloyd *
-*************************************************/
-
-#include <botan/def_eng.h>
-#include <botan/scan_name.h>
-#include <botan/algo_factory.h>
-
-#if defined(BOTAN_HAS_AES)
- #include <botan/aes.h>
-#endif
-
-#if defined(BOTAN_HAS_BLOWFISH)
- #include <botan/blowfish.h>
-#endif
-
-#if defined(BOTAN_HAS_CAST)
- #include <botan/cast128.h>
- #include <botan/cast256.h>
-#endif
-
-#if defined(BOTAN_HAS_DES)
- #include <botan/des.h>
- #include <botan/desx.h>
-#endif
-
-#if defined(BOTAN_HAS_GOST)
- #include <botan/gost.h>
-#endif
-
-#if defined(BOTAN_HAS_IDEA)
- #include <botan/idea.h>
-#endif
-
-#if defined(BOTAN_HAS_KASUMI)
- #include <botan/kasumi.h>
-#endif
-
-#if defined(BOTAN_HAS_LION)
- #include <botan/lion.h>
-#endif
-
-#if defined(BOTAN_HAS_LUBY_RACKOFF)
- #include <botan/lubyrack.h>
-#endif
-
-#if defined(BOTAN_HAS_MARS)
- #include <botan/mars.h>
-#endif
-
-#if defined(BOTAN_HAS_MISTY1)
- #include <botan/misty1.h>
-#endif
-
-#if defined(BOTAN_HAS_NOEKEON)
- #include <botan/noekeon.h>
-#endif
-
-#if defined(BOTAN_HAS_RC2)
- #include <botan/rc2.h>
-#endif
-
-#if defined(BOTAN_HAS_RC5)
- #include <botan/rc5.h>
-#endif
-
-#if defined(BOTAN_HAS_RC6)
- #include <botan/rc6.h>
-#endif
-
-#if defined(BOTAN_HAS_SAFER)
- #include <botan/safer_sk.h>
-#endif
-
-#if defined(BOTAN_HAS_SEED)
- #include <botan/seed.h>
-#endif
-
-#if defined(BOTAN_HAS_SERPENT)
- #include <botan/serpent.h>
-#endif
-
-#if defined(BOTAN_HAS_SKIPJACK)
- #include <botan/skipjack.h>
-#endif
-
-#if defined(BOTAN_HAS_SQUARE)
- #include <botan/square.h>
-#endif
-
-#if defined(BOTAN_HAS_TEA)
- #include <botan/tea.h>
-#endif
-
-#if defined(BOTAN_HAS_TWOFISH)
- #include <botan/twofish.h>
-#endif
-
-#if defined(BOTAN_HAS_XTEA)
- #include <botan/xtea.h>
-#endif
-
-namespace Botan {
-
-/*************************************************
-* Look for an algorithm with this name *
-*************************************************/
-BlockCipher*
-Default_Engine::find_block_cipher(const SCAN_Name& request,
- Algorithm_Factory& af) const
- {
-
-#if defined(BOTAN_HAS_AES)
- if(request.algo_name() == "AES")
- return new AES;
- if(request.algo_name() == "AES-128")
- return new AES_128;
- if(request.algo_name() == "AES-192")
- return new AES_192;
- if(request.algo_name() == "AES-256")
- return new AES_256;
-#endif
-
-#if defined(BOTAN_HAS_BLOWFISH)
- if(request.algo_name() == "Blowfish")
- return new Blowfish;
-#endif
-
-#if defined(BOTAN_HAS_CAST)
- if(request.algo_name() == "CAST-128")
- return new CAST_128;
- if(request.algo_name() == "CAST-256")
- return new CAST_256;
-#endif
-
-#if defined(BOTAN_HAS_DES)
- if(request.algo_name() == "DES")
- return new DES;
- if(request.algo_name() == "DESX")
- return new DESX;
- if(request.algo_name() == "TripleDES")
- return new TripleDES;
-#endif
-
-#if defined(BOTAN_HAS_GOST)
- if(request.algo_name() == "GOST")
- return new GOST;
-#endif
-
-#if defined(BOTAN_HAS_IDEA)
- if(request.algo_name() == "IDEA")
- return new IDEA;
-#endif
-
-#if defined(BOTAN_HAS_KASUMI)
- if(request.algo_name() == "KASUMI")
- return new KASUMI;
-#endif
-
-#if defined(BOTAN_HAS_MARS)
- if(request.algo_name() == "MARS")
- return new MARS;
-#endif
-
-#if defined(BOTAN_HAS_MISTY1)
- if(request.algo_name() == "MISTY1")
- return new MISTY1(request.arg_as_u32bit(0, 8));
-#endif
-
-#if defined(BOTAN_HAS_NOEKEON)
- if(request.algo_name() == "Noekeon")
- return new Noekeon;
-#endif
-
-#if defined(BOTAN_HAS_RC2)
- if(request.algo_name() == "RC2")
- return new RC2;
-#endif
-
-#if defined(BOTAN_HAS_RC5)
- if(request.algo_name() == "RC5")
- return new RC5(request.arg_as_u32bit(0, 12));
-#endif
-
-#if defined(BOTAN_HAS_RC6)
- if(request.algo_name() == "RC6")
- return new RC6;
-#endif
-
-#if defined(BOTAN_HAS_SAFER)
- if(request.algo_name() == "SAFER-SK")
- return new SAFER_SK(request.arg_as_u32bit(0, 10));
-#endif
-
-#if defined(BOTAN_HAS_SEED)
- if(request.algo_name() == "SEED")
- return new SEED;
-#endif
-
-#if defined(BOTAN_HAS_SERPENT)
- if(request.algo_name() == "Serpent")
- return new Serpent;
-#endif
-
-#if defined(BOTAN_HAS_SKIPJACK)
- if(request.algo_name() == "Skipjack")
- return new Skipjack;
-#endif
-
-#if defined(BOTAN_HAS_SQUARE)
- if(request.algo_name() == "Square")
- return new Square;
-#endif
-
-#if defined(BOTAN_HAS_TEA)
- if(request.algo_name() == "TEA")
- return new TEA;
-#endif
-
-#if defined(BOTAN_HAS_TWOFISH)
- if(request.algo_name() == "Twofish")
- return new Twofish;
-#endif
-
-#if defined(BOTAN_HAS_XTEA)
- if(request.algo_name() == "XTEA")
- return new XTEA;
-#endif
-
-#if defined(BOTAN_HAS_LUBY_RACKOFF)
- if(request.algo_name() == "Luby-Rackoff" && request.arg_count() == 1)
- {
- const HashFunction* hash = af.prototype_hash_function(request.arg(0));
-
- if(hash)
- return new LubyRackoff(hash->clone());
- }
-#endif
-
-#if defined(BOTAN_HAS_LION)
- if(request.algo_name() == "Lion" && request.arg_count_between(2, 3))
- {
- const u32bit block_size = request.arg_as_u32bit(2, 1024);
-
- const HashFunction* hash =
- af.prototype_hash_function(request.arg(0));
-
- const StreamCipher* stream_cipher =
- af.prototype_stream_cipher(request.arg(1));
-
- if(!hash || !stream_cipher)
- return 0;
-
- return new Lion(hash->clone(), stream_cipher->clone(), block_size);
- }
-#endif
-
- return 0;
- }
-
-}
diff --git a/src/libstate/engine/def_engine/lookup_hash.cpp b/src/libstate/engine/def_engine/lookup_hash.cpp
deleted file mode 100644
index 48ed8bc04..000000000
--- a/src/libstate/engine/def_engine/lookup_hash.cpp
+++ /dev/null
@@ -1,188 +0,0 @@
-/*************************************************
-* Hash Algorithms Lookup *
-* (C) 1999-2007 Jack Lloyd *
-*************************************************/
-
-#include <botan/def_eng.h>
-#include <botan/scan_name.h>
-#include <botan/algo_factory.h>
-#include <memory>
-
-#if defined(BOTAN_HAS_ADLER32)
- #include <botan/adler32.h>
-#endif
-
-#if defined(BOTAN_HAS_CRC24)
- #include <botan/crc24.h>
-#endif
-
-#if defined(BOTAN_HAS_CRC32)
- #include <botan/crc32.h>
-#endif
-
-#if defined(BOTAN_HAS_FORK_256)
- #include <botan/fork256.h>
-#endif
-
-#if defined(BOTAN_HAS_HAS_160)
- #include <botan/has160.h>
-#endif
-
-#if defined(BOTAN_HAS_MD2)
- #include <botan/md2.h>
-#endif
-
-#if defined(BOTAN_HAS_MD4)
- #include <botan/md4.h>
-#endif
-
-#if defined(BOTAN_HAS_MD5)
- #include <botan/md5.h>
-#endif
-
-#if defined(BOTAN_HAS_RIPEMD_128)
- #include <botan/rmd128.h>
-#endif
-
-#if defined(BOTAN_HAS_RIPEMD_160)
- #include <botan/rmd160.h>
-#endif
-
-#if defined(BOTAN_HAS_SHA1)
- #include <botan/sha160.h>
-#endif
-
-#if defined(BOTAN_HAS_SHA2)
- #include <botan/sha2_32.h>
- #include <botan/sha2_64.h>
-#endif
-
-#if defined(BOTAN_HAS_TIGER)
- #include <botan/tiger.h>
-#endif
-
-#if defined(BOTAN_HAS_WHIRLPOOL)
- #include <botan/whrlpool.h>
-#endif
-
-#if defined(BOTAN_HAS_PARALLEL_HASH)
- #include <botan/par_hash.h>
-#endif
-
-namespace Botan {
-
-/*************************************************
-* Look for an algorithm with this name *
-*************************************************/
-HashFunction*
-Default_Engine::find_hash(const SCAN_Name& request,
- Algorithm_Factory& af) const
- {
-#if defined(BOTAN_HAS_ADLER32)
- if(request.algo_name() == "Adler32")
- return new Adler32;
-#endif
-
-#if defined(BOTAN_HAS_CRC24)
- if(request.algo_name() == "CRC24")
- return new CRC24;
-#endif
-
-#if defined(BOTAN_HAS_CRC32)
- if(request.algo_name() == "CRC32")
- return new CRC32;
-#endif
-
-#if defined(BOTAN_HAS_FORK_256)
- if(request.algo_name() == "FORK-256")
- return new FORK_256;
-#endif
-
-#if defined(BOTAN_HAS_HAS_160)
- if(request.algo_name() == "HAS-160")
- return new HAS_160;
-#endif
-
-#if defined(BOTAN_HAS_MD2)
- if(request.algo_name() == "MD2")
- return new MD2;
-#endif
-
-#if defined(BOTAN_HAS_MD4)
- if(request.algo_name() == "MD4")
- return new MD4;
-#endif
-
-#if defined(BOTAN_HAS_MD5)
- if(request.algo_name() == "MD5")
- return new MD5;
-#endif
-
-#if defined(BOTAN_HAS_RIPEMD_128)
- if(request.algo_name() == "RIPEMD-128")
- return new RIPEMD_128;
-#endif
-
-#if defined(BOTAN_HAS_RIPEMD_160)
- if(request.algo_name() == "RIPEMD-160")
- return new RIPEMD_160;
-#endif
-
-#if defined(BOTAN_HAS_SHA1)
- if(request.algo_name() == "SHA-160")
- return new SHA_160;
-#endif
-
-#if defined(BOTAN_HAS_SHA2)
- if(request.algo_name() == "SHA-224")
- return new SHA_224;
- if(request.algo_name() == "SHA-256")
- return new SHA_256;
- if(request.algo_name() == "SHA-384")
- return new SHA_384;
- if(request.algo_name() == "SHA-512")
- return new SHA_512;
-#endif
-
-#if defined(BOTAN_HAS_TIGER)
- if(request.algo_name() == "Tiger")
- return new Tiger(request.arg_as_u32bit(0, 24), // hash output
- request.arg_as_u32bit(1, 3)); // # passes
-#endif
-
-#if defined(BOTAN_HAS_WHIRLPOOL)
- if(request.algo_name() == "Whirlpool")
- return new Whirlpool;
-#endif
-
-#if defined(BOTAN_HAS_PARALLEL_HASH)
-
- if(request.algo_name() == "Parallel")
- {
- std::vector<const HashFunction*> hash_prototypes;
-
- /* First pass, just get the prototypes (no memory allocation). Then
- if all were found, replace each prototype with a newly created clone
- */
- for(size_t i = 0; i != request.arg_count(); ++i)
- {
- const HashFunction* hash = af.prototype_hash_function(request.arg(i));
- if(!hash)
- return 0;
-
- hash_prototypes.push_back(hash);
- }
-
- std::vector<HashFunction*> hashes;
- for(size_t i = 0; i != hash_prototypes.size(); ++i)
- hashes.push_back(hash_prototypes[i]->clone());
-
- return new Parallel(hashes);
- }
-
-#endif
-
- return 0;
- }
-
-}
diff --git a/src/libstate/engine/def_engine/lookup_mac.cpp b/src/libstate/engine/def_engine/lookup_mac.cpp
deleted file mode 100644
index ae44bbe3d..000000000
--- a/src/libstate/engine/def_engine/lookup_mac.cpp
+++ /dev/null
@@ -1,68 +0,0 @@
-/*************************************************
-* MAC Lookup *
-* (C) 1999-2007 Jack Lloyd *
-*************************************************/
-
-#include <botan/def_eng.h>
-#include <botan/scan_name.h>
-#include <botan/algo_factory.h>
-
-#if defined(BOTAN_HAS_CBC_MAC)
- #include <botan/cbc_mac.h>
-#endif
-
-#if defined(BOTAN_HAS_CMAC)
- #include <botan/cmac.h>
-#endif
-
-#if defined(BOTAN_HAS_HMAC)
- #include <botan/hmac.h>
-#endif
-
-#if defined(BOTAN_HAS_SSL3_MAC)
- #include <botan/ssl3_mac.h>
-#endif
-
-#if defined(BOTAN_HAS_ANSI_X919_MAC)
- #include <botan/x919_mac.h>
-#endif
-
-namespace Botan {
-
-/*************************************************
-* Look for an algorithm with this name *
-*************************************************/
-MessageAuthenticationCode*
-Default_Engine::find_mac(const SCAN_Name& request,
- Algorithm_Factory& af) const
- {
-
-#if defined(BOTAN_HAS_CBC_MAC)
- if(request.algo_name() == "CBC-MAC" && request.arg_count() == 1)
- return new CBC_MAC(af.make_block_cipher(request.arg(0)));
-#endif
-
-#if defined(BOTAN_HAS_CMAC)
- if(request.algo_name() == "CMAC" && request.arg_count() == 1)
- return new CMAC(af.make_block_cipher(request.arg(0)));
-#endif
-
-#if defined(BOTAN_HAS_HMAC)
- if(request.algo_name() == "HMAC" && request.arg_count() == 1)
- return new HMAC(af.make_hash_function(request.arg(0)));
-#endif
-
-#if defined(BOTAN_HAS_SSL3_MAC)
- if(request.algo_name() == "SSL3-MAC" && request.arg_count() == 1)
- return new SSL3_MAC(af.make_hash_function(request.arg(0)));
-#endif
-
-#if defined(BOTAN_HAS_ANSI_X919_MAC)
- if(request.algo_name() == "X9.19-MAC" && request.arg_count() == 0)
- return new ANSI_X919_MAC(af.make_block_cipher(SCAN_Name("DES")));
-#endif
-
- return 0;
- }
-
-}
diff --git a/src/libstate/engine/def_engine/lookup_stream.cpp b/src/libstate/engine/def_engine/lookup_stream.cpp
deleted file mode 100644
index e7f1ff41d..000000000
--- a/src/libstate/engine/def_engine/lookup_stream.cpp
+++ /dev/null
@@ -1,59 +0,0 @@
-/*************************************************
-* Stream Cipher Lookup *
-* (C) 1999-2007 Jack Lloyd *
-*************************************************/
-
-#include <botan/def_eng.h>
-#include <botan/scan_name.h>
-
-#if defined(BOTAN_HAS_ARC4)
- #include <botan/arc4.h>
-#endif
-
-#if defined(BOTAN_HAS_SALSA20)
- #include <botan/salsa20.h>
-#endif
-
-#if defined(BOTAN_HAS_TURING)
- #include <botan/turing.h>
-#endif
-
-#if defined(BOTAN_HAS_WID_WAKE)
- #include <botan/wid_wake.h>
-#endif
-
-namespace Botan {
-
-/*************************************************
-* Look for an algorithm with this name *
-*************************************************/
-StreamCipher*
-Default_Engine::find_stream_cipher(const SCAN_Name& request,
- Algorithm_Factory&) const
- {
-#if defined(BOTAN_HAS_ARC4)
- if(request.algo_name() == "ARC4")
- return new ARC4(request.arg_as_u32bit(0, 0));
- if(request.algo_name() == "RC4_drop")
- return new ARC4(768);
-#endif
-
-#if defined(BOTAN_HAS_SALSA20)
- if(request.algo_name() == "Salsa20")
- return new Salsa20;
-#endif
-
-#if defined(BOTAN_HAS_TURING)
- if(request.algo_name() == "Turing")
- return new Turing;
-#endif
-
-#if defined(BOTAN_HAS_WID_WAKE)
- if(request.algo_name() == "WiderWake4+1-BE")
- return new WiderWake_41_BE;
-#endif
-
- return 0;
- }
-
-}