aboutsummaryrefslogtreecommitdiffstats
path: root/src/engine
diff options
context:
space:
mode:
authorlloyd <[email protected]>2010-06-16 03:16:47 +0000
committerlloyd <[email protected]>2010-06-16 03:16:47 +0000
commita2b1e1b197cb6f722cc41c6c960d673aec726adf (patch)
tree173c99dfb21f1dabaadec1c4639ee3144a60cc54 /src/engine
parentecb574d32f4382326e94ad19e9d5baecc84a3c29 (diff)
Move the implemention of the functions in the Engine base class into a
source file. Otherwise we ran into a conflict between Doxygen comments, which require us to name the params, and GCC's -Wunused-parameters, which will warn about parameters which aren't being used.
Diffstat (limited to 'src/engine')
-rw-r--r--src/engine/engine.cpp82
-rw-r--r--src/engine/engine.h48
-rw-r--r--src/engine/info.txt4
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