aboutsummaryrefslogtreecommitdiffstats
path: root/src/block/cast/cast256.cpp
diff options
context:
space:
mode:
authorlloyd <[email protected]>2010-10-12 19:41:37 +0000
committerlloyd <[email protected]>2010-10-12 19:41:37 +0000
commitff2210b035a1598bf99e18a578ff075bece8fbe5 (patch)
tree4efe3a23daac9e2cd8b9f2b794d95089ba4cdfb2 /src/block/cast/cast256.cpp
parente7e3af16a3540e1d7a84e085aa1ea7c55f627930 (diff)
Use size_t rather than u32bit for the blocks argument of encrypt_n
Diffstat (limited to 'src/block/cast/cast256.cpp')
-rw-r--r--src/block/cast/cast256.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/block/cast/cast256.cpp b/src/block/cast/cast256.cpp
index 551d4e387..6567ffbd4 100644
--- a/src/block/cast/cast256.cpp
+++ b/src/block/cast/cast256.cpp
@@ -48,9 +48,9 @@ void round3(u32bit& out, u32bit in, u32bit mask, u32bit rot)
/*
* CAST-256 Encryption
*/
-void CAST_256::encrypt_n(const byte in[], byte out[], u32bit blocks) const
+void CAST_256::encrypt_n(const byte in[], byte out[], size_t blocks) const
{
- for(u32bit i = 0; i != blocks; ++i)
+ for(size_t i = 0; i != blocks; ++i)
{
u32bit A = load_be<u32bit>(in, 0);
u32bit B = load_be<u32bit>(in, 1);
@@ -92,9 +92,9 @@ void CAST_256::encrypt_n(const byte in[], byte out[], u32bit blocks) const
/*
* CAST-256 Decryption
*/
-void CAST_256::decrypt_n(const byte in[], byte out[], u32bit blocks) const
+void CAST_256::decrypt_n(const byte in[], byte out[], size_t blocks) const
{
- for(u32bit i = 0; i != blocks; ++i)
+ for(size_t i = 0; i != blocks; ++i)
{
u32bit A = load_be<u32bit>(in, 0);
u32bit B = load_be<u32bit>(in, 1);
@@ -139,13 +139,13 @@ void CAST_256::decrypt_n(const byte in[], byte out[], u32bit blocks) const
void CAST_256::key_schedule(const byte key[], u32bit length)
{
SecureVector<u32bit> K(8);
- for(u32bit j = 0; j != length; ++j)
+ for(size_t j = 0; j != length; ++j)
K[j/4] = (K[j/4] << 8) + key[j];
u32bit A = K[0], B = K[1], C = K[2], D = K[3],
E = K[4], F = K[5], G = K[6], H = K[7];
- for(u32bit j = 0; j != 48; j += 4)
+ for(size_t j = 0; j != 48; j += 4)
{
round1(G, H, KEY_MASK[4*j+ 0], KEY_ROT[(4*j+ 0) % 32]);
round2(F, G, KEY_MASK[4*j+ 1], KEY_ROT[(4*j+ 1) % 32]);