aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--checks/dolook.cpp4
-rw-r--r--src/cms/cms_algo.cpp6
-rw-r--r--src/cms/cms_ealg.cpp3
-rw-r--r--src/core/libstate/engine.cpp15
-rw-r--r--src/core/libstate/lookup.h9
-rw-r--r--src/core/selftest/selftest.cpp4
-rw-r--r--src/pbe/pbes1/pbes1.cpp2
-rw-r--r--src/pbe/pbes2/pbes2.cpp2
-rw-r--r--wrappers/boost-python/src/filter.cpp4
9 files changed, 20 insertions, 29 deletions
diff --git a/checks/dolook.cpp b/checks/dolook.cpp
index dd1b22b9f..0c20448af 100644
--- a/checks/dolook.cpp
+++ b/checks/dolook.cpp
@@ -89,9 +89,9 @@ Filter* lookup_cipher(const std::string& algname, const std::string& key,
{
try {
if(encrypt)
- return get_cipher(global_state(), algname, key, iv, ENCRYPTION);
+ return get_cipher(algname, key, iv, ENCRYPTION);
else
- return get_cipher(global_state(), algname, key, iv, DECRYPTION);
+ return get_cipher(algname, key, iv, DECRYPTION);
}
catch(Algorithm_Not_Found) {}
catch(Invalid_Algorithm_Name) {}
diff --git a/src/cms/cms_algo.cpp b/src/cms/cms_algo.cpp
index 13b794352..cc675936a 100644
--- a/src/cms/cms_algo.cpp
+++ b/src/cms/cms_algo.cpp
@@ -52,11 +52,9 @@ SecureVector<byte> do_rfc3217_wrap(RandomNumberGenerator& rng,
InitializationVector iv(rng, 8);
InitializationVector fixed("4ADDA22C79E82105");
- Pipe pipe(get_cipher(global_state(),
- cipher + "/CBC/NoPadding", kek, iv, ENCRYPTION),
+ Pipe pipe(get_cipher(cipher + "/CBC/NoPadding", kek, iv, ENCRYPTION),
new Flip_Bytes(iv.bits_of()),
- get_cipher(global_state(),
- cipher + "/CBC/NoPadding", kek, fixed, ENCRYPTION));
+ get_cipher(cipher + "/CBC/NoPadding", kek, fixed, ENCRYPTION));
pipe.start_msg();
pipe.write(input);
pipe.write(icv.read_all());
diff --git a/src/cms/cms_ealg.cpp b/src/cms/cms_ealg.cpp
index 148374272..32de548b8 100644
--- a/src/cms/cms_ealg.cpp
+++ b/src/cms/cms_ealg.cpp
@@ -261,8 +261,7 @@ SecureVector<byte> CMS_Encoder::do_encrypt(RandomNumberGenerator& rng,
content_cipher.oid = OIDS::lookup(cipher + "/CBC");
content_cipher.parameters = encode_params(cipher, key, iv);
- Pipe pipe(get_cipher(global_state(),
- cipher + "/CBC/PKCS7", key, iv, ENCRYPTION));
+ Pipe pipe(get_cipher(cipher + "/CBC/PKCS7", key, iv, ENCRYPTION));
pipe.process_msg(data);
DER_Encoder encoder;
diff --git a/src/core/libstate/engine.cpp b/src/core/libstate/engine.cpp
index 4f58fb040..44c3ae5e5 100644
--- a/src/core/libstate/engine.cpp
+++ b/src/core/libstate/engine.cpp
@@ -383,11 +383,10 @@ void add_algorithm(Library_State& libstate,
/*************************************************
* Get a cipher object *
*************************************************/
-Keyed_Filter* get_cipher(Library_State& libstate,
- const std::string& algo_spec,
+Keyed_Filter* get_cipher(const std::string& algo_spec,
Cipher_Dir direction)
{
- Library_State::Engine_Iterator i(libstate);
+ Library_State::Engine_Iterator i(global_state());
while(Engine* engine = i.next())
{
@@ -402,13 +401,12 @@ Keyed_Filter* get_cipher(Library_State& libstate,
/*************************************************
* Get a cipher object *
*************************************************/
-Keyed_Filter* get_cipher(Library_State& libstate,
- const std::string& algo_spec,
+Keyed_Filter* get_cipher(const std::string& algo_spec,
const SymmetricKey& key,
const InitializationVector& iv,
Cipher_Dir direction)
{
- Keyed_Filter* cipher = get_cipher(libstate, algo_spec, direction);
+ Keyed_Filter* cipher = get_cipher(algo_spec, direction);
cipher->set_key(key);
if(iv.length())
@@ -420,12 +418,11 @@ Keyed_Filter* get_cipher(Library_State& libstate,
/*************************************************
* Get a cipher object *
*************************************************/
-Keyed_Filter* get_cipher(Library_State& libstate,
- const std::string& algo_spec,
+Keyed_Filter* get_cipher(const std::string& algo_spec,
const SymmetricKey& key,
Cipher_Dir direction)
{
- return get_cipher(libstate, algo_spec,
+ return get_cipher(algo_spec,
key, InitializationVector(), direction);
}
diff --git a/src/core/libstate/lookup.h b/src/core/libstate/lookup.h
index 016ad4618..f60104d32 100644
--- a/src/core/libstate/lookup.h
+++ b/src/core/libstate/lookup.h
@@ -58,19 +58,16 @@ BOTAN_DLL KDF* get_kdf(const std::string&);
/*************************************************
* Get a cipher object *
*************************************************/
-BOTAN_DLL Keyed_Filter* get_cipher(Library_State&,
- const std::string&,
+BOTAN_DLL Keyed_Filter* get_cipher(const std::string&,
const SymmetricKey&,
const InitializationVector&,
Cipher_Dir);
-BOTAN_DLL Keyed_Filter* get_cipher(Library_State&,
- const std::string&,
+BOTAN_DLL Keyed_Filter* get_cipher(const std::string&,
const SymmetricKey&,
Cipher_Dir);
-BOTAN_DLL Keyed_Filter* get_cipher(Library_State&,
- const std::string&, Cipher_Dir);
+BOTAN_DLL Keyed_Filter* get_cipher(const std::string&, Cipher_Dir);
/*************************************************
* Check to see if an algorithm exists *
diff --git a/src/core/selftest/selftest.cpp b/src/core/selftest/selftest.cpp
index 0dede1c9d..ad965fb79 100644
--- a/src/core/selftest/selftest.cpp
+++ b/src/core/selftest/selftest.cpp
@@ -35,9 +35,9 @@ void cipher_kat(const std::string& in, const std::string& out,
const std::string& cipher)
{
do_kat(in, out, cipher,
- get_cipher(global_state(), cipher, key, iv, ENCRYPTION));
+ get_cipher(cipher, key, iv, ENCRYPTION));
do_kat(out, in, cipher,
- get_cipher(global_state(), cipher, key, iv, DECRYPTION));
+ get_cipher(cipher, key, iv, DECRYPTION));
}
/*************************************************
diff --git a/src/pbe/pbes1/pbes1.cpp b/src/pbe/pbes1/pbes1.cpp
index 8bbd079c4..cdcc78148 100644
--- a/src/pbe/pbes1/pbes1.cpp
+++ b/src/pbe/pbes1/pbes1.cpp
@@ -33,7 +33,7 @@ void PBE_PKCS5v15::write(const byte input[], u32bit length)
*************************************************/
void PBE_PKCS5v15::start_msg()
{
- pipe.append(get_cipher(global_state(), cipher, key, iv, direction));
+ pipe.append(get_cipher(cipher, key, iv, direction));
pipe.start_msg();
if(pipe.message_count() > 1)
pipe.set_default_msg(pipe.default_msg() + 1);
diff --git a/src/pbe/pbes2/pbes2.cpp b/src/pbe/pbes2/pbes2.cpp
index cf451d695..136ebc393 100644
--- a/src/pbe/pbes2/pbes2.cpp
+++ b/src/pbe/pbes2/pbes2.cpp
@@ -35,7 +35,7 @@ void PBE_PKCS5v20::write(const byte input[], u32bit length)
*************************************************/
void PBE_PKCS5v20::start_msg()
{
- pipe.append(get_cipher(global_state(), cipher, key, iv, direction));
+ pipe.append(get_cipher(cipher, key, iv, direction));
pipe.start_msg();
if(pipe.message_count() > 1)
pipe.set_default_msg(pipe.default_msg() + 1);
diff --git a/wrappers/boost-python/src/filter.cpp b/wrappers/boost-python/src/filter.cpp
index 262622eef..830e090de 100644
--- a/wrappers/boost-python/src/filter.cpp
+++ b/wrappers/boost-python/src/filter.cpp
@@ -93,7 +93,7 @@ Filter* make_filter3(const std::string& name,
Cipher_Dir direction)
{
return return_or_raise(
- get_cipher(global_state(), name, key, direction),
+ get_cipher(name, key, direction),
name);
}
@@ -103,7 +103,7 @@ Filter* make_filter4(const std::string& name,
Cipher_Dir direction)
{
return return_or_raise(
- get_cipher(global_state(), name, key, iv, direction),
+ get_cipher(name, key, iv, direction),
name);
}