aboutsummaryrefslogtreecommitdiffstats
path: root/src/block/misty1/misty1.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/misty1/misty1.cpp
parente7e3af16a3540e1d7a84e085aa1ea7c55f627930 (diff)
Use size_t rather than u32bit for the blocks argument of encrypt_n
Diffstat (limited to 'src/block/misty1/misty1.cpp')
-rw-r--r--src/block/misty1/misty1.cpp32
1 files changed, 16 insertions, 16 deletions
diff --git a/src/block/misty1/misty1.cpp b/src/block/misty1/misty1.cpp
index 1d032172d..891abf49f 100644
--- a/src/block/misty1/misty1.cpp
+++ b/src/block/misty1/misty1.cpp
@@ -102,16 +102,16 @@ u16bit FI(u16bit input, u16bit key7, u16bit key9)
/*
* MISTY1 Encryption
*/
-void MISTY1::encrypt_n(const byte in[], byte out[], u32bit blocks) const
+void MISTY1::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)
{
u16bit B0 = load_be<u16bit>(in, 0);
u16bit B1 = load_be<u16bit>(in, 1);
u16bit B2 = load_be<u16bit>(in, 2);
u16bit B3 = load_be<u16bit>(in, 3);
- for(u32bit j = 0; j != 12; j += 3)
+ for(size_t j = 0; j != 12; j += 3)
{
const u16bit* RK = &EK[8 * j];
@@ -152,16 +152,16 @@ void MISTY1::encrypt_n(const byte in[], byte out[], u32bit blocks) const
/*
* MISTY1 Decryption
*/
-void MISTY1::decrypt_n(const byte in[], byte out[], u32bit blocks) const
+void MISTY1::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)
{
u16bit B0 = load_be<u16bit>(in, 2);
u16bit B1 = load_be<u16bit>(in, 3);
u16bit B2 = load_be<u16bit>(in, 0);
u16bit B3 = load_be<u16bit>(in, 1);
- for(u32bit j = 0; j != 12; j += 3)
+ for(size_t j = 0; j != 12; j += 3)
{
const u16bit* RK = &DK[8 * j];
@@ -205,14 +205,14 @@ void MISTY1::decrypt_n(const byte in[], byte out[], u32bit blocks) const
void MISTY1::key_schedule(const byte key[], u32bit length)
{
SecureVector<u16bit> KS(32);
- for(u32bit j = 0; j != length / 2; ++j)
- KS[j] = load_be<u16bit>(key, j);
+ for(size_t i = 0; i != length / 2; ++i)
+ KS[i] = load_be<u16bit>(key, i);
- for(u32bit j = 0; j != 8; ++j)
+ for(size_t i = 0; i != 8; ++i)
{
- KS[j+ 8] = FI(KS[j], KS[(j+1) % 8] >> 9, KS[(j+1) % 8] & 0x1FF);
- KS[j+16] = KS[j+8] >> 9;
- KS[j+24] = KS[j+8] & 0x1FF;
+ KS[i+ 8] = FI(KS[i], KS[(i+1) % 8] >> 9, KS[(i+1) % 8] & 0x1FF);
+ KS[i+16] = KS[i+8] >> 9;
+ KS[i+24] = KS[i+8] & 0x1FF;
}
/*
@@ -241,17 +241,17 @@ void MISTY1::key_schedule(const byte key[], u32bit length)
0x1C, 0x05, 0x00, 0x15, 0x1D, 0x02, 0x11, 0x19, 0x07, 0x13, 0x1B, 0x04,
0x04, 0x0A, 0x0E, 0x00 };
- for(u32bit j = 0; j != 100; ++j)
+ for(size_t i = 0; i != 100; ++i)
{
- EK[j] = KS[EK_ORDER[j]];
- DK[j] = KS[DK_ORDER[j]];
+ EK[i] = KS[EK_ORDER[i]];
+ DK[i] = KS[DK_ORDER[i]];
}
}
/*
* MISTY1 Constructor
*/
-MISTY1::MISTY1(u32bit rounds) : BlockCipher(8, 16), EK(100), DK(100)
+MISTY1::MISTY1(size_t rounds) : BlockCipher(8, 16), EK(100), DK(100)
{
if(rounds != 8)
throw Invalid_Argument("MISTY1: Invalid number of rounds: "