diff options
author | lloyd <[email protected]> | 2010-10-13 01:34:15 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2010-10-13 01:34:15 +0000 |
commit | fe4119c74b5e81a354a5313e4d2efbf9a135aa81 (patch) | |
tree | 5c5254cc3a4e5713169ef1d52a83db19c8c4ed65 /src/block/idea | |
parent | 60fb91d8cb1710d07041f76050d24229ce91131b (diff) |
Use size_t rather than u32bit in SymmetricAlgorithm
Diffstat (limited to 'src/block/idea')
-rw-r--r-- | src/block/idea/idea.cpp | 28 | ||||
-rw-r--r-- | src/block/idea/idea.h | 2 |
2 files changed, 15 insertions, 15 deletions
diff --git a/src/block/idea/idea.cpp b/src/block/idea/idea.cpp index 8201c9193..be7680b2c 100644 --- a/src/block/idea/idea.cpp +++ b/src/block/idea/idea.cpp @@ -122,16 +122,16 @@ void IDEA::decrypt_n(const byte in[], byte out[], size_t blocks) const /* * IDEA Key Schedule */ -void IDEA::key_schedule(const byte key[], u32bit) +void IDEA::key_schedule(const byte key[], size_t) { - for(size_t j = 0; j != 8; ++j) - EK[j] = load_be<u16bit>(key, j); + for(size_t i = 0; i != 8; ++i) + EK[i] = load_be<u16bit>(key, i); - for(size_t j = 1, k = 8, offset = 0; k != 52; j %= 8, ++j, ++k) + for(size_t i = 1, j = 8, offset = 0; j != 52; i %= 8, ++i, ++j) { - EK[j+7+offset] = static_cast<u16bit>((EK[(j % 8) + offset] << 9) | - (EK[((j+1) % 8) + offset] >> 7)); - offset += (j == 8) ? 8 : 0; + EK[i+7+offset] = static_cast<u16bit>((EK[(i % 8) + offset] << 9) | + (EK[((i+1) % 8) + offset] >> 7)); + offset += (i == 8) ? 8 : 0; } DK[51] = mul_inv(EK[3]); @@ -139,14 +139,14 @@ void IDEA::key_schedule(const byte key[], u32bit) DK[49] = -EK[1]; DK[48] = mul_inv(EK[0]); - for(size_t j = 1, k = 4, counter = 47; j != 8; ++j, k += 6) + for(size_t i = 1, j = 4, counter = 47; i != 8; ++i, j += 6) { - DK[counter--] = EK[k+1]; - DK[counter--] = EK[k]; - DK[counter--] = mul_inv(EK[k+5]); - DK[counter--] = -EK[k+3]; - DK[counter--] = -EK[k+4]; - DK[counter--] = mul_inv(EK[k+2]); + DK[counter--] = EK[j+1]; + DK[counter--] = EK[j]; + DK[counter--] = mul_inv(EK[j+5]); + DK[counter--] = -EK[j+3]; + DK[counter--] = -EK[j+4]; + DK[counter--] = mul_inv(EK[j+2]); } DK[5] = EK[47]; diff --git a/src/block/idea/idea.h b/src/block/idea/idea.h index 566d9afd4..c0af38ad6 100644 --- a/src/block/idea/idea.h +++ b/src/block/idea/idea.h @@ -38,7 +38,7 @@ class BOTAN_DLL IDEA : public BlockCipher const SecureVector<u16bit>& get_DK() const { return DK; } private: - void key_schedule(const byte[], u32bit); + void key_schedule(const byte[], size_t); SecureVector<u16bit> EK, DK; }; |