aboutsummaryrefslogtreecommitdiffstats
path: root/src/engine
diff options
context:
space:
mode:
authorlloyd <[email protected]>2011-12-18 01:19:25 +0000
committerlloyd <[email protected]>2011-12-18 01:19:25 +0000
commit8809043895d1d4cf37ff476cb69c9277b33cc957 (patch)
tree72ca6a117cce901c9a36631422b1a7e5d88e1aac /src/engine
parent5a76eb4c07f0caedde1a3d1d2824f2764a46a582 (diff)
parenta3d81efbd2c56749d4abf9e6a27cb36cbbb10702 (diff)
propagate from branch 'net.randombit.botan' (head 39f53266912f33dc48e942b1b865ddcd6af66d8d)
to branch 'net.randombit.botan.cxx11' (head 0bf26cec09f71e75c547b4ec53365748c6d80d86)
Diffstat (limited to 'src/engine')
-rw-r--r--src/engine/core_engine/core_modes.cpp14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/engine/core_engine/core_modes.cpp b/src/engine/core_engine/core_modes.cpp
index 035cd41c7..8a929e880 100644
--- a/src/engine/core_engine/core_modes.cpp
+++ b/src/engine/core_engine/core_modes.cpp
@@ -1,6 +1,6 @@
/*
* Core Engine
-* (C) 1999-2007 Jack Lloyd
+* (C) 1999-2007,2011 Jack Lloyd
*
* Distributed under the terms of the Botan license
*/
@@ -179,8 +179,8 @@ Keyed_Filter* get_cipher_mode(const BlockCipher* block_cipher,
* Get a cipher object
*/
Keyed_Filter* Core_Engine::get_cipher(const std::string& algo_spec,
- Cipher_Dir direction,
- Algorithm_Factory& af)
+ Cipher_Dir direction,
+ Algorithm_Factory& af)
{
std::vector<std::string> algo_parts = split_on(algo_spec, '/');
if(algo_parts.empty())
@@ -197,8 +197,12 @@ Keyed_Filter* Core_Engine::get_cipher(const std::string& algo_spec,
if(!block_cipher)
return 0;
- if(algo_parts.size() != 2 && algo_parts.size() != 3)
- return 0;
+ if(algo_parts.size() >= 4)
+ return 0; // 4 part mode, not something we know about
+
+ if(algo_parts.size() < 2)
+ throw Lookup_Error("Cipher specification '" + algo_spec +
+ "' is missing mode identifier");
std::string mode = algo_parts[1];