aboutsummaryrefslogtreecommitdiffstats
path: root/src/block
diff options
context:
space:
mode:
authorlloyd <[email protected]>2010-09-14 01:31:38 +0000
committerlloyd <[email protected]>2010-09-14 01:31:38 +0000
commit59a9b0ef260b010606edc3384035b6aa12dd6415 (patch)
tree6d643130be0e6eac2d8120da90ad03a3b5cdff4e /src/block
parentae59295ea945fdcc482df2233409a5f878fa20c7 (diff)
Handle the case that container size() returns something other than u32bit
Diffstat (limited to 'src/block')
-rw-r--r--src/block/rc5/rc5.cpp3
-rw-r--r--src/block/rc6/rc6.cpp2
2 files changed, 3 insertions, 2 deletions
diff --git a/src/block/rc5/rc5.cpp b/src/block/rc5/rc5.cpp
index ded0f961d..ff0250d32 100644
--- a/src/block/rc5/rc5.cpp
+++ b/src/block/rc5/rc5.cpp
@@ -77,7 +77,8 @@ void RC5::decrypt_n(const byte in[], byte out[], u32bit blocks) const
void RC5::key_schedule(const byte key[], u32bit length)
{
const u32bit WORD_KEYLENGTH = (((length - 1) / 4) + 1),
- MIX_ROUNDS = 3*std::max(WORD_KEYLENGTH, S.size());
+ MIX_ROUNDS = 3*std::max<u32bit>(WORD_KEYLENGTH, S.size());
+
S[0] = 0xB7E15163;
for(u32bit j = 1; j != S.size(); ++j)
S[j] = S[j-1] + 0x9E3779B9;
diff --git a/src/block/rc6/rc6.cpp b/src/block/rc6/rc6.cpp
index 5f88d1d0b..291d3b97e 100644
--- a/src/block/rc6/rc6.cpp
+++ b/src/block/rc6/rc6.cpp
@@ -114,7 +114,7 @@ void RC6::decrypt_n(const byte in[], byte out[], u32bit blocks) const
void RC6::key_schedule(const byte key[], u32bit length)
{
const u32bit WORD_KEYLENGTH = (((length - 1) / 4) + 1),
- MIX_ROUNDS = 3*std::max(WORD_KEYLENGTH, S.size());
+ MIX_ROUNDS = 3*std::max<u32bit>(WORD_KEYLENGTH, S.size());
S[0] = 0xB7E15163;
for(u32bit j = 1; j != S.size(); ++j)
S[j] = S[j-1] + 0x9E3779B9;