diff options
-rw-r--r-- | src/engine/engine.cpp | 82 | ||||
-rw-r--r-- | src/engine/engine.h | 48 | ||||
-rw-r--r-- | src/engine/info.txt | 4 |
3 files changed, 101 insertions, 33 deletions
diff --git a/src/engine/engine.cpp b/src/engine/engine.cpp new file mode 100644 index 000000000..03008fb26 --- /dev/null +++ b/src/engine/engine.cpp @@ -0,0 +1,82 @@ +/* +* Engine +* (C) 2010 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ + +#include <botan/engine.h> + +namespace Botan { + +BlockCipher* +Engine::find_block_cipher(const SCAN_Name&, + Algorithm_Factory&) const + { + return 0; + } + +StreamCipher* +Engine::find_stream_cipher(const SCAN_Name&, + Algorithm_Factory&) const + { + return 0; + } + +HashFunction* +Engine::find_hash(const SCAN_Name&, + Algorithm_Factory&) const + { + return 0; + } + +MessageAuthenticationCode* +Engine::find_mac(const SCAN_Name&, + Algorithm_Factory&) const + { + return 0; + } + +Modular_Exponentiator* +Engine::mod_exp(const BigInt&, + Power_Mod::Usage_Hints) const + { + return 0; + } + +Keyed_Filter* Engine::get_cipher(const std::string&, + Cipher_Dir, + Algorithm_Factory&) + { + return 0; + } + +PK_Ops::Key_Agreement* +Engine::get_key_agreement_op(const Private_Key) const + { + return 0; + } + +PK_Ops::Signature* +Engine::get_signature_op(const Private_Key&) const + { + return 0; + } + +PK_Ops::Verification* +Engine::get_verify_op(const Public_Key&) const + { + return 0; + } + +PK_Ops::Encryption* +Engine::get_encryption_op(const Public_Key&) const + { + return 0; + } + +PK_Ops::Decryption* +Engine::get_decryption_op(const Private_Key&) const + { + return 0; + } diff --git a/src/engine/engine.h b/src/engine/engine.h index 6e8133692..c9bcd6126 100644 --- a/src/engine/engine.h +++ b/src/engine/engine.h @@ -27,7 +27,10 @@ class Algorithm_Factory; class Keyed_Filter; /** -* Engine Base Class +* Base class for all engines. All non-pure virtual functions simply +* return NULL, indicating the algorithm in question is not +* supported. Subclasses can reimplement whichever function(s) +* they want to hook in a particular type. */ class BOTAN_DLL Engine { @@ -46,8 +49,7 @@ class BOTAN_DLL Engine */ virtual BlockCipher* find_block_cipher(const SCAN_Name& algo_spec, - Algorithm_Factory& af) const - { return 0; } + Algorithm_Factory& af) const; /** * @param algo_spec the algorithm name/specification @@ -56,8 +58,7 @@ class BOTAN_DLL Engine */ virtual StreamCipher* find_stream_cipher(const SCAN_Name& algo_spec, - Algorithm_Factory& af) const - { return 0; } + Algorithm_Factory& af) const; /** * @param algo_spec the algorithm name/specification @@ -66,8 +67,7 @@ class BOTAN_DLL Engine */ virtual HashFunction* find_hash(const SCAN_Name& algo_spec, - Algorithm_Factory& af) const - { return 0; } + Algorithm_Factory& af) const; /** * @param algo_spec the algorithm name/specification @@ -76,8 +76,7 @@ class BOTAN_DLL Engine */ virtual MessageAuthenticationCode* find_mac(const SCAN_Name& algo_spec, - Algorithm_Factory& af) const - { return 0; } + Algorithm_Factory& af) const; /** * @param n the modulus @@ -86,8 +85,7 @@ class BOTAN_DLL Engine */ virtual Modular_Exponentiator* mod_exp(const BigInt& n, - Power_Mod::Usage_Hints hints) const - { return 0; } + Power_Mod::Usage_Hints hints) const; /** * Return a new cipher object @@ -98,8 +96,7 @@ class BOTAN_DLL Engine */ virtual Keyed_Filter* get_cipher(const std::string& algo_spec, Cipher_Dir dir, - Algorithm_Factory& af) - { return 0; } + Algorithm_Factory& af); /** * Return a new operator object for this key, if possible @@ -107,10 +104,7 @@ class BOTAN_DLL Engine * @return newly allocated operator object, or NULL */ virtual PK_Ops::Key_Agreement* - get_key_agreement_op(const Private_Key& key) const - { - return 0; - } + get_key_agreement_op(const Private_Key& key) const; /** * Return a new operator object for this key, if possible @@ -118,10 +112,7 @@ class BOTAN_DLL Engine * @return newly allocated operator object, or NULL */ virtual PK_Ops::Signature* - get_signature_op(const Private_Key& key) const - { - return 0; - } + get_signature_op(const Private_Key& key) const; /** * Return a new operator object for this key, if possible @@ -129,10 +120,7 @@ class BOTAN_DLL Engine * @return newly allocated operator object, or NULL */ virtual PK_Ops::Verification* - get_verify_op(const Public_Key& key) const - { - return 0; - } + get_verify_op(const Public_Key& key) const; /** * Return a new operator object for this key, if possible @@ -140,10 +128,7 @@ class BOTAN_DLL Engine * @return newly allocated operator object, or NULL */ virtual PK_Ops::Encryption* - get_encryption_op(const Public_Key& key) const - { - return 0; - } + get_encryption_op(const Public_Key& key) const; /** * Return a new operator object for this key, if possible @@ -151,10 +136,7 @@ class BOTAN_DLL Engine * @return newly allocated operator object, or NULL */ virtual PK_Ops::Decryption* - get_decryption_op(const Private_Key& key) const - { - return 0; - } + get_decryption_op(const Private_Key& key) const; }; } diff --git a/src/engine/info.txt b/src/engine/info.txt index 32fcf21c2..5f787cebe 100644 --- a/src/engine/info.txt +++ b/src/engine/info.txt @@ -4,6 +4,10 @@ define ENGINES engine.h </header:public> +<source> +engine.cpp +</source> + <requires> block hash |