aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/block/cascade/cascade.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/block/cascade/cascade.cpp')
-rw-r--r--src/lib/block/cascade/cascade.cpp42
1 files changed, 18 insertions, 24 deletions
diff --git a/src/lib/block/cascade/cascade.cpp b/src/lib/block/cascade/cascade.cpp
index f1b1a8f2c..67846204d 100644
--- a/src/lib/block/cascade/cascade.cpp
+++ b/src/lib/block/cascade/cascade.cpp
@@ -12,46 +12,46 @@ namespace Botan {
void Cascade_Cipher::encrypt_n(const byte in[], byte out[],
size_t blocks) const
{
- size_t c1_blocks = blocks * (block_size() / cipher1->block_size());
- size_t c2_blocks = blocks * (block_size() / cipher2->block_size());
+ size_t c1_blocks = blocks * (block_size() / m_cipher1->block_size());
+ size_t c2_blocks = blocks * (block_size() / m_cipher2->block_size());
- cipher1->encrypt_n(in, out, c1_blocks);
- cipher2->encrypt_n(out, out, c2_blocks);
+ m_cipher1->encrypt_n(in, out, c1_blocks);
+ m_cipher2->encrypt_n(out, out, c2_blocks);
}
void Cascade_Cipher::decrypt_n(const byte in[], byte out[],
size_t blocks) const
{
- size_t c1_blocks = blocks * (block_size() / cipher1->block_size());
- size_t c2_blocks = blocks * (block_size() / cipher2->block_size());
+ size_t c1_blocks = blocks * (block_size() / m_cipher1->block_size());
+ size_t c2_blocks = blocks * (block_size() / m_cipher2->block_size());
- cipher2->decrypt_n(in, out, c2_blocks);
- cipher1->decrypt_n(out, out, c1_blocks);
+ m_cipher2->decrypt_n(in, out, c2_blocks);
+ m_cipher1->decrypt_n(out, out, c1_blocks);
}
void Cascade_Cipher::key_schedule(const byte key[], size_t)
{
- const byte* key2 = key + cipher1->maximum_keylength();
+ const byte* key2 = key + m_cipher1->maximum_keylength();
- cipher1->set_key(key , cipher1->maximum_keylength());
- cipher2->set_key(key2, cipher2->maximum_keylength());
+ m_cipher1->set_key(key , m_cipher1->maximum_keylength());
+ m_cipher2->set_key(key2, m_cipher2->maximum_keylength());
}
void Cascade_Cipher::clear()
{
- cipher1->clear();
- cipher2->clear();
+ m_cipher1->clear();
+ m_cipher2->clear();
}
std::string Cascade_Cipher::name() const
{
- return "Cascade(" + cipher1->name() + "," + cipher2->name() + ")";
+ return "Cascade(" + m_cipher1->name() + "," + m_cipher2->name() + ")";
}
BlockCipher* Cascade_Cipher::clone() const
{
- return new Cascade_Cipher(cipher1->clone(),
- cipher2->clone());
+ return new Cascade_Cipher(m_cipher1->clone(),
+ m_cipher2->clone());
}
namespace {
@@ -81,18 +81,12 @@ size_t block_size_for_cascade(size_t bs, size_t bs2)
}
Cascade_Cipher::Cascade_Cipher(BlockCipher* c1, BlockCipher* c2) :
- cipher1(c1), cipher2(c2)
+ m_cipher1(c1), m_cipher2(c2)
{
- block = block_size_for_cascade(c1->block_size(), c2->block_size());
+ m_block = block_size_for_cascade(c1->block_size(), c2->block_size());
if(block_size() % c1->block_size() || block_size() % c2->block_size())
throw Internal_Error("Failure in " + name() + " constructor");
}
-Cascade_Cipher::~Cascade_Cipher()
- {
- delete cipher1;
- delete cipher2;
- }
-
}