diff options
author | lloyd <[email protected]> | 2010-01-27 04:15:02 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2010-01-27 04:15:02 +0000 |
commit | 27c85e67018641394bc6ec3c728a21f03be2f0dc (patch) | |
tree | 601c40b845b3348730affe2258eca627ca6280ec | |
parent | 9a75697edcf97b16c98cc03446553616e8ddcde1 (diff) |
Remove debug check
-rw-r--r-- | src/filters/modes/xts/xts.cpp | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/src/filters/modes/xts/xts.cpp b/src/filters/modes/xts/xts.cpp index 68eb0c482..aeef4e88d 100644 --- a/src/filters/modes/xts/xts.cpp +++ b/src/filters/modes/xts/xts.cpp @@ -185,9 +185,6 @@ void XTS_Encryption::buffered_final(const byte input[], u32bit length) input += leftover_blocks; length -= leftover_blocks; - if(length >= 2*cipher->BLOCK_SIZE) - throw std::runtime_error("Die vampire die"); - SecureVector<byte> temp(input, length); xor_buf(temp, tweak, cipher->BLOCK_SIZE); @@ -214,9 +211,12 @@ void XTS_Encryption::buffered_final(const byte input[], u32bit length) */ XTS_Decryption::XTS_Decryption(BlockCipher* ciph) : Buffered_Filter(BOTAN_PARALLEL_BLOCKS_XTS * ciph->BLOCK_SIZE, - ciph->BLOCK_SIZE + 1) + ciph->BLOCK_SIZE + 1), + cipher(ciph) { - cipher = ciph; + if(cipher->BLOCK_SIZE != 8 && cipher->BLOCK_SIZE != 16) + throw std::invalid_argument("Bad cipher for XTS: " + cipher->name()); + cipher2 = ciph->clone(); tweak.resize(BOTAN_PARALLEL_BLOCKS_XTS * cipher->BLOCK_SIZE); } @@ -228,9 +228,12 @@ XTS_Decryption::XTS_Decryption(BlockCipher* ciph, const SymmetricKey& key, const InitializationVector& iv) : Buffered_Filter(BOTAN_PARALLEL_BLOCKS_XTS * ciph->BLOCK_SIZE, - ciph->BLOCK_SIZE + 1) + ciph->BLOCK_SIZE + 1), + cipher(ciph) { - cipher = ciph; + if(cipher->BLOCK_SIZE != 8 && cipher->BLOCK_SIZE != 16) + throw std::invalid_argument("Bad cipher for XTS: " + cipher->name()); + cipher2 = ciph->clone(); tweak.resize(BOTAN_PARALLEL_BLOCKS_XTS * cipher->BLOCK_SIZE); |