aboutsummaryrefslogtreecommitdiffstats
path: root/src/libstate
diff options
context:
space:
mode:
authorlloyd <[email protected]>2008-11-10 02:22:54 +0000
committerlloyd <[email protected]>2008-11-10 02:22:54 +0000
commita4be9296531e66b3d40b5ff195bfd9ba9b9c070f (patch)
tree5845d2463b7476ee8bbe8b759c4bb73cd4a94b4e /src/libstate
parent205bfc4e1fc8993e050174a3fca589a648fb947b (diff)
Split lookup_cipher.cpp into lookup_{block,stream,bc_pad}.cpp
Diffstat (limited to 'src/libstate')
-rw-r--r--src/libstate/engine/def_engine/info.txt8
-rw-r--r--src/libstate/engine/def_engine/lookup_bc_pad.cpp40
-rw-r--r--src/libstate/engine/def_engine/lookup_block.cpp (renamed from src/libstate/engine/def_engine/lookup_cipher.cpp)80
-rw-r--r--src/libstate/engine/def_engine/lookup_stream.cpp85
4 files changed, 131 insertions, 82 deletions
diff --git a/src/libstate/engine/def_engine/info.txt b/src/libstate/engine/def_engine/info.txt
index 0de7f37ab..823df1559 100644
--- a/src/libstate/engine/def_engine/info.txt
+++ b/src/libstate/engine/def_engine/info.txt
@@ -5,12 +5,14 @@ define DEFAULT_ENGINE
load_on auto
<add>
+def_eng.h
def_mode.cpp
+def_pk_ops.cpp
def_powm.cpp
-def_eng.h
-lookup_cipher.cpp
+lookup_bc_pad.cpp
+lookup_block.cpp
lookup_hash.cpp
lookup_mac.cpp
lookup_s2k.cpp
-def_pk_ops.cpp
+lookup_stream.cpp
</add>
diff --git a/src/libstate/engine/def_engine/lookup_bc_pad.cpp b/src/libstate/engine/def_engine/lookup_bc_pad.cpp
new file mode 100644
index 000000000..0ed5267f6
--- /dev/null
+++ b/src/libstate/engine/def_engine/lookup_bc_pad.cpp
@@ -0,0 +1,40 @@
+/*************************************************
+* Block Cipher Padding Lookup *
+* (C) 1999-2007 Jack Lloyd *
+*************************************************/
+
+#include <botan/def_eng.h>
+#include <botan/scan_name.h>
+
+#if defined(BOTAN_HAS_CIPHER_MODE_PADDING)
+ #include <botan/mode_pad.h>
+#endif
+
+namespace Botan {
+
+/*************************************************
+* Look for an algorithm with this name *
+*************************************************/
+BlockCipherModePaddingMethod*
+Default_Engine::find_bc_pad(const std::string& algo_spec) const
+ {
+ 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
+
+ return 0;
+ }
+
+}
diff --git a/src/libstate/engine/def_engine/lookup_cipher.cpp b/src/libstate/engine/def_engine/lookup_block.cpp
index bba8a6c3c..00d9ad03c 100644
--- a/src/libstate/engine/def_engine/lookup_cipher.cpp
+++ b/src/libstate/engine/def_engine/lookup_block.cpp
@@ -1,5 +1,5 @@
/*************************************************
-* Cipher Lookup *
+* Block Cipher Lookup *
* (C) 1999-2007 Jack Lloyd *
*************************************************/
@@ -106,26 +106,6 @@
#include <botan/xtea.h>
#endif
-#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
-
-#if defined(BOTAN_HAS_CIPHER_MODE_PADDING)
- #include <botan/mode_pad.h>
-#endif
-
namespace Botan {
/*************************************************
@@ -285,62 +265,4 @@ Default_Engine::find_block_cipher(const std::string& algo_spec) const
return 0;
}
-/*************************************************
-* Look for an algorithm with this name *
-*************************************************/
-StreamCipher*
-Default_Engine::find_stream_cipher(const std::string& algo_spec) const
- {
- SCAN_Name request(algo_spec);
-
-#if defined(BOTAN_HAS_ARC4)
- if(request.algo_name() == "ARC4")
- return new ARC4(request.argument_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;
- }
-
-/*************************************************
-* Look for an algorithm with this name *
-*************************************************/
-BlockCipherModePaddingMethod*
-Default_Engine::find_bc_pad(const std::string& algo_spec) const
- {
- 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
-
- return 0;
- }
-
}
diff --git a/src/libstate/engine/def_engine/lookup_stream.cpp b/src/libstate/engine/def_engine/lookup_stream.cpp
new file mode 100644
index 000000000..a19b6572c
--- /dev/null
+++ b/src/libstate/engine/def_engine/lookup_stream.cpp
@@ -0,0 +1,85 @@
+/*************************************************
+* 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 std::string& algo_spec) const
+ {
+ SCAN_Name request(algo_spec);
+
+#if defined(BOTAN_HAS_ARC4)
+ if(request.algo_name() == "ARC4")
+ return new ARC4(request.argument_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;
+ }
+
+/*************************************************
+* Look for an algorithm with this name *
+*************************************************/
+BlockCipherModePaddingMethod*
+Default_Engine::find_bc_pad(const std::string& algo_spec) const
+ {
+ 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
+
+ return 0;
+ }
+
+}