diff options
author | lloyd <[email protected]> | 2010-10-12 19:41:37 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2010-10-12 19:41:37 +0000 |
commit | ff2210b035a1598bf99e18a578ff075bece8fbe5 (patch) | |
tree | 4efe3a23daac9e2cd8b9f2b794d95089ba4cdfb2 /src/block/cascade | |
parent | e7e3af16a3540e1d7a84e085aa1ea7c55f627930 (diff) |
Use size_t rather than u32bit for the blocks argument of encrypt_n
Diffstat (limited to 'src/block/cascade')
-rw-r--r-- | src/block/cascade/cascade.cpp | 20 | ||||
-rw-r--r-- | src/block/cascade/cascade.h | 4 |
2 files changed, 12 insertions, 12 deletions
diff --git a/src/block/cascade/cascade.cpp b/src/block/cascade/cascade.cpp index f72ef7b76..e93e81d33 100644 --- a/src/block/cascade/cascade.cpp +++ b/src/block/cascade/cascade.cpp @@ -10,20 +10,20 @@ 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); @@ -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; } diff --git a/src/block/cascade/cascade.h b/src/block/cascade/cascade.h index abd9b015d..6e9d43cf7 100644 --- a/src/block/cascade/cascade.h +++ b/src/block/cascade/cascade.h @@ -18,8 +18,8 @@ namespace Botan { class BOTAN_DLL Cascade_Cipher : public BlockCipher { public: - void encrypt_n(const byte in[], byte out[], u32bit blocks) const; - void decrypt_n(const byte in[], byte out[], u32bit blocks) const; + void encrypt_n(const byte in[], byte out[], size_t blocks) const; + void decrypt_n(const byte in[], byte out[], size_t blocks) const; void clear(); std::string name() const; |