aboutsummaryrefslogtreecommitdiffstats
path: root/src/core
diff options
context:
space:
mode:
authorlloyd <[email protected]>2008-10-01 15:01:06 +0000
committerlloyd <[email protected]>2008-10-01 15:01:06 +0000
commit1034cf44b4ee0948312c11a1b079b8b04c5828e2 (patch)
tree17bd5ec37cea079132d0774435b81f8c18fc01f4 /src/core
parent9da5c08de6bb6a6972a48ee5bb11ab7654c37f63 (diff)
Split Diffie-Hellman off almost completely, such that nearly none of
it builds if it is disabled. Current deficiency: due to #if defined(BLAH) in the engine code, Botan will not be binary compat across different configurations b/c the vtable will change size. Move some source from core/ to core/libstate where it belonged (engine stuff)
Diffstat (limited to 'src/core')
-rw-r--r--src/core/info.txt2
-rw-r--r--src/core/libstate/def_powm.cpp (renamed from src/core/def_powm.cpp)0
-rw-r--r--src/core/libstate/eng_base.cpp76
-rw-r--r--src/core/libstate/eng_def.h (renamed from src/core/eng_def.h)3
-rw-r--r--src/core/libstate/engine.cpp2
-rw-r--r--src/core/libstate/engine.h36
-rw-r--r--src/core/libstate/info.txt2
7 files changed, 35 insertions, 86 deletions
diff --git a/src/core/info.txt b/src/core/info.txt
index 9331d56dd..6c031d36f 100644
--- a/src/core/info.txt
+++ b/src/core/info.txt
@@ -21,10 +21,8 @@ base.h
botan.h
data_src.cpp
data_src.h
-def_powm.cpp
defalloc.cpp
defalloc.h
-eng_def.h
enums.h
exceptn.cpp
exceptn.h
diff --git a/src/core/def_powm.cpp b/src/core/libstate/def_powm.cpp
index a28438f5b..a28438f5b 100644
--- a/src/core/def_powm.cpp
+++ b/src/core/libstate/def_powm.cpp
diff --git a/src/core/libstate/eng_base.cpp b/src/core/libstate/eng_base.cpp
index a296a2762..aaaf46723 100644
--- a/src/core/libstate/eng_base.cpp
+++ b/src/core/libstate/eng_base.cpp
@@ -64,82 +64,6 @@ class Algorithm_Cache_Impl : public Engine::Algorithm_Cache<T>
}
/*************************************************
-* Basic No-Op Engine Implementation *
-*************************************************/
-IF_Operation* Engine::if_op(const BigInt&, const BigInt&, const BigInt&,
- const BigInt&, const BigInt&, const BigInt&,
- const BigInt&, const BigInt&) const
- {
- return 0;
- }
-
-/*************************************************
-* Basic No-Op Engine Implementation *
-*************************************************/
-DSA_Operation* Engine::dsa_op(const DL_Group&, const BigInt&,
- const BigInt&) const
- {
- return 0;
- }
-
-/*************************************************
-* Basic No-Op Engine Implementation *
-*************************************************/
-NR_Operation* Engine::nr_op(const DL_Group&, const BigInt&,
- const BigInt&) const
- {
- return 0;
- }
-
-/*************************************************
-* Basic No-Op Engine Implementation *
-*************************************************/
-ELG_Operation* Engine::elg_op(const DL_Group&, const BigInt&,
- const BigInt&) const
- {
- return 0;
- }
-
-/*************************************************
-* Basic No-Op Engine Implementation *
-*************************************************/
-DH_Operation* Engine::dh_op(const DL_Group&, const BigInt&) const
- {
- return 0;
- }
-
-#if defined(BOTAN_HAS_ECDSA)
-/*************************************************
-* Basic No-Op Engine Implementation *
-*************************************************/
-ECDSA_Operation* Engine::ecdsa_op(const EC_Domain_Params&,
- const BigInt&,
- const PointGFp&) const
- {
- return 0;
- }
-
-/*************************************************
-* Basic No-Op Engine Implementation *
-*************************************************/
-ECKAEG_Operation* Engine::eckaeg_op(const EC_Domain_Params&,
- const BigInt&,
- const PointGFp&) const
- {
- return 0;
- }
-#endif
-
-/*************************************************
-* Basic No-Op Engine Implementation *
-*************************************************/
-Modular_Exponentiator* Engine::mod_exp(const BigInt&,
- Power_Mod::Usage_Hints) const
- {
- return 0;
- }
-
-/*************************************************
* Acquire a BlockCipher *
*************************************************/
const BlockCipher* Engine::block_cipher(const std::string& name) const
diff --git a/src/core/eng_def.h b/src/core/libstate/eng_def.h
index 95f1fc0f7..7d7ecce58 100644
--- a/src/core/eng_def.h
+++ b/src/core/libstate/eng_def.h
@@ -24,7 +24,10 @@ class BOTAN_DLL Default_Engine : public Engine
NR_Operation* nr_op(const DL_Group&, const BigInt&, const BigInt&) const;
ELG_Operation* elg_op(const DL_Group&, const BigInt&,
const BigInt&) const;
+
+#if defined(BOTAN_HAS_DH)
DH_Operation* dh_op(const DL_Group&, const BigInt&) const;
+#endif
Modular_Exponentiator* mod_exp(const BigInt&,
Power_Mod::Usage_Hints) const;
diff --git a/src/core/libstate/engine.cpp b/src/core/libstate/engine.cpp
index fb2477936..13ab63193 100644
--- a/src/core/libstate/engine.cpp
+++ b/src/core/libstate/engine.cpp
@@ -83,6 +83,7 @@ ELG_Operation* elg_op(const DL_Group& group, const BigInt& y, const BigInt& x)
throw Lookup_Error("Engine_Core::elg_op: Unable to find a working engine");
}
+#if defined(BOTAN_HAS_DH)
/*************************************************
* Acquire a DH op *
*************************************************/
@@ -99,6 +100,7 @@ DH_Operation* dh_op(const DL_Group& group, const BigInt& x)
throw Lookup_Error("Engine_Core::dh_op: Unable to find a working engine");
}
+#endif
#if defined(BOTAN_HAS_ECDSA)
/*************************************************
diff --git a/src/core/libstate/engine.h b/src/core/libstate/engine.h
index 212d02d7a..12c69385b 100644
--- a/src/core/libstate/engine.h
+++ b/src/core/libstate/engine.h
@@ -13,6 +13,10 @@
#include <botan/basefilt.h>
#include <botan/enums.h>
+#if defined(BOTAN_HAS_DH)
+ #include <botan/dh_op.h>
+#endif
+
#if defined(BOTAN_HAS_ECDSA)
#include <botan/ec_dompar.h>
#endif
@@ -39,27 +43,41 @@ class BOTAN_DLL Engine
virtual IF_Operation* if_op(const BigInt&, const BigInt&, const BigInt&,
const BigInt&, const BigInt&, const BigInt&,
- const BigInt&, const BigInt&) const;
+ const BigInt&, const BigInt&) const
+ { return 0; }
+
virtual DSA_Operation* dsa_op(const DL_Group&, const BigInt&,
- const BigInt&) const;
+ const BigInt&) const
+ { return 0; }
+
virtual NR_Operation* nr_op(const DL_Group&, const BigInt&,
- const BigInt&) const;
+ const BigInt&) const
+ { return 0; }
+
virtual ELG_Operation* elg_op(const DL_Group&, const BigInt&,
- const BigInt&) const;
- virtual DH_Operation* dh_op(const DL_Group&, const BigInt&) const;
+ const BigInt&) const
+ { return 0; }
+
+#if defined(BOTAN_HAS_DH)
+ virtual DH_Operation* dh_op(const DL_Group&, const BigInt&) const
+ { return 0; }
+#endif
#if defined(BOTAN_HAS_ECDSA)
virtual ECDSA_Operation* ecdsa_op(const EC_Domain_Params& dom_pars,
const BigInt& priv_key,
- const PointGFp& pub_key) const;
+ const PointGFp& pub_key) const
+ { return 0; }
virtual ECKAEG_Operation* eckaeg_op(const EC_Domain_Params& dom_pars,
const BigInt& priv_key,
- const PointGFp& pub_key) const;
+ const PointGFp& pub_key) const
+ { return 0; }
#endif
virtual Modular_Exponentiator* mod_exp(const BigInt&,
- Power_Mod::Usage_Hints) const;
+ Power_Mod::Usage_Hints) const
+ { return 0; }
virtual Keyed_Filter* get_cipher(const std::string&, Cipher_Dir);
@@ -129,7 +147,9 @@ NR_Operation* nr_op(const DL_Group&, const BigInt&, const BigInt&);
ELG_Operation* elg_op(const DL_Group&, const BigInt&, const BigInt&);
+#if defined(BOTAN_HAS_DH)
DH_Operation* dh_op(const DL_Group&, const BigInt&);
+#endif
#if defined(BOTAN_HAS_ECDSA)
ECDSA_Operation* ecdsa_op(const EC_Domain_Params& dom_pars,
diff --git a/src/core/libstate/info.txt b/src/core/libstate/info.txt
index f160ca771..6a54463ac 100644
--- a/src/core/libstate/info.txt
+++ b/src/core/libstate/info.txt
@@ -7,7 +7,9 @@ define LIBSTATE_MODULE
<add>
def_alg.cpp
def_mode.cpp
+def_powm.cpp
eng_base.cpp
+eng_def.h
engine.cpp
engine.h
get_enc.cpp