diff options
author | lloyd <[email protected]> | 2008-10-08 18:33:00 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2008-10-08 18:33:00 +0000 |
commit | a404bec44f5c702b0a8a469c8d458856982b293e (patch) | |
tree | 9a856c4c3247da0d6d2920a98968beaac3ad4895 /src | |
parent | 39f4e9e848bac1b26f3ce6a55d95564b44274c35 (diff) |
Correct Lion constructor (would access unset pointer)
Diffstat (limited to 'src')
-rw-r--r-- | src/cipher/lion/lion.cpp | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/cipher/lion/lion.cpp b/src/cipher/lion/lion.cpp index c5d6fc9de..629badd3d 100644 --- a/src/cipher/lion/lion.cpp +++ b/src/cipher/lion/lion.cpp @@ -93,9 +93,12 @@ void Lion::clear() throw() * Lion Constructor * *************************************************/ Lion::Lion(HashFunction* hash_in, StreamCipher* sc_in, u32bit block_len) : - BlockCipher(block_len, 2, 2*hash_in->OUTPUT_LENGTH, 2), - LEFT_SIZE(hash->OUTPUT_LENGTH), RIGHT_SIZE(BLOCK_SIZE - LEFT_SIZE), - hash(hash_in), cipher(sc_in) + BlockCipher(std::max<u32bit>(2*hash_in->OUTPUT_LENGTH + 1, block_len), + 2, 2*hash_in->OUTPUT_LENGTH, 2), + LEFT_SIZE(hash_in->OUTPUT_LENGTH), + RIGHT_SIZE(BLOCK_SIZE - LEFT_SIZE), + hash(hash_in), + cipher(sc_in) { if(2*LEFT_SIZE + 1 > BLOCK_SIZE) throw Invalid_Argument(name() + ": Chosen block size is too small"); |