diff options
Diffstat (limited to 'src/block/cascade/cascade.cpp')
-rw-r--r-- | src/block/cascade/cascade.cpp | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/src/block/cascade/cascade.cpp b/src/block/cascade/cascade.cpp index f72ef7b76..225b7fd6e 100644 --- a/src/block/cascade/cascade.cpp +++ b/src/block/cascade/cascade.cpp @@ -10,26 +10,26 @@ namespace Botan { void Cascade_Cipher::encrypt_n(const byte in[], byte out[], - u32bit blocks) const + size_t blocks) const { - u32bit c1_blocks = blocks * (BLOCK_SIZE / cipher1->BLOCK_SIZE); - u32bit c2_blocks = blocks * (BLOCK_SIZE / cipher2->BLOCK_SIZE); + size_t c1_blocks = blocks * (block_size() / cipher1->block_size()); + size_t c2_blocks = blocks * (block_size() / cipher2->block_size()); cipher1->encrypt_n(in, out, c1_blocks); cipher2->encrypt_n(out, out, c2_blocks); } void Cascade_Cipher::decrypt_n(const byte in[], byte out[], - u32bit blocks) const + size_t blocks) const { - u32bit c1_blocks = blocks * (BLOCK_SIZE / cipher1->BLOCK_SIZE); - u32bit c2_blocks = blocks * (BLOCK_SIZE / cipher2->BLOCK_SIZE); + size_t c1_blocks = blocks * (block_size() / cipher1->block_size()); + size_t c2_blocks = blocks * (block_size() / cipher2->block_size()); cipher2->decrypt_n(in, out, c2_blocks); cipher1->decrypt_n(out, out, c1_blocks); } -void Cascade_Cipher::key_schedule(const byte key[], u32bit) +void Cascade_Cipher::key_schedule(const byte key[], size_t) { const byte* key2 = key + cipher1->MAXIMUM_KEYLENGTH; @@ -56,11 +56,11 @@ BlockCipher* Cascade_Cipher::clone() const namespace { -u32bit euclids_algorithm(u32bit a, u32bit b) +size_t euclids_algorithm(size_t a, size_t b) { while(b != 0) // gcd { - u32bit t = b; + size_t t = b; b = a % b; a = t; } @@ -68,12 +68,12 @@ u32bit euclids_algorithm(u32bit a, u32bit b) return a; } -u32bit block_size_for_cascade(u32bit bs, u32bit bs2) +size_t block_size_for_cascade(size_t bs, size_t bs2) { if(bs == bs2) return bs; - u32bit gcd = euclids_algorithm(bs, bs2); + size_t gcd = euclids_algorithm(bs, bs2); return (bs * bs2) / gcd; } @@ -81,11 +81,11 @@ u32bit block_size_for_cascade(u32bit bs, u32bit bs2) } Cascade_Cipher::Cascade_Cipher(BlockCipher* c1, BlockCipher* c2) : - BlockCipher(block_size_for_cascade(c1->BLOCK_SIZE, c2->BLOCK_SIZE), + BlockCipher(block_size_for_cascade(c1->block_size(), c2->block_size()), c1->MAXIMUM_KEYLENGTH + c2->MAXIMUM_KEYLENGTH), cipher1(c1), cipher2(c2) { - if(BLOCK_SIZE % c1->BLOCK_SIZE || BLOCK_SIZE % c2->BLOCK_SIZE) + if(block_size() % c1->block_size() || block_size() % c2->block_size()) throw Internal_Error("Failure in " + name() + " constructor"); } |