diff options
author | lloyd <[email protected]> | 2010-10-12 19:41:37 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2010-10-12 19:41:37 +0000 |
commit | ff2210b035a1598bf99e18a578ff075bece8fbe5 (patch) | |
tree | 4efe3a23daac9e2cd8b9f2b794d95089ba4cdfb2 /src/block/blowfish | |
parent | e7e3af16a3540e1d7a84e085aa1ea7c55f627930 (diff) |
Use size_t rather than u32bit for the blocks argument of encrypt_n
Diffstat (limited to 'src/block/blowfish')
-rw-r--r-- | src/block/blowfish/blowfish.cpp | 18 | ||||
-rw-r--r-- | src/block/blowfish/blowfish.h | 4 |
2 files changed, 11 insertions, 11 deletions
diff --git a/src/block/blowfish/blowfish.cpp b/src/block/blowfish/blowfish.cpp index 91d25884d..e72dbb2ae 100644 --- a/src/block/blowfish/blowfish.cpp +++ b/src/block/blowfish/blowfish.cpp @@ -13,19 +13,19 @@ namespace Botan { /* * Blowfish Encryption */ -void Blowfish::encrypt_n(const byte in[], byte out[], u32bit blocks) const +void Blowfish::encrypt_n(const byte in[], byte out[], size_t blocks) const { const u32bit* S1 = &S[0]; const u32bit* S2 = &S[256]; const u32bit* S3 = &S[512]; const u32bit* S4 = &S[768]; - for(u32bit i = 0; i != blocks; ++i) + for(size_t i = 0; i != blocks; ++i) { u32bit L = load_be<u32bit>(in, 0); u32bit R = load_be<u32bit>(in, 1); - for(u32bit j = 0; j != 16; j += 2) + for(size_t j = 0; j != 16; j += 2) { L ^= P[j]; R ^= ((S1[get_byte(0, L)] + S2[get_byte(1, L)]) ^ @@ -48,19 +48,19 @@ void Blowfish::encrypt_n(const byte in[], byte out[], u32bit blocks) const /* * Blowfish Decryption */ -void Blowfish::decrypt_n(const byte in[], byte out[], u32bit blocks) const +void Blowfish::decrypt_n(const byte in[], byte out[], size_t blocks) const { const u32bit* S1 = &S[0]; const u32bit* S2 = &S[256]; const u32bit* S3 = &S[512]; const u32bit* S4 = &S[768]; - for(u32bit i = 0; i != blocks; ++i) + for(size_t i = 0; i != blocks; ++i) { u32bit L = load_be<u32bit>(in, 0); u32bit R = load_be<u32bit>(in, 1); - for(u32bit j = 17; j != 1; j -= 2) + for(size_t j = 17; j != 1; j -= 2) { L ^= P[j]; R ^= ((S1[get_byte(0, L)] + S2[get_byte(1, L)]) ^ @@ -87,7 +87,7 @@ void Blowfish::key_schedule(const byte key[], u32bit length) { clear(); - for(u32bit j = 0, k = 0; j != 18; ++j, k += 4) + for(size_t j = 0, k = 0; j != 18; ++j, k += 4) P[j] ^= make_u32bit(key[(k ) % length], key[(k+1) % length], key[(k+2) % length], key[(k+3) % length]); @@ -107,9 +107,9 @@ void Blowfish::generate_sbox(MemoryRegion<u32bit>& box, const u32bit* S3 = &S[512]; const u32bit* S4 = &S[768]; - for(u32bit j = 0; j != box.size(); j += 2) + for(size_t j = 0; j != box.size(); j += 2) { - for(u32bit k = 0; k != 16; k += 2) + for(size_t k = 0; k != 16; k += 2) { L ^= P[k]; R ^= ((S1[get_byte(0, L)] + S2[get_byte(1, L)]) ^ diff --git a/src/block/blowfish/blowfish.h b/src/block/blowfish/blowfish.h index 0b4df50ad..32fb4cbd4 100644 --- a/src/block/blowfish/blowfish.h +++ b/src/block/blowfish/blowfish.h @@ -18,8 +18,8 @@ namespace Botan { class BOTAN_DLL Blowfish : public BlockCipher { public: - void encrypt_n(const byte in[], byte out[], u32bit blocks) const; - void decrypt_n(const byte in[], byte out[], u32bit blocks) const; + void encrypt_n(const byte in[], byte out[], size_t blocks) const; + void decrypt_n(const byte in[], byte out[], size_t blocks) const; void clear(); std::string name() const { return "Blowfish"; } |