aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorlloyd <lloyd@randombit.net>2011-02-16 14:44:29 +0000
committerlloyd <lloyd@randombit.net>2011-02-16 14:44:29 +0000
commitd996f15128ff12fb268f342cbbc0a855666caae4 (patch)
tree8783784a37cf35937a6d544715924dc682195c26 /src
parentf39bf4aad827a66e7f983b303b999d6e2ba4cd93 (diff)
Use size_t rather than u32bit for loop variables
Diffstat (limited to 'src')
-rw-r--r--src/block/aes/aes.cpp4
-rw-r--r--src/cert/x509cert/x509cert.cpp24
-rw-r--r--src/constructs/aont/package.cpp8
-rw-r--r--src/stream/ctr/ctr.cpp4
4 files changed, 20 insertions, 20 deletions
diff --git a/src/block/aes/aes.cpp b/src/block/aes/aes.cpp
index 7f32d243c..9fb12cd11 100644
--- a/src/block/aes/aes.cpp
+++ b/src/block/aes/aes.cpp
@@ -457,7 +457,7 @@ void aes_encrypt_n(const byte in[], byte out[],
rotate_right(TE[get_byte(2, T1)], 16) ^
rotate_right(TE[get_byte(3, T2)], 24) ^ EK[7];
- for(u32bit r = 2*4; r < EK.size(); r += 2*4)
+ for(size_t r = 2*4; r < EK.size(); r += 2*4)
{
T0 = TE0[get_byte(0, B0)] ^ TE1[get_byte(1, B1)] ^
TE2[get_byte(2, B2)] ^ TE3[get_byte(3, B3)] ^ EK[r];
@@ -560,7 +560,7 @@ void aes_decrypt_n(const byte in[], byte out[], size_t blocks,
rotate_right(TD[get_byte(2, T1)], 16) ^
rotate_right(TD[get_byte(3, T0)], 24) ^ DK[7];
- for(u32bit r = 2*4; r < DK.size(); r += 2*4)
+ for(size_t r = 2*4; r < DK.size(); r += 2*4)
{
T0 = TD0[get_byte(0, B0)] ^ TD1[get_byte(1, B3)] ^
TD2[get_byte(2, B2)] ^ TD3[get_byte(3, B1)] ^ DK[r];
diff --git a/src/cert/x509cert/x509cert.cpp b/src/cert/x509cert/x509cert.cpp
index b7c399078..38775271e 100644
--- a/src/cert/x509cert/x509cert.cpp
+++ b/src/cert/x509cert/x509cert.cpp
@@ -378,16 +378,16 @@ std::string X509_Certificate::to_string() const
if(policies.size())
{
out << "Policies: " << "\n";
- for(u32bit j = 0; j != policies.size(); j++)
- out << " " << policies[j] << "\n";
+ for(size_t i = 0; i != policies.size(); i++)
+ out << " " << policies[i] << "\n";
}
std::vector<std::string> ex_constraints = this->ex_constraints();
if(ex_constraints.size())
{
out << "Extended Constraints:\n";
- for(u32bit j = 0; j != ex_constraints.size(); j++)
- out << " " << ex_constraints[j] << "\n";
+ for(size_t i = 0; i != ex_constraints.size(); i++)
+ out << " " << ex_constraints[i] << "\n";
}
out << "Signature algorithm: " <<
@@ -425,9 +425,9 @@ X509_DN create_dn(const Data_Store& info)
X509_DN dn;
- std::multimap<std::string, std::string>::iterator j;
- for(j = names.begin(); j != names.end(); ++j)
- dn.add_attribute(j->first, j->second);
+ std::multimap<std::string, std::string>::iterator i;
+ for(i = names.begin(); i != names.end(); ++i)
+ dn.add_attribute(i->first, i->second);
return dn;
}
@@ -442,8 +442,8 @@ AlternativeName create_alt_name(const Data_Store& info)
public:
bool operator()(const std::string& key, const std::string&) const
{
- for(u32bit j = 0; j != matches.size(); ++j)
- if(key.compare(matches[j]) == 0)
+ for(size_t i = 0; i != matches.size(); ++i)
+ if(key.compare(matches[i]) == 0)
return true;
return false;
}
@@ -461,9 +461,9 @@ AlternativeName create_alt_name(const Data_Store& info)
AlternativeName alt_name;
- std::multimap<std::string, std::string>::iterator j;
- for(j = names.begin(); j != names.end(); ++j)
- alt_name.add_attribute(j->first, j->second);
+ std::multimap<std::string, std::string>::iterator i;
+ for(i = names.begin(); i != names.end(); ++i)
+ alt_name.add_attribute(i->first, i->second);
return alt_name;
}
diff --git a/src/constructs/aont/package.cpp b/src/constructs/aont/package.cpp
index 4d92a789c..4d46f6b61 100644
--- a/src/constructs/aont/package.cpp
+++ b/src/constructs/aont/package.cpp
@@ -46,13 +46,13 @@ void aont_package(RandomNumberGenerator& rng,
clear_mem(final_block, BLOCK_SIZE);
// XOR the hash blocks into the final block
- for(u32bit i = 0; i != blocks; ++i)
+ for(size_t i = 0; i != blocks; ++i)
{
const size_t left = std::min<size_t>(BLOCK_SIZE,
input_len - BLOCK_SIZE * i);
zeroise(buf);
- copy_mem(&buf[0], output + BLOCK_SIZE * i, left);
+ copy_mem(&buf[0], output + (BLOCK_SIZE * i), left);
for(size_t j = 0; j != sizeof(i); ++j)
buf[BLOCK_SIZE - 1 - j] ^= get_byte(sizeof(i)-1-j, i);
@@ -94,13 +94,13 @@ void aont_unpackage(BlockCipher* cipher,
const size_t blocks = ((input_len - 1) / BLOCK_SIZE);
// XOR the blocks into the package key bits
- for(u32bit i = 0; i != blocks; ++i)
+ for(size_t i = 0; i != blocks; ++i)
{
const size_t left = std::min<size_t>(BLOCK_SIZE,
input_len - BLOCK_SIZE * (i+1));
zeroise(buf);
- copy_mem(&buf[0], input + BLOCK_SIZE * i, left);
+ copy_mem(&buf[0], input + (BLOCK_SIZE * i), left);
for(size_t j = 0; j != sizeof(i); ++j)
buf[BLOCK_SIZE - 1 - j] ^= get_byte(sizeof(i)-1-j, i);
diff --git a/src/stream/ctr/ctr.cpp b/src/stream/ctr/ctr.cpp
index 0de0b7b84..d221dc441 100644
--- a/src/stream/ctr/ctr.cpp
+++ b/src/stream/ctr/ctr.cpp
@@ -97,7 +97,7 @@ void CTR_BE::set_iv(const byte iv[], size_t iv_len)
&counter[(i-1)*BLOCK_SIZE],
BLOCK_SIZE);
- for(u32bit j = 0; j != BLOCK_SIZE; ++j)
+ for(size_t j = 0; j != BLOCK_SIZE; ++j)
if(++counter[i*BLOCK_SIZE + (BLOCK_SIZE-1-j)])
break;
}
@@ -115,7 +115,7 @@ void CTR_BE::increment_counter()
for(size_t i = 0; i != 256; ++i)
{
- for(u32bit j = 1; j != BLOCK_SIZE; ++j)
+ for(size_t j = 1; j != BLOCK_SIZE; ++j)
if(++counter[i*BLOCK_SIZE + (BLOCK_SIZE-1-j)])
break;
}