diff options
Diffstat (limited to 'src/lib/stream/stream_cipher.cpp')
-rw-r--r-- | src/lib/stream/stream_cipher.cpp | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/lib/stream/stream_cipher.cpp b/src/lib/stream/stream_cipher.cpp index f33d68296..c0e75c0a8 100644 --- a/src/lib/stream/stream_cipher.cpp +++ b/src/lib/stream/stream_cipher.cpp @@ -44,12 +44,16 @@ std::unique_ptr<StreamCipher> StreamCipher::create(const std::string& algo_spec, const SCAN_Name req(algo_spec); #if defined(BOTAN_HAS_CTR_BE) - if(req.algo_name() == "CTR-BE" && req.arg_count() == 1) + if((req.algo_name() == "CTR-BE" || req.algo_name() == "CTR") && req.arg_count_between(1,2)) { if(provider.empty() || provider == "base") { - if(auto c = BlockCipher::create(req.arg(0))) - return std::unique_ptr<StreamCipher>(new CTR_BE(c.release())); + auto cipher = BlockCipher::create(req.arg(0)); + if(cipher) + { + size_t ctr_size = req.arg_as_integer(1, cipher->block_size()); + return std::unique_ptr<StreamCipher>(new CTR_BE(cipher.release(), ctr_size)); + } } } #endif |