diff options
author | lloyd <[email protected]> | 2010-10-13 02:45:00 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2010-10-13 02:45:00 +0000 |
commit | 63121e1e169616f724bf79b8aac1a2b4423c8904 (patch) | |
tree | 2375d5b5daaad8990b2cee951d137f2e7638e79b /src/mac | |
parent | 879d062c2b93e32362e338d1c6f9b1eda0f88493 (diff) |
Use output_length() instead of OUTPUT_LENGTH pseudo-property
Diffstat (limited to 'src/mac')
-rw-r--r-- | src/mac/cbc_mac/cbc_mac.cpp | 12 | ||||
-rw-r--r-- | src/mac/cmac/cmac.cpp | 32 | ||||
-rw-r--r-- | src/mac/hmac/hmac.cpp | 4 | ||||
-rw-r--r-- | src/mac/ssl3mac/ssl3_mac.cpp | 6 |
4 files changed, 27 insertions, 27 deletions
diff --git a/src/mac/cbc_mac/cbc_mac.cpp b/src/mac/cbc_mac/cbc_mac.cpp index 2a5a6c10f..3eaa115b8 100644 --- a/src/mac/cbc_mac/cbc_mac.cpp +++ b/src/mac/cbc_mac/cbc_mac.cpp @@ -16,22 +16,22 @@ namespace Botan { */ void CBC_MAC::add_data(const byte input[], size_t length) { - size_t xored = std::min(OUTPUT_LENGTH - position, length); + size_t xored = std::min(output_length() - position, length); xor_buf(&state[position], input, xored); position += xored; - if(position < OUTPUT_LENGTH) + if(position < output_length()) return; e->encrypt(state); input += xored; length -= xored; - while(length >= OUTPUT_LENGTH) + while(length >= output_length()) { - xor_buf(state, input, OUTPUT_LENGTH); + xor_buf(state, input, output_length()); e->encrypt(state); - input += OUTPUT_LENGTH; - length -= OUTPUT_LENGTH; + input += output_length(); + length -= output_length(); } xor_buf(state, input, length); diff --git a/src/mac/cmac/cmac.cpp b/src/mac/cmac/cmac.cpp index 05f487ad1..a4a9394ae 100644 --- a/src/mac/cmac/cmac.cpp +++ b/src/mac/cmac/cmac.cpp @@ -40,18 +40,18 @@ SecureVector<byte> CMAC::poly_double(const MemoryRegion<byte>& in, void CMAC::add_data(const byte input[], size_t length) { buffer.copy(position, input, length); - if(position + length > OUTPUT_LENGTH) + if(position + length > output_length()) { - xor_buf(state, buffer, OUTPUT_LENGTH); + xor_buf(state, buffer, output_length()); e->encrypt(state); - input += (OUTPUT_LENGTH - position); - length -= (OUTPUT_LENGTH - position); - while(length > OUTPUT_LENGTH) + input += (output_length() - position); + length -= (output_length() - position); + while(length > output_length()) { - xor_buf(state, input, OUTPUT_LENGTH); + xor_buf(state, input, output_length()); e->encrypt(state); - input += OUTPUT_LENGTH; - length -= OUTPUT_LENGTH; + input += output_length(); + length -= output_length(); } buffer.copy(input, length); position = 0; @@ -66,19 +66,19 @@ void CMAC::final_result(byte mac[]) { xor_buf(state, buffer, position); - if(position == OUTPUT_LENGTH) + if(position == output_length()) { - xor_buf(state, B, OUTPUT_LENGTH); + xor_buf(state, B, output_length()); } else { state[position] ^= 0x80; - xor_buf(state, P, OUTPUT_LENGTH); + xor_buf(state, P, output_length()); } e->encrypt(state); - for(size_t i = 0; i != OUTPUT_LENGTH; ++i) + for(size_t i = 0; i != output_length(); ++i) mac[i] = state[i]; zeroise(state); @@ -144,10 +144,10 @@ CMAC::CMAC(BlockCipher* e_in) : else throw Invalid_Argument("CMAC cannot use the cipher " + e->name()); - state.resize(OUTPUT_LENGTH); - buffer.resize(OUTPUT_LENGTH); - B.resize(OUTPUT_LENGTH); - P.resize(OUTPUT_LENGTH); + state.resize(output_length()); + buffer.resize(output_length()); + B.resize(output_length()); + P.resize(output_length()); position = 0; } diff --git a/src/mac/hmac/hmac.cpp b/src/mac/hmac/hmac.cpp index dfd800426..90da24eaf 100644 --- a/src/mac/hmac/hmac.cpp +++ b/src/mac/hmac/hmac.cpp @@ -26,7 +26,7 @@ void HMAC::final_result(byte mac[]) { hash->final(mac); hash->update(o_key); - hash->update(mac, OUTPUT_LENGTH); + hash->update(mac, output_length()); hash->final(mac); hash->update(i_key); } @@ -85,7 +85,7 @@ MessageAuthenticationCode* HMAC::clone() const * HMAC Constructor */ HMAC::HMAC(HashFunction* hash_in) : - MessageAuthenticationCode(hash_in->OUTPUT_LENGTH, + MessageAuthenticationCode(hash_in->output_length(), 0, 2*hash_in->HASH_BLOCK_SIZE), hash(hash_in) { diff --git a/src/mac/ssl3mac/ssl3_mac.cpp b/src/mac/ssl3mac/ssl3_mac.cpp index ac71be43c..e29770bde 100644 --- a/src/mac/ssl3mac/ssl3_mac.cpp +++ b/src/mac/ssl3mac/ssl3_mac.cpp @@ -24,7 +24,7 @@ void SSL3_MAC::final_result(byte mac[]) { hash->final(mac); hash->update(o_key); - hash->update(mac, OUTPUT_LENGTH); + hash->update(mac, output_length()); hash->final(mac); hash->update(i_key); } @@ -73,8 +73,8 @@ MessageAuthenticationCode* SSL3_MAC::clone() const * SSL3-MAC Constructor */ SSL3_MAC::SSL3_MAC(HashFunction* hash_in) : - MessageAuthenticationCode(hash_in->OUTPUT_LENGTH, - hash_in->OUTPUT_LENGTH), + MessageAuthenticationCode(hash_in->output_length(), + hash_in->output_length()), hash(hash_in) { if(hash->HASH_BLOCK_SIZE == 0) |