From 3697dcff8b5e9765b41114281ce10e7ed3d3abb4 Mon Sep 17 00:00:00 2001 From: lloyd Date: Wed, 13 Oct 2010 02:56:03 +0000 Subject: s/BLOCK_SIZE/block_size()/ --- src/stream/ctr/ctr.cpp | 15 ++++++++------- src/stream/ctr/ctr.h | 2 +- src/stream/ofb/ofb.cpp | 2 +- src/stream/ofb/ofb.h | 2 +- 4 files changed, 11 insertions(+), 10 deletions(-) (limited to 'src/stream') diff --git a/src/stream/ctr/ctr.cpp b/src/stream/ctr/ctr.cpp index 0a962bd5a..dc2f334a8 100644 --- a/src/stream/ctr/ctr.cpp +++ b/src/stream/ctr/ctr.cpp @@ -89,7 +89,7 @@ void CTR_BE::set_iv(const byte iv[], size_t iv_len) if(!valid_iv_length(iv_len)) throw Invalid_IV_Length(name(), iv_len); - const size_t BLOCK_SIZE = permutation->BLOCK_SIZE; + const size_t BLOCK_SIZE = permutation->block_size(); zeroise(counter); @@ -117,21 +117,22 @@ void CTR_BE::set_iv(const byte iv[], size_t iv_len) */ void CTR_BE::increment_counter() { - const size_t PARALLEL_BLOCKS = counter.size() / permutation->BLOCK_SIZE; + const size_t BLOCK_SIZE = permutation->block_size(); + const size_t PARALLEL_BLOCKS = counter.size() / BLOCK_SIZE; for(size_t i = 0; i != PARALLEL_BLOCKS; ++i) { - byte* this_ctr = &counter[i * permutation->BLOCK_SIZE]; + byte* this_ctr = &counter[i * BLOCK_SIZE]; - byte last_byte = this_ctr[permutation->BLOCK_SIZE-1]; + byte last_byte = this_ctr[BLOCK_SIZE-1]; last_byte += PARALLEL_BLOCKS; - if(this_ctr[permutation->BLOCK_SIZE-1] > last_byte) - for(s32bit j = permutation->BLOCK_SIZE - 2; j >= 0; --j) + if(this_ctr[BLOCK_SIZE-1] > last_byte) + for(s32bit j = BLOCK_SIZE - 2; j >= 0; --j) if(++this_ctr[j]) break; - this_ctr[permutation->BLOCK_SIZE-1] = last_byte; + this_ctr[BLOCK_SIZE-1] = last_byte; } permutation->encrypt_n(&counter[0], &buffer[0], PARALLEL_BLOCKS); diff --git a/src/stream/ctr/ctr.h b/src/stream/ctr/ctr.h index 8c317acb0..e62ab2860 100644 --- a/src/stream/ctr/ctr.h +++ b/src/stream/ctr/ctr.h @@ -24,7 +24,7 @@ class BOTAN_DLL CTR_BE : public StreamCipher void set_iv(const byte iv[], size_t iv_len); bool valid_iv_length(size_t iv_len) const - { return (iv_len <= permutation->BLOCK_SIZE); } + { return (iv_len <= permutation->block_size()); } std::string name() const; diff --git a/src/stream/ofb/ofb.cpp b/src/stream/ofb/ofb.cpp index 921401d32..1f25c5c14 100644 --- a/src/stream/ofb/ofb.cpp +++ b/src/stream/ofb/ofb.cpp @@ -21,7 +21,7 @@ OFB::OFB(BlockCipher* ciph) : permutation(ciph) { position = 0; - buffer.resize(permutation->BLOCK_SIZE); + buffer.resize(permutation->block_size()); } /* diff --git a/src/stream/ofb/ofb.h b/src/stream/ofb/ofb.h index af771de15..587a30bab 100644 --- a/src/stream/ofb/ofb.h +++ b/src/stream/ofb/ofb.h @@ -24,7 +24,7 @@ class BOTAN_DLL OFB : public StreamCipher void set_iv(const byte iv[], size_t iv_len); bool valid_iv_length(size_t iv_len) const - { return (iv_len <= permutation->BLOCK_SIZE); } + { return (iv_len <= permutation->block_size()); } std::string name() const; -- cgit v1.2.3