diff options
author | lloyd <[email protected]> | 2007-09-17 01:52:06 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2007-09-17 01:52:06 +0000 |
commit | d26702d8bba6004af334dc19e277dc3b41e1c7c8 (patch) | |
tree | 68a302f503d55eb82c6967599abf2e98730bd673 /src | |
parent | 22c9e2330cdf0030222aa2aafb5b8de4aebb707a (diff) |
Use the OUTPUT_LENGTH constant instead of assuming the block size of the cipher
is 64 bits.
Diffstat (limited to 'src')
-rw-r--r-- | src/cbc_mac.cpp | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/src/cbc_mac.cpp b/src/cbc_mac.cpp index e805c2aa7..ff2347497 100644 --- a/src/cbc_mac.cpp +++ b/src/cbc_mac.cpp @@ -15,21 +15,22 @@ namespace Botan { *************************************************/ void CBC_MAC::add_data(const byte input[], u32bit length) { - u32bit xored = std::min(8 - position, length); + u32bit xored = std::min(OUTPUT_LENGTH - position, length); xor_buf(state + position, input, xored); position += xored; - if(position < 8) return; + if(position < OUTPUT_LENGTH) + return; e->encrypt(state); input += xored; length -= xored; - while(length >= 8) + while(length >= OUTPUT_LENGTH) { - xor_buf(state, input, 8); + xor_buf(state, input, OUTPUT_LENGTH); e->encrypt(state); - input += 8; - length -= 8; + input += OUTPUT_LENGTH; + length -= OUTPUT_LENGTH; } xor_buf(state, input, length); |