aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorlloyd <[email protected]>2008-11-10 21:44:39 +0000
committerlloyd <[email protected]>2008-11-10 21:44:39 +0000
commitf144d769db322df4f4c65331951b2ebafdd16f4e (patch)
tree04bdf1ef166687f797d1d7918e148b896141e546
parenta886514a112f32351025454ff2c316ebd17684e2 (diff)
Use Algorithm_Factory instead of lookup in Default_Engine block cipher
and mac tables
-rw-r--r--src/libstate/engine/def_engine/lookup_block.cpp15
-rw-r--r--src/libstate/engine/def_engine/lookup_mac.cpp7
-rw-r--r--src/libstate/libstate.cpp1
3 files changed, 10 insertions, 13 deletions
diff --git a/src/libstate/engine/def_engine/lookup_block.cpp b/src/libstate/engine/def_engine/lookup_block.cpp
index d9da83afd..de4265ba4 100644
--- a/src/libstate/engine/def_engine/lookup_block.cpp
+++ b/src/libstate/engine/def_engine/lookup_block.cpp
@@ -4,10 +4,8 @@
*************************************************/
#include <botan/def_eng.h>
-#include <botan/lookup.h>
#include <botan/scan_name.h>
#include <botan/algo_factory.h>
-#include <memory>
#if defined(BOTAN_HAS_AES)
#include <botan/aes.h>
@@ -253,15 +251,16 @@ Default_Engine::find_block_cipher(const SCAN_Name& request,
{
const u32bit block_size = request.argument_as_u32bit(2, 1024);
- const HashFunction* hash = af.make_hash_function(request.argument(0));
- if(!hash)
- return 0;
+ const HashFunction* hash =
+ af.prototype_hash_function(request.argument(0));
+
+ const StreamCipher* stream_cipher =
+ af.prototype_stream_cipher(request.argument(1));
- std::auto_ptr<StreamCipher> sc(get_stream_cipher(request.argument(1)));
- if(!sc.get())
+ if(!hash || !stream_cipher)
return 0;
- return new Lion(hash->clone(), sc.release(), block_size);
+ return new Lion(hash->clone(), stream_cipher->clone(), block_size);
}
#endif
diff --git a/src/libstate/engine/def_engine/lookup_mac.cpp b/src/libstate/engine/def_engine/lookup_mac.cpp
index 7feda835c..0e826e864 100644
--- a/src/libstate/engine/def_engine/lookup_mac.cpp
+++ b/src/libstate/engine/def_engine/lookup_mac.cpp
@@ -6,7 +6,6 @@
#include <botan/def_eng.h>
#include <botan/scan_name.h>
#include <botan/algo_factory.h>
-#include <botan/lookup.h>
#if defined(BOTAN_HAS_CBC_MAC)
#include <botan/cbc_mac.h>
@@ -40,12 +39,12 @@ Default_Engine::find_mac(const SCAN_Name& request,
#if defined(BOTAN_HAS_CBC_MAC)
if(request.algo_name() == "CBC-MAC" && request.arg_count() == 1)
- return new CBC_MAC(get_block_cipher(request.argument(0)));
+ return new CBC_MAC(af.make_block_cipher(request.argument(0)));
#endif
#if defined(BOTAN_HAS_CMAC)
if(request.algo_name() == "CMAC" && request.arg_count() == 1)
- return new CMAC(get_block_cipher(request.argument(0)));
+ return new CMAC(af.make_block_cipher(request.argument(0)));
#endif
#if defined(BOTAN_HAS_HMAC)
@@ -60,7 +59,7 @@ Default_Engine::find_mac(const SCAN_Name& request,
#if defined(BOTAN_HAS_ANSI_X919_MAC)
if(request.algo_name() == "X9.19-MAC" && request.arg_count() == 0)
- return new ANSI_X919_MAC(get_block_cipher("DES"));
+ return new ANSI_X919_MAC(af.make_block_cipher(SCAN_Name("DES")));
#endif
return 0;
diff --git a/src/libstate/libstate.cpp b/src/libstate/libstate.cpp
index 1b32f2e86..626930e81 100644
--- a/src/libstate/libstate.cpp
+++ b/src/libstate/libstate.cpp
@@ -9,7 +9,6 @@
#include <botan/stl_util.h>
#include <botan/mutex.h>
#include <botan/charset.h>
-#include <botan/lookup.h>
#include <algorithm>
#if defined(BOTAN_HAS_SELFTEST)