diff options
-rw-r--r-- | src/core/info.txt | 2 | ||||
-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.cpp | 76 | ||||
-rw-r--r-- | src/core/libstate/eng_def.h (renamed from src/core/eng_def.h) | 3 | ||||
-rw-r--r-- | src/core/libstate/engine.cpp | 2 | ||||
-rw-r--r-- | src/core/libstate/engine.h | 36 | ||||
-rw-r--r-- | src/core/libstate/info.txt | 2 | ||||
-rw-r--r-- | src/pubkey/dh/dh_core.h | 4 | ||||
-rw-r--r-- | src/pubkey/dh/dh_op.cpp | 20 | ||||
-rw-r--r-- | src/pubkey/dh/dh_op.h (renamed from src/pubkey/pubkey/dh_op.cpp) | 38 | ||||
-rw-r--r-- | src/pubkey/dh/info.txt | 2 | ||||
-rw-r--r-- | src/pubkey/dsa/dsa.cpp | 1 | ||||
-rw-r--r-- | src/pubkey/elgamal/elgamal.cpp | 1 | ||||
-rw-r--r-- | src/pubkey/nr/nr.cpp | 1 | ||||
-rw-r--r-- | src/pubkey/pubkey/if_op.cpp (renamed from src/pubkey/pubkey/rsa_op.cpp) | 0 | ||||
-rw-r--r-- | src/pubkey/pubkey/info.txt | 3 | ||||
-rw-r--r-- | src/pubkey/pubkey/pk_ops.h | 11 | ||||
-rw-r--r-- | src/pubkey/rsa/rsa.cpp | 3 | ||||
-rw-r--r-- | src/pubkey/rw/rw.cpp | 1 |
19 files changed, 85 insertions, 121 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 diff --git a/src/pubkey/dh/dh_core.h b/src/pubkey/dh/dh_core.h index 3735f31e1..666e615fc 100644 --- a/src/pubkey/dh/dh_core.h +++ b/src/pubkey/dh/dh_core.h @@ -6,10 +6,8 @@ #ifndef BOTAN_DH_CORE_H__ #define BOTAN_DH_CORE_H__ -#include <botan/bigint.h> +#include <botan/dh_op.h> #include <botan/blinding.h> -#include <botan/pk_ops.h> -#include <botan/dl_group.h> namespace Botan { diff --git a/src/pubkey/dh/dh_op.cpp b/src/pubkey/dh/dh_op.cpp new file mode 100644 index 000000000..3b87c6467 --- /dev/null +++ b/src/pubkey/dh/dh_op.cpp @@ -0,0 +1,20 @@ +/************************************************* +* DH Operations Source File * +* (C) 1999-2007 Jack Lloyd * +*************************************************/ + +#include <botan/dh_op.h> +#include <botan/eng_def.h> + +namespace Botan { + +/************************************************* +* 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); + } + +} diff --git a/src/pubkey/pubkey/dh_op.cpp b/src/pubkey/dh/dh_op.h index 0bcfd4ef8..4fbd3f5dc 100644 --- a/src/pubkey/pubkey/dh_op.cpp +++ b/src/pubkey/dh/dh_op.h @@ -1,19 +1,30 @@ /************************************************* -* DH Operations Source File * -* (C) 1999-2007 Jack Lloyd * +* DH Operations Header File * +* (C) 1999-2008 Jack Lloyd * *************************************************/ -#include <botan/eng_def.h> -#include <botan/pow_mod.h> -#include <botan/numthry.h> +#ifndef BOTAN_DH_OPS_H__ +#define BOTAN_DH_OPS_H__ + +#include <botan/dl_group.h> #include <botan/reducer.h> +#include <botan/pow_mod.h> namespace Botan { -namespace { +/************************************************* +* DH Operation Interface * +*************************************************/ +class BOTAN_DLL DH_Operation + { + public: + virtual BigInt agree(const BigInt&) const = 0; + virtual DH_Operation* clone() const = 0; + virtual ~DH_Operation() {} + }; /************************************************* -* Default DH Operation * +* Botan's Default DH Operation * *************************************************/ class Default_DH_Op : public DH_Operation { @@ -24,18 +35,9 @@ class Default_DH_Op : public DH_Operation Default_DH_Op(const DL_Group& group, const BigInt& x) : powermod_x_p(x, group.get_p()) {} private: - const Fixed_Exponent_Power_Mod powermod_x_p; + Fixed_Exponent_Power_Mod powermod_x_p; }; } -/************************************************* -* 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 diff --git a/src/pubkey/dh/info.txt b/src/pubkey/dh/info.txt index 3765644c8..a54188c57 100644 --- a/src/pubkey/dh/info.txt +++ b/src/pubkey/dh/info.txt @@ -9,6 +9,8 @@ dh.cpp dh.h dh_core.cpp dh_core.h +dh_op.h +dh_op.cpp </add> <requires> diff --git a/src/pubkey/dsa/dsa.cpp b/src/pubkey/dsa/dsa.cpp index ef69a1ee5..c998c35b2 100644 --- a/src/pubkey/dsa/dsa.cpp +++ b/src/pubkey/dsa/dsa.cpp @@ -6,6 +6,7 @@ #include <botan/dsa.h> #include <botan/numthry.h> #include <botan/keypair.h> +#include <botan/look_pk.h> namespace Botan { diff --git a/src/pubkey/elgamal/elgamal.cpp b/src/pubkey/elgamal/elgamal.cpp index ea0d581b0..01b322d63 100644 --- a/src/pubkey/elgamal/elgamal.cpp +++ b/src/pubkey/elgamal/elgamal.cpp @@ -6,6 +6,7 @@ #include <botan/elgamal.h> #include <botan/numthry.h> #include <botan/keypair.h> +#include <botan/look_pk.h> #include <botan/util.h> namespace Botan { diff --git a/src/pubkey/nr/nr.cpp b/src/pubkey/nr/nr.cpp index 99eff9726..063eedbcc 100644 --- a/src/pubkey/nr/nr.cpp +++ b/src/pubkey/nr/nr.cpp @@ -6,6 +6,7 @@ #include <botan/nr.h> #include <botan/numthry.h> #include <botan/keypair.h> +#include <botan/look_pk.h> namespace Botan { diff --git a/src/pubkey/pubkey/rsa_op.cpp b/src/pubkey/pubkey/if_op.cpp index 0b151bf3b..0b151bf3b 100644 --- a/src/pubkey/pubkey/rsa_op.cpp +++ b/src/pubkey/pubkey/if_op.cpp diff --git a/src/pubkey/pubkey/info.txt b/src/pubkey/pubkey/info.txt index 8c97aa744..421232286 100644 --- a/src/pubkey/pubkey/info.txt +++ b/src/pubkey/pubkey/info.txt @@ -11,9 +11,9 @@ asn1 </requires> <add> -dh_op.cpp dsa_op.cpp elg_op.cpp +if_op.cpp nr_op.cpp pk_algs.cpp pk_algs.h @@ -24,7 +24,6 @@ pkcs8.cpp pkcs8.h pubkey.cpp pubkey.h -rsa_op.cpp x509_key.cpp x509_key.h </add> diff --git a/src/pubkey/pubkey/pk_ops.h b/src/pubkey/pubkey/pk_ops.h index 5413fc7cd..32be0326f 100644 --- a/src/pubkey/pubkey/pk_ops.h +++ b/src/pubkey/pubkey/pk_ops.h @@ -67,17 +67,6 @@ class BOTAN_DLL ELG_Operation virtual ~ELG_Operation() {} }; -/************************************************* -* DH Operation * -*************************************************/ -class BOTAN_DLL DH_Operation - { - public: - virtual BigInt agree(const BigInt&) const = 0; - virtual DH_Operation* clone() const = 0; - virtual ~DH_Operation() {} - }; - #if defined(BOTAN_HAS_ECDSA) /************************************************* * ECDSA Operation * diff --git a/src/pubkey/rsa/rsa.cpp b/src/pubkey/rsa/rsa.cpp index 8faec9972..7b74f3c57 100644 --- a/src/pubkey/rsa/rsa.cpp +++ b/src/pubkey/rsa/rsa.cpp @@ -4,9 +4,10 @@ *************************************************/ #include <botan/rsa.h> +#include <botan/parsing.h> #include <botan/numthry.h> #include <botan/keypair.h> -#include <botan/parsing.h> +#include <botan/look_pk.h> namespace Botan { diff --git a/src/pubkey/rw/rw.cpp b/src/pubkey/rw/rw.cpp index 39cbcdd6e..a2888a87d 100644 --- a/src/pubkey/rw/rw.cpp +++ b/src/pubkey/rw/rw.cpp @@ -6,6 +6,7 @@ #include <botan/rw.h> #include <botan/numthry.h> #include <botan/keypair.h> +#include <botan/look_pk.h> #include <botan/parsing.h> #include <algorithm> |