aboutsummaryrefslogtreecommitdiffstats
path: root/src/block/rc6
diff options
context:
space:
mode:
authorlloyd <[email protected]>2010-10-13 01:34:15 +0000
committerlloyd <[email protected]>2010-10-13 01:34:15 +0000
commitfe4119c74b5e81a354a5313e4d2efbf9a135aa81 (patch)
tree5c5254cc3a4e5713169ef1d52a83db19c8c4ed65 /src/block/rc6
parent60fb91d8cb1710d07041f76050d24229ce91131b (diff)
Use size_t rather than u32bit in SymmetricAlgorithm
Diffstat (limited to 'src/block/rc6')
-rw-r--r--src/block/rc6/rc6.cpp20
-rw-r--r--src/block/rc6/rc6.h2
2 files changed, 11 insertions, 11 deletions
diff --git a/src/block/rc6/rc6.cpp b/src/block/rc6/rc6.cpp
index f81f25efd..53ca5a7a2 100644
--- a/src/block/rc6/rc6.cpp
+++ b/src/block/rc6/rc6.cpp
@@ -111,27 +111,27 @@ void RC6::decrypt_n(const byte in[], byte out[], size_t blocks) const
/*
* RC6 Key Schedule
*/
-void RC6::key_schedule(const byte key[], u32bit length)
+void RC6::key_schedule(const byte key[], size_t length)
{
const size_t WORD_KEYLENGTH = (((length - 1) / 4) + 1);
const size_t MIX_ROUNDS = 3 * std::max(WORD_KEYLENGTH, S.size());
S[0] = 0xB7E15163;
- for(size_t j = 1; j != S.size(); ++j)
- S[j] = S[j-1] + 0x9E3779B9;
+ for(size_t i = 1; i != S.size(); ++i)
+ S[i] = S[i-1] + 0x9E3779B9;
SecureVector<u32bit> K(8);
- for(s32bit j = length-1; j >= 0; --j)
- K[j/4] = (K[j/4] << 8) + key[j];
+ for(s32bit i = length-1; i >= 0; --i)
+ K[i/4] = (K[i/4] << 8) + key[i];
u32bit A = 0, B = 0;
- for(u32bit j = 0; j != MIX_ROUNDS; ++j)
+ for(size_t i = 0; i != MIX_ROUNDS; ++i)
{
- A = rotate_left(S[j % S.size()] + A + B, 3);
- B = rotate_left(K[j % WORD_KEYLENGTH] + A + B, (A + B) % 32);
- S[j % S.size()] = A;
- K[j % WORD_KEYLENGTH] = B;
+ A = rotate_left(S[i % S.size()] + A + B, 3);
+ B = rotate_left(K[i % WORD_KEYLENGTH] + A + B, (A + B) % 32);
+ S[i % S.size()] = A;
+ K[i % WORD_KEYLENGTH] = B;
}
}
diff --git a/src/block/rc6/rc6.h b/src/block/rc6/rc6.h
index ada7e9610..307834a8c 100644
--- a/src/block/rc6/rc6.h
+++ b/src/block/rc6/rc6.h
@@ -27,7 +27,7 @@ class BOTAN_DLL RC6 : public BlockCipher
RC6() : BlockCipher(16, 1, 32), S(44) {}
private:
- void key_schedule(const byte[], u32bit);
+ void key_schedule(const byte[], size_t);
SecureVector<u32bit> S;
};