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/cmac/cmac.cpp | |
parent | 879d062c2b93e32362e338d1c6f9b1eda0f88493 (diff) |
Use output_length() instead of OUTPUT_LENGTH pseudo-property
Diffstat (limited to 'src/mac/cmac/cmac.cpp')
-rw-r--r-- | src/mac/cmac/cmac.cpp | 32 |
1 files changed, 16 insertions, 16 deletions
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; } |