aboutsummaryrefslogtreecommitdiffstats
path: root/src/block/lion
diff options
context:
space:
mode:
Diffstat (limited to 'src/block/lion')
-rw-r--r--src/block/lion/lion.cpp20
-rw-r--r--src/block/lion/lion.h4
2 files changed, 13 insertions, 11 deletions
diff --git a/src/block/lion/lion.cpp b/src/block/lion/lion.cpp
index 9214044f6..103759e39 100644
--- a/src/block/lion/lion.cpp
+++ b/src/block/lion/lion.cpp
@@ -33,8 +33,8 @@ void Lion::encrypt_n(const byte in[], byte out[], size_t blocks) const
cipher->set_key(buffer, LEFT_SIZE);
cipher->cipher1(out + LEFT_SIZE, RIGHT_SIZE);
- in += block_size();
- out += block_size();
+ in += BLOCK_SIZE;
+ out += BLOCK_SIZE;
}
}
@@ -60,8 +60,8 @@ void Lion::decrypt_n(const byte in[], byte out[], size_t blocks) const
cipher->set_key(buffer, LEFT_SIZE);
cipher->cipher1(out + LEFT_SIZE, RIGHT_SIZE);
- in += block_size();
- out += block_size();
+ in += BLOCK_SIZE;
+ out += BLOCK_SIZE;
}
}
@@ -83,7 +83,7 @@ std::string Lion::name() const
{
return "Lion(" + hash->name() + "," +
cipher->name() + "," +
- std::to_string(block_size()) + ")";
+ std::to_string(BLOCK_SIZE) + ")";
}
/*
@@ -91,7 +91,7 @@ std::string Lion::name() const
*/
BlockCipher* Lion::clone() const
{
- return new Lion(hash->clone(), cipher->clone(), block_size());
+ return new Lion(hash->clone(), cipher->clone(), BLOCK_SIZE);
}
/*
@@ -109,14 +109,14 @@ void Lion::clear()
* Lion Constructor
*/
Lion::Lion(HashFunction* hash_in, StreamCipher* sc_in, size_t block_len) :
- BlockCipher(std::max<size_t>(2*hash_in->output_length() + 1, block_len),
- 2, 2*hash_in->output_length(), 2),
+ BlockCipher(2, 2*hash_in->output_length(), 2),
+ BLOCK_SIZE(std::max<size_t>(2*hash_in->output_length() + 1, block_len)),
LEFT_SIZE(hash_in->output_length()),
- RIGHT_SIZE(block_size() - LEFT_SIZE),
+ RIGHT_SIZE(BLOCK_SIZE - LEFT_SIZE),
hash(hash_in),
cipher(sc_in)
{
- if(2*LEFT_SIZE + 1 > block_size())
+ if(2*LEFT_SIZE + 1 > BLOCK_SIZE)
throw Invalid_Argument(name() + ": Chosen block size is too small");
if(!cipher->valid_keylength(LEFT_SIZE))
diff --git a/src/block/lion/lion.h b/src/block/lion/lion.h
index 9beb68ca6..d4eb9c327 100644
--- a/src/block/lion/lion.h
+++ b/src/block/lion/lion.h
@@ -28,6 +28,8 @@ class BOTAN_DLL Lion : public BlockCipher
void encrypt_n(const byte in[], byte out[], size_t blocks) const;
void decrypt_n(const byte in[], byte out[], size_t blocks) const;
+ size_t block_size() const { return BLOCK_SIZE; }
+
void clear();
std::string name() const;
BlockCipher* clone() const;
@@ -45,7 +47,7 @@ class BOTAN_DLL Lion : public BlockCipher
private:
void key_schedule(const byte[], size_t);
- const size_t LEFT_SIZE, RIGHT_SIZE;
+ const size_t BLOCK_SIZE, LEFT_SIZE, RIGHT_SIZE;
HashFunction* hash;
StreamCipher* cipher;